mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chris Wright <chrisw@sous-sol.org>
To: linux-kernel@vger.kernel.org, stable@kernel.org, jejb@kernel.org
Cc: Justin Forbes <jmforbes@linuxtx.org>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Dave Jones <davej@redhat.com>,
	Chuck Wolber <chuckw@quantumlinux.com>,
	Chris Wedgwood <reviews@ml.cw.f00f.org>,
	Michael Krufky <mkrufky@linuxtv.org>,
	Chuck Ebbert <cebbert@redhat.com>,
	Domenico Andreoli <cavokz@gmail.com>,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, Boaz Harrosh <bharrosh@panasas.com>,
	James Bottomley <James.Bottomley@HansenPartnership.com>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: [patch 61/76] SCSI: gdth: fix to internal commands execution
Date: Fri, 21 Mar 2008 15:43:51 -0700	[thread overview]
Message-ID: <20080321224440.149796829@sous-sol.org> (raw)
In-Reply-To: <20080321224250.144333319@sous-sol.org>

[-- Attachment #1: scsi-gdth-fix-to-internal-commands-execution.patch --]
[-- Type: text/plain, Size: 7206 bytes --]

-stable review patch.  If anyone has any objections, please let us know.
---------------------

From: Boaz Harrosh <bharrosh@panasas.com>

The recent patch named:
  [SCSI] gdth: !use_sg cleanup and use of scsi accessors

has done a bad job in handling internal commands issued by gdth_execute().

Internal commands are issued with device gdth_cmd_str ready made directly
to the card, without any mapping or translations of scsi commands. So here
I added a gdth_cmd_str pointer to the gdth_cmndinfo private structure which
is then copied directly to host.

following this patch is a cleanup that removes the home cooked accessors
and reverts them to regular scsi_cmnd accessors. Since they are not used
anymore. After review maybe the 2 patches should be squashed together.

FIXME: There is still a problem with gdth_get_info(). as reported there
   is a WARN_ON trigerd in dma_free_coherent() when doing:
   $ cat /proc/sys/gdth/0

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Tested-by: Joerg Dorchain: <joerg@dorchain.net>
Tested-by: Stefan Priebe <s.priebe@allied-internet.ag>
Tested-by: Jon Chelton <jchelton@ffpglobal.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/scsi/gdth.c |   30 ++++++++++++------------------
 drivers/scsi/gdth.h |    1 +
 2 files changed, 13 insertions(+), 18 deletions(-)

--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -160,7 +160,7 @@ static void gdth_readapp_event(gdth_ha_s
 static void gdth_clear_events(void);
 
 static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp,
-                                    char *buffer, ushort count, int to_buffer);
+                                    char *buffer, ushort count);
 static int gdth_internal_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp);
 static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive);
 
@@ -439,8 +439,8 @@ static struct gdth_cmndinfo *gdth_get_cm
 	for (i=0; i<GDTH_MAXCMDS; ++i) {
 		if (ha->cmndinfo[i].index == 0) {
 			priv = &ha->cmndinfo[i];
-			priv->index = i+1;
 			memset(priv, 0, sizeof(*priv));
+			priv->index = i+1;
 			break;
 		}
 	}
@@ -487,7 +487,6 @@ int __gdth_execute(struct scsi_device *s
     gdth_ha_str *ha = shost_priv(sdev->host);
     Scsi_Cmnd *scp;
     struct gdth_cmndinfo cmndinfo;
-    struct scatterlist one_sg;
     DECLARE_COMPLETION_ONSTACK(wait);
     int rval;
 
@@ -501,13 +500,10 @@ int __gdth_execute(struct scsi_device *s
     /* use request field to save the ptr. to completion struct. */
     scp->request = (struct request *)&wait;
     scp->timeout_per_command = timeout*HZ;
-    sg_init_one(&one_sg, gdtcmd, sizeof(*gdtcmd));
-    gdth_set_sglist(scp, &one_sg);
-    gdth_set_sg_count(scp, 1);
-    gdth_set_bufflen(scp, sizeof(*gdtcmd));
     scp->cmd_len = 12;
     memcpy(scp->cmnd, cmnd, 12);
     cmndinfo.priority = IOCTL_PRI;
+    cmndinfo.internal_cmd_str = gdtcmd;
     cmndinfo.internal_command = 1;
 
     TRACE(("__gdth_execute() cmd 0x%x\n", scp->cmnd[0]));
@@ -2348,7 +2344,7 @@ static void gdth_next(gdth_ha_str *ha)
  * buffers, kmap_atomic() as needed.
  */
 static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp,
-                                    char *buffer, ushort count, int to_buffer)
+                                    char *buffer, ushort count)
 {
     ushort cpcount,i, max_sg = gdth_sg_count(scp);
     ushort cpsum,cpnow;
@@ -2374,10 +2370,7 @@ static void gdth_copy_internal_data(gdth
             }
             local_irq_save(flags);
             address = kmap_atomic(sg_page(sl), KM_BIO_SRC_IRQ) + sl->offset;
-            if (to_buffer)
-                memcpy(buffer, address, cpnow);
-            else
-                memcpy(address, buffer, cpnow);
+            memcpy(address, buffer, cpnow);
             flush_dcache_page(sg_page(sl));
             kunmap_atomic(address, KM_BIO_SRC_IRQ);
             local_irq_restore(flags);
@@ -2431,7 +2424,7 @@ static int gdth_internal_cache_cmd(gdth_
         strcpy(inq.vendor,ha->oem_name);
         sprintf(inq.product,"Host Drive  #%02d",t);
         strcpy(inq.revision,"   ");
-        gdth_copy_internal_data(ha, scp, (char*)&inq, sizeof(gdth_inq_data), 0);
+        gdth_copy_internal_data(ha, scp, (char*)&inq, sizeof(gdth_inq_data));
         break;
 
       case REQUEST_SENSE:
@@ -2441,7 +2434,7 @@ static int gdth_internal_cache_cmd(gdth_
         sd.key       = NO_SENSE;
         sd.info      = 0;
         sd.add_length= 0;
-        gdth_copy_internal_data(ha, scp, (char*)&sd, sizeof(gdth_sense_data), 0);
+        gdth_copy_internal_data(ha, scp, (char*)&sd, sizeof(gdth_sense_data));
         break;
 
       case MODE_SENSE:
@@ -2453,7 +2446,7 @@ static int gdth_internal_cache_cmd(gdth_
         mpd.bd.block_length[0] = (SECTOR_SIZE & 0x00ff0000) >> 16;
         mpd.bd.block_length[1] = (SECTOR_SIZE & 0x0000ff00) >> 8;
         mpd.bd.block_length[2] = (SECTOR_SIZE & 0x000000ff);
-        gdth_copy_internal_data(ha, scp, (char*)&mpd, sizeof(gdth_modep_data), 0);
+        gdth_copy_internal_data(ha, scp, (char*)&mpd, sizeof(gdth_modep_data));
         break;
 
       case READ_CAPACITY:
@@ -2463,7 +2456,7 @@ static int gdth_internal_cache_cmd(gdth_
         else
             rdc.last_block_no = cpu_to_be32(ha->hdr[t].size-1);
         rdc.block_length  = cpu_to_be32(SECTOR_SIZE);
-        gdth_copy_internal_data(ha, scp, (char*)&rdc, sizeof(gdth_rdcap_data), 0);
+        gdth_copy_internal_data(ha, scp, (char*)&rdc, sizeof(gdth_rdcap_data));
         break;
 
       case SERVICE_ACTION_IN:
@@ -2475,7 +2468,7 @@ static int gdth_internal_cache_cmd(gdth_
             rdc16.last_block_no = cpu_to_be64(ha->hdr[t].size-1);
             rdc16.block_length  = cpu_to_be32(SECTOR_SIZE);
             gdth_copy_internal_data(ha, scp, (char*)&rdc16,
-                                                 sizeof(gdth_rdcap16_data), 0);
+                                                 sizeof(gdth_rdcap16_data));
         } else { 
             scp->result = DID_ABORT << 16;
         }
@@ -2845,6 +2838,7 @@ static int gdth_fill_raw_cmd(gdth_ha_str
 static int gdth_special_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp)
 {
     register gdth_cmd_str *cmdp;
+    struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp);
     int cmd_index;
 
     cmdp= ha->pccb;
@@ -2853,7 +2847,7 @@ static int gdth_special_cmd(gdth_ha_str 
     if (ha->type==GDT_EISA && ha->cmd_cnt>0) 
         return 0;
 
-    gdth_copy_internal_data(ha, scp, (char *)cmdp, sizeof(gdth_cmd_str), 1);
+    *cmdp = *cmndinfo->internal_cmd_str;
     cmdp->RequestBuffer = scp;
 
     /* search free command index */
--- a/drivers/scsi/gdth.h
+++ b/drivers/scsi/gdth.h
@@ -915,6 +915,7 @@ typedef struct {
     struct gdth_cmndinfo {                      /* per-command private info */
         int index;
         int internal_command;                   /* don't call scsi_done */
+        gdth_cmd_str *internal_cmd_str;         /* crier for internal messages*/
         dma_addr_t sense_paddr;                 /* sense dma-addr */
         unchar priority;
         int timeout;

-- 

  parent reply	other threads:[~2008-03-21 23:06 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-21 22:42 [patch 00/76] 2.6.24-stable review Chris Wright
2008-03-21 22:42 ` [patch 01/76] Revert "NET: Add if_addrlabel.h to sanitized headers." Chris Wright
2008-03-21 22:42 ` [patch 02/76] SPARC64: Loosen checks in exception table handling Chris Wright
2008-03-21 22:42 ` [patch 03/76] SPARC: Fix link errors with gcc-4.3 Chris Wright
2008-03-21 22:42 ` [patch 04/76] TCP: Improve ipv4 established hash function Chris Wright
2008-03-21 22:42 ` [patch 05/76] NIU: More BMAC alt MAC address fixes Chris Wright
2008-03-21 22:42 ` [patch 06/76] NIU: Fix BMAC alternate MAC address indexing Chris Wright
2008-03-21 22:42 ` [patch 07/76] NIU: Bump driver version and release date Chris Wright
2008-03-22  0:10   ` Jesper Juhl
2008-03-22  0:14     ` David Miller
2008-03-22  0:16       ` Jesper Juhl
2008-03-26 21:28         ` Jesper Juhl
2008-03-22  2:35       ` Roland Dreier
2008-03-22  5:21         ` David Miller
2008-03-22 22:46           ` David Miller
2008-03-23  4:20             ` Roland Dreier
2008-03-22 22:57       ` Pekka Enberg
2008-03-22 23:26         ` David Miller
2008-03-23  8:42           ` Pekka Enberg
2008-03-23 10:18             ` David Miller
2008-03-23  4:13         ` Greg KH
2008-03-23  8:08           ` Chris Wright
2008-03-24 22:23         ` Adrian Bunk
2008-03-21 22:42 ` [patch 08/76] NET: Messed multicast lists after dev_mc_sync/unsync Chris Wright
2008-03-21 22:42 ` [patch 09/76] NET: Fix race in dev_close(). (Bug 9750) Chris Wright
2008-03-21 22:43 ` [patch 10/76] IPV6: Fix IPsec datagram fragmentation Chris Wright
2008-03-21 22:43 ` [patch 11/76] IPV6: dst_entry leak in ip4ip6_err Chris Wright
2008-03-21 22:43 ` [patch 12/76] IPV4: Remove IP_TOS setting privilege checks Chris Wright
2008-03-21 22:43 ` [patch 13/76] IPCONFIG: The kernel gets no IP from some DHCP servers Chris Wright
2008-03-21 22:43 ` [patch 14/76] IPCOMP: Disable BH on output when using shared tfm Chris Wright
2008-03-21 22:43 ` [patch 15/76] IRQ_NOPROBE helper functions Chris Wright
2008-03-21 22:43 ` [patch 16/76] MIPS: Mark all but i8259 interrupts as no-probe Chris Wright
2008-03-21 22:43 ` [patch 17/76] ub: fix up the conversion to sg_init_table() Chris Wright
2008-03-21 22:43 ` [patch 18/76] x86: Clear DF before calling signal handler Chris Wright
2008-03-21 22:43 ` [patch 19/76] iov_iter_advance() fix Chris Wright
2008-03-21 22:43 ` [patch 20/76] drivers: fix dma_get_required_mask Chris Wright
2008-03-21 22:43 ` [patch 21/76] x86: adjust enable_NMI_through_LVT0() Chris Wright
2008-03-21 22:43 ` [patch 22/76] SCSI ips: handle scsi_add_host() failure, and other err cleanups Chris Wright
2008-03-21 22:43 ` [patch 23/76] CRYPTO xcbc: Fix crash with IPsec Chris Wright
2008-03-21 22:43 ` [patch 24/76] CRYPTO xts: Use proper alignment Chris Wright
2008-03-21 22:43 ` [patch 25/76] fuse: fix permission checking Chris Wright
2008-03-21 22:43 ` [patch 26/76] usb-storage: dont access beyond the end of the sg buffer Chris Wright
2008-03-21 22:43 ` [patch 27/76] SCSI ips: fix data buffer accessors conversion bug Chris Wright
2008-03-21 22:43 ` [patch 28/76] SCSI gdth: dont call pci_free_consistent under spinlock Chris Wright
2008-03-21 22:43 ` [patch 29/76] SCSI aic94xx: fix REQ_TASK_ABORT and REQ_DEVICE_RESET Chris Wright
2008-03-21 22:43 ` [patch 30/76] x86: replace LOCK_PREFIX in futex.h Chris Wright
2008-03-21 22:43 ` [patch 31/76] ARM pxa: fix clock lookup to find specific device clocks Chris Wright
2008-03-21 22:43 ` [patch 32/76] futex: fix init order Chris Wright
2008-03-21 22:43 ` [patch 33/76] futex: runtime enable pi and robust functionality Chris Wright
2008-03-22  7:37   ` Thomas Gleixner
2008-03-22 16:19     ` Heiko Carstens
2008-03-22 18:27       ` Chris Wright
2008-03-22 22:05     ` David Miller
2008-03-27  3:28   ` Benjamin Herrenschmidt
2008-03-21 22:43 ` [patch 34/76] file capabilities: simplify signal check Chris Wright
2008-03-21 22:43 ` [patch 35/76] hugetlb: ensure we do not reference a surplus page after handing it to buddy Chris Wright
2008-03-21 22:43 ` [patch 36/76] ufs: fix parenthesisation in ufs_set_fs_state() Chris Wright
2008-03-21 22:43 ` [patch 37/76] spi: pxa2xx_spi clock polarity fix Chris Wright
2008-03-21 22:43 ` [patch 38/76] NETFILTER: nfnetlink_queue: fix SKB_LINEAR_ASSERT when mangling packet data Chris Wright
2008-03-21 22:43 ` [patch 39/76] NETFILTER: Fix incorrect use of skb_make_writable Chris Wright
2008-03-21 22:43 ` [patch 40/76] NETFILTER: fix ebtable targets return Chris Wright
2008-03-21 22:43 ` [patch 41/76] SCSI advansys: fix overrun_buf aligned bug Chris Wright
2008-03-21 22:43 ` [patch 42/76] pata_hpt*, pata_serverworks: fix UDMA masking Chris Wright
2008-03-21 22:43 ` [patch 43/76] moduleparam: fix alpha, ia64 and ppc64 compile failures Chris Wright
2008-03-21 22:43 ` [patch 44/76] PCI x86: always use conf1 to access config space below 256 bytes Chris Wright
2008-03-21 22:43 ` [patch 45/76] e1000e: Fix CRC stripping in hardware context bug Chris Wright
2008-03-21 22:43 ` [patch 46/76] arcmsr: fix IRQs disabled warning spew Chris Wright
2008-03-21 22:43 ` [patch 47/76] b43: Backport bcm4311 fix Chris Wright
2008-03-21 22:43 ` [patch 48/76] atmel_spi: fix clock polarity Chris Wright
2008-03-21 22:43 ` [patch 49/76] x86: move out tick_nohz_stop_sched_tick() call from the loop Chris Wright
2008-03-21 22:43 ` [patch 50/76] macb: Fix speed setting Chris Wright
2008-03-21 22:43 ` [patch 51/76] ioat: fix ack handling, driver must ensure that ack is zero Chris Wright
2008-03-21 22:43 ` [patch 52/76] eCryptfs: make ecryptfs_prepare_write decrypt the page Chris Wright
2008-03-21 22:43 ` [patch 53/76] VT notifier fix for VT switch Chris Wright
2008-03-21 22:43 ` [patch 54/76] USB: ftdi_sio: Workaround for broken Matrix Orbital serial port Chris Wright
2008-03-21 22:43 ` [patch 55/76] USB: ftdi_sio - really enable EM1010PC Chris Wright
2008-03-21 22:43 ` [patch 56/76] USB: ehci: handle large bulk URBs correctly (again) Chris Wright
2008-03-21 22:43 ` [patch 57/76] SCSI: fix BUG when sum(scatterlist) > bufflen Chris Wright
2008-03-21 22:43 ` [patch 58/76] x86: dont use P6_NOPs if compiling with CONFIG_X86_GENERIC Chris Wright
2008-03-21 22:43 ` [patch 59/76] Fix default compose table initialization Chris Wright
2008-03-21 22:43 ` [patch 60/76] SCSI: gdth: bugfix for the at-exit problems Chris Wright
2008-03-21 22:43 ` Chris Wright [this message]
2008-03-21 22:43 ` [patch 62/76] SCSI: mpt fusion: dont oops if NumPhys==0 Chris Wright
2008-03-21 22:43 ` [patch 63/76] sched: fix race in schedule() Chris Wright
2008-03-21 22:43 ` [patch 64/76] nfsd: fix oops on access from high-numbered ports Chris Wright
2008-03-21 22:43 ` [patch 65/76] sched_nr_migrate wrong mode bits Chris Wright
2008-03-21 22:43 ` [patch 66/76] NETFILTER: xt_time: fix failure to match on Sundays Chris Wright
2008-03-21 22:43 ` [patch 67/76] NETFILTER: nfnetlink_queue: fix computation of allocated size for netlink skb Chris Wright
2008-03-21 22:43 ` [patch 68/76] NETFILTER: nfnetlink_log: fix computation of netlink skb size Chris Wright
2008-03-21 22:43 ` [patch 69/76] zisofs: fix readpage() outside i_size Chris Wright
2008-03-21 22:44 ` [patch 70/76] jbd2: correctly unescape journal data blocks Chris Wright
2008-03-21 22:44 ` [patch 71/76] jbd: " Chris Wright
2008-03-21 22:44 ` [patch 72/76] aio: bad AIO race in aio_complete() leads to process hang Chris Wright
2008-03-21 22:44 ` [patch 73/76] async_tx: avoid the async xor_zero_sum path when src_cnt > device->max_xor Chris Wright
2008-03-21 22:44 ` [patch 74/76] SCSI advansys: Fix bug in AdvLoadMicrocode Chris Wright
2008-03-21 22:44 ` [patch 75/76] BLUETOOTH: Fix bugs in previous conn add/del workqueue changes Chris Wright
2008-03-21 22:44 ` [patch 76/76] relay: fix subbuf_splice_actor() adding too many pages Chris Wright
2008-03-22  1:02 ` [patch 00/76] 2.6.24-stable review Joe Korty
2008-03-22 18:26   ` Chris Wright
2008-03-22 18:28 ` Chris Wright

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080321224440.149796829@sous-sol.org \
    --to=chrisw@sous-sol.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=bharrosh@panasas.com \
    --cc=cavokz@gmail.com \
    --cc=cebbert@redhat.com \
    --cc=chuckw@quantumlinux.com \
    --cc=davej@redhat.com \
    --cc=gregkh@suse.de \
    --cc=jejb@kernel.org \
    --cc=jmforbes@linuxtx.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkrufky@linuxtv.org \
    --cc=rdunlap@xenotime.net \
    --cc=reviews@ml.cw.f00f.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=zwane@arm.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome