Re: [Open-FCoE] [PATCH] bnx2fc: Improve stats update mechanism

2014-05-30 Thread Eddie Wai


On May 30, 2014, at 7:48 PM, "Neil Horman"  wrote:

> On Fri, May 30, 2014 at 02:59:43PM -0700, Eddie Wai wrote:
>> Thanks for fixing this.  The patch generally looks good, but I do have a
>> few comments.
>> 
>> On Fri, 2014-05-30 at 11:01 -0400, Neil Horman wrote:
>>> Recently had this warning reported:
>>> 
>>> [  290.489047] Call Trace:
>>> [  290.489053]  [] dump_stack+0x19/0x1b
>>> [  290.489055]  [] __might_sleep+0x179/0x230
>>> [  290.489057]  [] mutex_lock_nested+0x55/0x520
>>> [  290.489061]  [] ? bnx2fc_l2_rcv_thread+0xc5/0x4c0 
>>> [bnx2fc]
>>> [  290.489065]  [] fc_vport_id_lookup+0x3a/0xa0 [libfc]
>>> [  290.489068]  [] bnx2fc_l2_rcv_thread+0x22c/0x4c0 
>>> [bnx2fc]
>>> [  290.489070]  [] ? bnx2fc_vport_destroy+0x110/0x110 
>>> [bnx2fc]
>>> [  290.489073]  [] kthread+0xed/0x100
>>> [  290.489075]  [] ? insert_kthread_work+0x80/0x80
>>> [  290.489077]  [] ret_from_fork+0x7c/0xb0
>>> [  290.489078]  [] ? insert_kthread_work+0x80/0x80
>>> 
>>> Its due to the fact that we call a potentially sleeping function from the 
>>> bnx2fc
>>> rcv path with preemption disabled (via the get_cpu call embedded in the 
>>> per-cpu
>>> variable stats lookup in bnx2fc_l2_rcv_thread.
>>> 
>>> Easy enough fix, we can just move the stats collection later in the function
>>> where we are sure we won't preempt or sleep.  This also allows us to not 
>>> have to
>>> enable pre-emption when doing a per-cpu lookup, since we're certain not to 
>>> get
>> You mean this allows us to not have to 'disable' pre-emption, right? 
>> 
>> Can you elaborate on how we can be sure that we won't get preempted
>> immediately after retrieving the CPU variable?  I would think it'll be
>> okay to call get_cpu at this stage as there won't be any sleepable mutex
>> lock calls before the put_cpu.
> We can't be sure, but I would assert it doesn't really matter at this point.
> The area in which we update stats is so small that, even if we do hit the
> unlikely chance that we get pre-empted, and then rescheduled on a different 
> cpu,
> it won't matter.  We could add the get_cpu/put_cpu back if you're really 
> intent
> on it, but I'm not sure its worthwhile given that this is a hot path.
I agree with your assessment.  But code wise just so bnx2fc is consistent to 
the software FCoE counterpart, I would advice to use the same get_cpu to 
retrieve that stats CPU variable.  Thanks.
> 
> Neil
> 
>>> rescheduled.
>>> 
>>> Signed-off-by: Neil Horman 
>>> CC: linux-scsi@vger.kernel.org
>>> CC: Robert Love 
>>> CC: Vasu Dev 
>>> ---
>>> drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 16 
>>> 1 file changed, 4 insertions(+), 12 deletions(-)
>>> 
>>> diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c 
>>> b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
>>> index 9b94850..475eee5 100644
>>> --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
>>> +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
>>> @@ -516,23 +516,17 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
>>>skb_pull(skb, sizeof(struct fcoe_hdr));
>>>fr_len = skb->len - sizeof(struct fcoe_crc_eof);
>>> 
>>> -stats = per_cpu_ptr(lport->stats, get_cpu());
>>> -stats->RxFrames++;
>>> -stats->RxWords += fr_len / FCOE_WORD_TO_BYTE;
>>> -
>>>fp = (struct fc_frame *)skb;
>>>fc_frame_init(fp);
>>>fr_dev(fp) = lport;
>>>fr_sof(fp) = hp->fcoe_sof;
>>>if (skb_copy_bits(skb, fr_len, &crc_eof, sizeof(crc_eof))) {
>>> -put_cpu();
>>>kfree_skb(skb);
>>>return;
>>>}
>>>fr_eof(fp) = crc_eof.fcoe_eof;
>>>fr_crc(fp) = crc_eof.fcoe_crc32;
>>>if (pskb_trim(skb, fr_len)) {
>>> -put_cpu();
>>>kfree_skb(skb);
>>>return;
>>>}
>>> @@ -544,7 +538,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
>>>port = lport_priv(vn_port);
>>>if (!ether_addr_equal(port->data_src_addr, dest_mac)) {
>>>BNX2FC_HBA_DBG(lport, "fpma mismatch\n");
>>> -put_cpu();
>>>kfree_skb(skb);
>>>return;
>>>}
>>> @@ -552,7 +545,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
>>>if (fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA &&
>>>fh->fh_type == FC_TYPE_FCP) {
>>>/* Drop FCP data. We dont this in L2 path */
>>> -put_cpu();
>>>kfree_skb(skb);
>>>return;
>>>}
>>> @@ -562,7 +554,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
>>>case ELS_LOGO:
>>>if (ntoh24(fh->fh_s_id) == FC_FID_FLOGI) {
>>>/* drop non-FIP LOGO */
>>> -put_cpu();
>>>kfree_skb(skb);
>>>return;
>>>}
>>> @@ -572,22 +563,23 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
>>> 
>>>if (fh->fh_r_ctl == FC_RCTL_BA_ABTS) {
>>>/* Drop incoming ABTS */
>>> -put_cpu();
>>>kfree_skb(skb);
>>>return;
>>>}
>>> 
>>> +stats = per_cpu_ptr(lport->stats, smp_processor_id());
>>> +stats->RxFrames++;
>>> +stats->RxWords += fr_len / FCOE_WORD_TO_BYT

Re: [Open-FCoE] [PATCH] bnx2fc: Improve stats update mechanism

2014-05-30 Thread Neil Horman
On Fri, May 30, 2014 at 02:59:43PM -0700, Eddie Wai wrote:
> Thanks for fixing this.  The patch generally looks good, but I do have a
> few comments.
> 
> On Fri, 2014-05-30 at 11:01 -0400, Neil Horman wrote:
> > Recently had this warning reported:
> > 
> > [  290.489047] Call Trace:
> > [  290.489053]  [] dump_stack+0x19/0x1b
> > [  290.489055]  [] __might_sleep+0x179/0x230
> > [  290.489057]  [] mutex_lock_nested+0x55/0x520
> > [  290.489061]  [] ? bnx2fc_l2_rcv_thread+0xc5/0x4c0 
> > [bnx2fc]
> > [  290.489065]  [] fc_vport_id_lookup+0x3a/0xa0 [libfc]
> > [  290.489068]  [] bnx2fc_l2_rcv_thread+0x22c/0x4c0 
> > [bnx2fc]
> > [  290.489070]  [] ? bnx2fc_vport_destroy+0x110/0x110 
> > [bnx2fc]
> > [  290.489073]  [] kthread+0xed/0x100
> > [  290.489075]  [] ? insert_kthread_work+0x80/0x80
> > [  290.489077]  [] ret_from_fork+0x7c/0xb0
> > [  290.489078]  [] ? insert_kthread_work+0x80/0x80
> > 
> > Its due to the fact that we call a potentially sleeping function from the 
> > bnx2fc
> > rcv path with preemption disabled (via the get_cpu call embedded in the 
> > per-cpu
> > variable stats lookup in bnx2fc_l2_rcv_thread.
> > 
> > Easy enough fix, we can just move the stats collection later in the function
> > where we are sure we won't preempt or sleep.  This also allows us to not 
> > have to
> > enable pre-emption when doing a per-cpu lookup, since we're certain not to 
> > get
> You mean this allows us to not have to 'disable' pre-emption, right? 
> 
> Can you elaborate on how we can be sure that we won't get preempted
> immediately after retrieving the CPU variable?  I would think it'll be
> okay to call get_cpu at this stage as there won't be any sleepable mutex
> lock calls before the put_cpu.
We can't be sure, but I would assert it doesn't really matter at this point.
The area in which we update stats is so small that, even if we do hit the
unlikely chance that we get pre-empted, and then rescheduled on a different cpu,
it won't matter.  We could add the get_cpu/put_cpu back if you're really intent
on it, but I'm not sure its worthwhile given that this is a hot path.

Neil

> > rescheduled.
> > 
> > Signed-off-by: Neil Horman 
> > CC: linux-scsi@vger.kernel.org
> > CC: Robert Love 
> > CC: Vasu Dev 
> > ---
> >  drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 16 
> >  1 file changed, 4 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c 
> > b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
> > index 9b94850..475eee5 100644
> > --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
> > +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
> > @@ -516,23 +516,17 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
> > skb_pull(skb, sizeof(struct fcoe_hdr));
> > fr_len = skb->len - sizeof(struct fcoe_crc_eof);
> >  
> > -   stats = per_cpu_ptr(lport->stats, get_cpu());
> > -   stats->RxFrames++;
> > -   stats->RxWords += fr_len / FCOE_WORD_TO_BYTE;
> > -
> > fp = (struct fc_frame *)skb;
> > fc_frame_init(fp);
> > fr_dev(fp) = lport;
> > fr_sof(fp) = hp->fcoe_sof;
> > if (skb_copy_bits(skb, fr_len, &crc_eof, sizeof(crc_eof))) {
> > -   put_cpu();
> > kfree_skb(skb);
> > return;
> > }
> > fr_eof(fp) = crc_eof.fcoe_eof;
> > fr_crc(fp) = crc_eof.fcoe_crc32;
> > if (pskb_trim(skb, fr_len)) {
> > -   put_cpu();
> > kfree_skb(skb);
> > return;
> > }
> > @@ -544,7 +538,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
> > port = lport_priv(vn_port);
> > if (!ether_addr_equal(port->data_src_addr, dest_mac)) {
> > BNX2FC_HBA_DBG(lport, "fpma mismatch\n");
> > -   put_cpu();
> > kfree_skb(skb);
> > return;
> > }
> > @@ -552,7 +545,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
> > if (fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA &&
> > fh->fh_type == FC_TYPE_FCP) {
> > /* Drop FCP data. We dont this in L2 path */
> > -   put_cpu();
> > kfree_skb(skb);
> > return;
> > }
> > @@ -562,7 +554,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
> > case ELS_LOGO:
> > if (ntoh24(fh->fh_s_id) == FC_FID_FLOGI) {
> > /* drop non-FIP LOGO */
> > -   put_cpu();
> > kfree_skb(skb);
> > return;
> > }
> > @@ -572,22 +563,23 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
> >  
> > if (fh->fh_r_ctl == FC_RCTL_BA_ABTS) {
> > /* Drop incoming ABTS */
> > -   put_cpu();
> > kfree_skb(skb);
> > return;
> > }
> >  
> > +   stats = per_cpu_ptr(lport->stats, smp_processor_id());
> > +   stats->RxFrames++;
> > +   stats->RxWords += fr_len / FCOE_WORD_TO_BYTE;
> > +
> > if (le32_to_cpu(fr_crc(fp)) !=
> > ~crc32(~0, 

Re: [Open-FCoE] [PATCH] bnx2fc: Improve stats update mechanism

2014-05-30 Thread Eddie Wai
Thanks for fixing this.  The patch generally looks good, but I do have a
few comments.

On Fri, 2014-05-30 at 11:01 -0400, Neil Horman wrote:
> Recently had this warning reported:
> 
> [  290.489047] Call Trace:
> [  290.489053]  [] dump_stack+0x19/0x1b
> [  290.489055]  [] __might_sleep+0x179/0x230
> [  290.489057]  [] mutex_lock_nested+0x55/0x520
> [  290.489061]  [] ? bnx2fc_l2_rcv_thread+0xc5/0x4c0 
> [bnx2fc]
> [  290.489065]  [] fc_vport_id_lookup+0x3a/0xa0 [libfc]
> [  290.489068]  [] bnx2fc_l2_rcv_thread+0x22c/0x4c0 [bnx2fc]
> [  290.489070]  [] ? bnx2fc_vport_destroy+0x110/0x110 
> [bnx2fc]
> [  290.489073]  [] kthread+0xed/0x100
> [  290.489075]  [] ? insert_kthread_work+0x80/0x80
> [  290.489077]  [] ret_from_fork+0x7c/0xb0
> [  290.489078]  [] ? insert_kthread_work+0x80/0x80
> 
> Its due to the fact that we call a potentially sleeping function from the 
> bnx2fc
> rcv path with preemption disabled (via the get_cpu call embedded in the 
> per-cpu
> variable stats lookup in bnx2fc_l2_rcv_thread.
> 
> Easy enough fix, we can just move the stats collection later in the function
> where we are sure we won't preempt or sleep.  This also allows us to not have 
> to
> enable pre-emption when doing a per-cpu lookup, since we're certain not to get
You mean this allows us to not have to 'disable' pre-emption, right? 

Can you elaborate on how we can be sure that we won't get preempted
immediately after retrieving the CPU variable?  I would think it'll be
okay to call get_cpu at this stage as there won't be any sleepable mutex
lock calls before the put_cpu.
> rescheduled.
> 
> Signed-off-by: Neil Horman 
> CC: linux-scsi@vger.kernel.org
> CC: Robert Love 
> CC: Vasu Dev 
> ---
>  drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 16 
>  1 file changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c 
> b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
> index 9b94850..475eee5 100644
> --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
> +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
> @@ -516,23 +516,17 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
>   skb_pull(skb, sizeof(struct fcoe_hdr));
>   fr_len = skb->len - sizeof(struct fcoe_crc_eof);
>  
> - stats = per_cpu_ptr(lport->stats, get_cpu());
> - stats->RxFrames++;
> - stats->RxWords += fr_len / FCOE_WORD_TO_BYTE;
> -
>   fp = (struct fc_frame *)skb;
>   fc_frame_init(fp);
>   fr_dev(fp) = lport;
>   fr_sof(fp) = hp->fcoe_sof;
>   if (skb_copy_bits(skb, fr_len, &crc_eof, sizeof(crc_eof))) {
> - put_cpu();
>   kfree_skb(skb);
>   return;
>   }
>   fr_eof(fp) = crc_eof.fcoe_eof;
>   fr_crc(fp) = crc_eof.fcoe_crc32;
>   if (pskb_trim(skb, fr_len)) {
> - put_cpu();
>   kfree_skb(skb);
>   return;
>   }
> @@ -544,7 +538,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
>   port = lport_priv(vn_port);
>   if (!ether_addr_equal(port->data_src_addr, dest_mac)) {
>   BNX2FC_HBA_DBG(lport, "fpma mismatch\n");
> - put_cpu();
>   kfree_skb(skb);
>   return;
>   }
> @@ -552,7 +545,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
>   if (fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA &&
>   fh->fh_type == FC_TYPE_FCP) {
>   /* Drop FCP data. We dont this in L2 path */
> - put_cpu();
>   kfree_skb(skb);
>   return;
>   }
> @@ -562,7 +554,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
>   case ELS_LOGO:
>   if (ntoh24(fh->fh_s_id) == FC_FID_FLOGI) {
>   /* drop non-FIP LOGO */
> - put_cpu();
>   kfree_skb(skb);
>   return;
>   }
> @@ -572,22 +563,23 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
>  
>   if (fh->fh_r_ctl == FC_RCTL_BA_ABTS) {
>   /* Drop incoming ABTS */
> - put_cpu();
>   kfree_skb(skb);
>   return;
>   }
>  
> + stats = per_cpu_ptr(lport->stats, smp_processor_id());
> + stats->RxFrames++;
> + stats->RxWords += fr_len / FCOE_WORD_TO_BYTE;
> +
>   if (le32_to_cpu(fr_crc(fp)) !=
>   ~crc32(~0, skb->data, fr_len)) {
>   if (stats->InvalidCRCCount < 5)
>   printk(KERN_WARNING PFX "dropping frame with "
>  "CRC error\n");
>   stats->InvalidCRCCount++;
> - put_cpu();
>   kfree_skb(skb);
>   return;
>   }
> - put_cpu();
>   fc_exch_recv(lport, fp);
>  }
>  


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 31/32] scsi: fnic: use current_kernel_time() for timestamp

2014-05-30 Thread Arnd Bergmann
The fnic driver currently uses the CURRENT_TIME macro to
generate a timestamp. Since this is otherwise used only in
file system code and we want to change the type, it's
better for this driver to use the equivalent function that
continues to return a struct timespec.

Signed-off-by: Arnd Bergmann 
Cc: Hiral Patel 
Cc: Suma Ramars 
Cc: Brian Uchino 
Cc: linux-scsi@vger.kernel.org
---
 drivers/scsi/fnic/fnic_trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/fnic/fnic_trace.c b/drivers/scsi/fnic/fnic_trace.c
index c772859..2659538 100644
--- a/drivers/scsi/fnic/fnic_trace.c
+++ b/drivers/scsi/fnic/fnic_trace.c
@@ -612,7 +612,7 @@ int fnic_fc_trace_set_data(u32 host_no, u8 frame_type,
fc_trace_entries.rd_idx = 0;
}
 
-   fc_buf->time_stamp = CURRENT_TIME;
+   fc_buf->time_stamp = current_kernel_time();
fc_buf->host_no = host_no;
fc_buf->frame_type = frame_type;
 
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 00/32] making inode time stamps y2038 ready

2014-05-30 Thread Arnd Bergmann
Based on the recent discussion about 64-bit time_t for new
architectures, and for solving the year 2038 problem in general,
I decided to try out what it would take to solve part of the
kernel side of things.

This is a proof-of-concept work to get us to the point where
two system calls (utimes and stat) provide a working interface
to user space to pass 64-bit inode time stamps in and out of
the kernel all the way to the file systems.

I picked this because it is a fairly isolated problem, as the
inode time stamps are rarely assigned to any other time values.
As a byproduct of this work, I documented for each of the file
systems we support how long the on-disk format can work[1].

Obviously we also need to convert all the other syscalls and
have a proper libc implementation using those for this to
be really useful, but it's a start and it can be tested
independently (I didn't so far, want to wait for initial
feedback).

All the interesting stuff is in the first five patches here,
the rest is the straightforward conversion of all file systems
that use 'timespec' values internally.

There are of course a number of open questions:

a) is this the right approach in general? The previous discussion
   pointed this way, but there may be other opinions.
b) what type should we use internally to represent inode time
   stamps? The code contains three different versions that would
   all work, we just have to pick a good tradeoff between
   efficiency and the range of times we want to cover.
c) Should we continue this way for all 32-bit platforms for
   consistency, including future ones, or should we go to
   different 64-bit types right away? My feeling is that the
   second approach would complicate this work.

Arnd

[1] http://kernelnewbies.org/y2038

Arnd Bergmann (32):
  fs: introduce new 'struct inode_time'
  uapi: add struct __kernel_timespec{32,64}
  fs: introduce sys_utimens64at
  fs: introduce sys_newfstat64/sys_newfstatat64
  arch: hook up new stat and utimes syscalls
  isofs: fix timestamps beyond 2027
  fs/nfs: convert to struct inode_time
  fs/ceph: convert to 'struct inode_time'
  fs/pstore: convert to struct inode_time
  fs/coda: convert to struct inode_time
  xfs: convert to struct inode_time
  btrfs: convert to struct inode_time
  ext3: convert to struct inode_time
  ext4: convert to struct inode_time
  cifs: convert to struct inode_time
  ntfs: convert to struct inode_time
  ubifs: convert to struct inode_time
  ocfs2: convert to struct inode_time
  fs/fat: convert to struct inode_time
  afs: convert to struct inode_time
  udf: convert to struct inode_time
  fs: convert simple fs to inode_time
  logfs: convert to struct inode_time
  hfs, hfsplus: convert to struct inode_time
  gfs2: convert to struct inode_time
  reiserfs: convert to struct inode_time
  jffs2: convert to struct inode_time
  adfs: convert to struct inode_time
  f2fs: convert to struct inode_time
  fuse: convert to struct inode_time
  scsi: fnic: use current_kernel_time() for timestamp
  fs: use new inode_time definition unconditionally

 arch/alpha/kernel/osf_sys.c|  2 +-
 arch/arm/include/asm/unistd.h  |  2 +-
 arch/arm/include/uapi/asm/stat.h   | 25 +
 arch/arm/include/uapi/asm/unistd.h |  3 +++
 arch/arm/kernel/calls.S|  3 +++
 arch/arm64/include/asm/unistd32.h  |  5 +++-
 arch/x86/include/uapi/asm/stat.h   | 28 +++
 arch/x86/syscalls/syscall_32.tbl   |  3 +++
 drivers/block/rbd.c|  2 +-
 drivers/firmware/efi/efi-pstore.c  | 28 +--
 drivers/scsi/fnic/fnic_trace.c |  2 +-
 drivers/tty/tty_io.c   |  2 +-
 drivers/usb/gadget/f_fs.c  |  2 +-
 fs/adfs/inode.c|  4 +--
 fs/afs/afs.h   |  6 ++---
 fs/afs/fsclient.c  |  2 +-
 fs/attr.c  |  8 +++---
 fs/btrfs/file.c|  6 ++---
 fs/btrfs/inode.c   |  4 +--
 fs/btrfs/ioctl.c   |  4 +--
 fs/btrfs/root-tree.c   |  2 +-
 fs/btrfs/transaction.c |  2 +-
 fs/ceph/cache.c|  2 +-
 fs/ceph/caps.c |  6 ++---
 fs/ceph/file.c |  4 +--
 fs/ceph/inode.c| 20 +++---
 fs/ceph/super.h|  8 +++---
 fs/cifs/cache.c|  6 ++---
 fs/cifs/cifsglob.h |  6 ++---
 fs/cifs/cifsproto.h|  6 ++---
 fs/cifs/cifssmb.c  |  5 ++--
 fs/cifs/inode.c|  2 +-
 fs/cifs/netmisc.c  | 15 ++-
 fs/coda/coda_linux.c   | 18 -
 fs/compat.c| 19 ++---
 fs/configfs/inode.c|  6 ++---
 fs/cramfs/inode.c  |  2 +-
 fs/ext3/inode.c|  4 +--
 fs/ext4/ext4.h | 10 +++
 fs/ext4/extents.c  |  2 +-
 fs/f2fs/file.c   

[RFC 1/1] drivers/scsi/bfa/bfad_debugfs.c: replace 2 kzalloc/copy_from_user to memdup_user

2014-05-30 Thread Fabian Frederick
(memdup_user can be used to replace kmalloc/copy_from_user. Not sure if it's ok 
with kzalloc ...)

Cc: linux-scsi@vger.kernel.org
Cc: Anil Gurumurthy 
Cc: "James E.J. Bottomley" 
Signed-off-by: Fabian Frederick 
---
 drivers/scsi/bfa/bfad_debugfs.c | 30 ++
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/drivers/scsi/bfa/bfad_debugfs.c b/drivers/scsi/bfa/bfad_debugfs.c
index 8e83d04..07b9e36 100644
--- a/drivers/scsi/bfa/bfad_debugfs.c
+++ b/drivers/scsi/bfa/bfad_debugfs.c
@@ -260,17 +260,12 @@ bfad_debugfs_write_regrd(struct file *file, const char 
__user *buf,
unsigned long flags;
void *kern_buf;
 
-   kern_buf = kzalloc(nbytes, GFP_KERNEL);
+   kern_buf = memdup_user((void __user *)buf, nbytes);
 
-   if (!kern_buf) {
-   printk(KERN_INFO "bfad[%d]: Failed to allocate buffer\n",
-   bfad->inst_no);
-   return -ENOMEM;
-   }
-
-   if (copy_from_user(kern_buf, (void  __user *)buf, nbytes)) {
-   kfree(kern_buf);
-   return -ENOMEM;
+   if (IS_ERR(kern_buf)) {
+   printk(KERN_INFO "bfad[%d]: Failed to copy buffer\n",
+  bfad->inst_no);
+   return PTR_ERR(kern_buf);
}
 
rc = sscanf(kern_buf, "%x:%x", &addr, &len);
@@ -336,17 +331,12 @@ bfad_debugfs_write_regwr(struct file *file, const char 
__user *buf,
unsigned long flags;
void *kern_buf;
 
-   kern_buf = kzalloc(nbytes, GFP_KERNEL);
+   kern_buf = memdup_user((void __user *)buf, nbytes);
 
-   if (!kern_buf) {
-   printk(KERN_INFO "bfad[%d]: Failed to allocate buffer\n",
-   bfad->inst_no);
-   return -ENOMEM;
-   }
-
-   if (copy_from_user(kern_buf, (void  __user *)buf, nbytes)) {
-   kfree(kern_buf);
-   return -ENOMEM;
+   if (IS_ERR(kern_buf)) {
+   printk(KERN_INFO "bfad[%d]: Failed to copy buffer\n",
+  bfad->inst_no);
+   return PTR_ERR(kern_buf);
}
 
rc = sscanf(kern_buf, "%x:%x", &addr, &val);
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] drivers/scsi/megaraid/megaraid_sas_base.c: replace kmalloc/copy_from_user by memdup_user

2014-05-30 Thread Fabian Frederick
Cc: Neela Syam Kolli 
Cc: "James E.J. Bottomley" 
Signed-off-by: Fabian Frederick 
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index d84d02c..e0330ca 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -5639,14 +5639,9 @@ static int megasas_mgmt_ioctl_fw(struct file *file, 
unsigned long arg)
unsigned long flags;
u32 wait_time = MEGASAS_RESET_WAIT_TIME;
 
-   ioc = kmalloc(sizeof(*ioc), GFP_KERNEL);
-   if (!ioc)
-   return -ENOMEM;
-
-   if (copy_from_user(ioc, user_ioc, sizeof(*ioc))) {
-   error = -EFAULT;
-   goto out_kfree_ioc;
-   }
+   ioc = memdup_user(user_ioc, sizeof(*ioc));
+   if (IS_ERR(ioc))
+   return PTR_ERR(ioc);
 
instance = megasas_lookup_instance(ioc->host_no);
if (!instance) {
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] drivers/scsi/libsas/sas_scsi_host.c: use PTR_ERR_OR_ZERO

2014-05-30 Thread Fabian Frederick
replace IS_ERR/PTR_ERR

Cc: Lukasz Dorau 
Cc: "James E.J. Bottomley" 
Signed-off-by: Fabian Frederick 
---
 drivers/scsi/libsas/sas_scsi_host.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/scsi/libsas/sas_scsi_host.c 
b/drivers/scsi/libsas/sas_scsi_host.c
index 25d0f12..400a2aa 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -1093,9 +1093,7 @@ int sas_init_queue(struct sas_ha_struct *sas_ha)
 
core->queue_thread = kthread_run(sas_queue_thread, sas_ha,
 "sas_queue_%d", core->shost->host_no);
-   if (IS_ERR(core->queue_thread))
-   return PTR_ERR(core->queue_thread);
-   return 0;
+   return PTR_ERR_OR_ZERO(core->queue_thread);
 }
 
 void sas_shutdown_queue(struct sas_ha_struct *sas_ha)
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] drivers/scsi/aacraid/commctrl.c: replace kmalloc/copy_from_user by memdup_user

2014-05-30 Thread Fabian Frederick
Cc: "James E.J. Bottomley" 
Signed-off-by: Fabian Frederick 
---
 drivers/scsi/aacraid/commctrl.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index fbcd48d..3d5d6a6 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -517,16 +517,10 @@ static int aac_send_raw_srb(struct aac_dev* dev, void 
__user * arg)
goto cleanup;
}
 
-   user_srbcmd = kmalloc(fibsize, GFP_KERNEL);
-   if (!user_srbcmd) {
-   dprintk((KERN_DEBUG"aacraid: Could not make a copy of the 
srb\n"));
-   rcode = -ENOMEM;
-   goto cleanup;
-   }
-   if(copy_from_user(user_srbcmd, user_srb,fibsize)){
+   user_srbcmd = memdup_user(user_srb, fibsize);
+   if (IS_ERR(user_srbcmd)) {
dprintk((KERN_DEBUG"aacraid: Could not copy srb from user\n"));
-   rcode = -EFAULT;
-   goto cleanup;
+   return PTR_ERR(user_srbcmd);
}
 
user_reply = arg+fibsize;
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] bnx2fc: Improve stats update mechanism

2014-05-30 Thread Neil Horman
Recently had this warning reported:

[  290.489047] Call Trace:
[  290.489053]  [] dump_stack+0x19/0x1b
[  290.489055]  [] __might_sleep+0x179/0x230
[  290.489057]  [] mutex_lock_nested+0x55/0x520
[  290.489061]  [] ? bnx2fc_l2_rcv_thread+0xc5/0x4c0 [bnx2fc]
[  290.489065]  [] fc_vport_id_lookup+0x3a/0xa0 [libfc]
[  290.489068]  [] bnx2fc_l2_rcv_thread+0x22c/0x4c0 [bnx2fc]
[  290.489070]  [] ? bnx2fc_vport_destroy+0x110/0x110 [bnx2fc]
[  290.489073]  [] kthread+0xed/0x100
[  290.489075]  [] ? insert_kthread_work+0x80/0x80
[  290.489077]  [] ret_from_fork+0x7c/0xb0
[  290.489078]  [] ? insert_kthread_work+0x80/0x80

Its due to the fact that we call a potentially sleeping function from the bnx2fc
rcv path with preemption disabled (via the get_cpu call embedded in the per-cpu
variable stats lookup in bnx2fc_l2_rcv_thread.

Easy enough fix, we can just move the stats collection later in the function
where we are sure we won't preempt or sleep.  This also allows us to not have to
enable pre-emption when doing a per-cpu lookup, since we're certain not to get
rescheduled.

Signed-off-by: Neil Horman 
CC: linux-scsi@vger.kernel.org
CC: Robert Love 
CC: Vasu Dev 
---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 16 
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c 
b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 9b94850..475eee5 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -516,23 +516,17 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
skb_pull(skb, sizeof(struct fcoe_hdr));
fr_len = skb->len - sizeof(struct fcoe_crc_eof);
 
-   stats = per_cpu_ptr(lport->stats, get_cpu());
-   stats->RxFrames++;
-   stats->RxWords += fr_len / FCOE_WORD_TO_BYTE;
-
fp = (struct fc_frame *)skb;
fc_frame_init(fp);
fr_dev(fp) = lport;
fr_sof(fp) = hp->fcoe_sof;
if (skb_copy_bits(skb, fr_len, &crc_eof, sizeof(crc_eof))) {
-   put_cpu();
kfree_skb(skb);
return;
}
fr_eof(fp) = crc_eof.fcoe_eof;
fr_crc(fp) = crc_eof.fcoe_crc32;
if (pskb_trim(skb, fr_len)) {
-   put_cpu();
kfree_skb(skb);
return;
}
@@ -544,7 +538,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
port = lport_priv(vn_port);
if (!ether_addr_equal(port->data_src_addr, dest_mac)) {
BNX2FC_HBA_DBG(lport, "fpma mismatch\n");
-   put_cpu();
kfree_skb(skb);
return;
}
@@ -552,7 +545,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
if (fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA &&
fh->fh_type == FC_TYPE_FCP) {
/* Drop FCP data. We dont this in L2 path */
-   put_cpu();
kfree_skb(skb);
return;
}
@@ -562,7 +554,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
case ELS_LOGO:
if (ntoh24(fh->fh_s_id) == FC_FID_FLOGI) {
/* drop non-FIP LOGO */
-   put_cpu();
kfree_skb(skb);
return;
}
@@ -572,22 +563,23 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
 
if (fh->fh_r_ctl == FC_RCTL_BA_ABTS) {
/* Drop incoming ABTS */
-   put_cpu();
kfree_skb(skb);
return;
}
 
+   stats = per_cpu_ptr(lport->stats, smp_processor_id());
+   stats->RxFrames++;
+   stats->RxWords += fr_len / FCOE_WORD_TO_BYTE;
+
if (le32_to_cpu(fr_crc(fp)) !=
~crc32(~0, skb->data, fr_len)) {
if (stats->InvalidCRCCount < 5)
printk(KERN_WARNING PFX "dropping frame with "
   "CRC error\n");
stats->InvalidCRCCount++;
-   put_cpu();
kfree_skb(skb);
return;
}
-   put_cpu();
fc_exch_recv(lport, fp);
 }
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] fc: ensure scan_work isn't active when freeing fc_rport

2014-05-30 Thread Neil Horman
debugfs caught this:
WARNING: at lib/debugobjects.c:260 debug_print_object+0x83/0xa0()
ODEBUG: free active (active state 0) object type: work_struct
hint: fc_scsi_scan_rport+0x0/0xd0 [scsi_transport_fc]
 CPU: 1 PID: 184 Comm: kworker/1:1 Tainted: GW
--   3.10.0-123.el7.x86_64.debug #1
Hardware name: HP ProLiant DL120 G7, BIOS J01 07/01/2013
Workqueue: fc_wq_5 fc_rport_final_delete [scsi_transport_fc]
Call Trace:
[] dump_stack+0x19/0x1b
[] warn_slowpath_common+0x61/0x80
[] warn_slowpath_fmt+0x5c/0x80
[] debug_print_object+0x83/0xa0
[] ? fc_parse_wwn+0x100/0x100

[] debug_check_no_obj_freed+0x22b/0x270
[] ? fc_rport_dev_release+0x1e/0x30
[] kfree+0xd9/0x2d0
[] fc_rport_dev_release+0x1e/0x30
[] device_release+0x32/0xa0
[] kobject_release+0x7e/0x1b0
[] kobject_put+0x28/0x60
[] put_device+0x17/0x20
[] fc_rport_final_delete+0x165/0x210
[] process_one_work+0x220/0x710
[] ? process_one_work+0x1b4/0x710
[] worker_thread+0x11b/0x3a0
[] ? process_one_work+0x710/0x710
[] kthread+0xed/0x100
[] ? insert_kthread_work+0x80/0x80
[] ret_from_fork+0x7c/0xb0
[] ? insert_kthread_work+0x80/0x80

Seems to be because the scan_work work_struct might be active when the housing
fc_rport struct gets freed.  Ensure that we cancel it prior to freeing the rport

Signed-off-by: Neil Horman 
CC: linux-scsi@vger.kernel.org
CC: Robert Love 
CC: Vasu Dev 
---
 drivers/scsi/scsi_transport_fc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 4628fd5..5bd552c 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -2548,6 +2548,7 @@ fc_rport_final_delete(struct work_struct *work)
fc_flush_devloss(shost);
if (!cancel_delayed_work(&rport->dev_loss_work))
fc_flush_devloss(shost);
+   cancel_work_sync(&rport->scan_work);
spin_lock_irqsave(shost->host_lock, flags);
rport->flags &= ~FC_RPORT_DEVLOSS_PENDING;
}
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: PATCH: mvsas: add support for Supermicro AOC-SAS2LP-MV8

2014-05-30 Thread Jan Kasprzak
Christoph Hellwig wrote:
: On Fri, May 16, 2014 at 02:06:42PM +0200, Jan Kasprzak wrote:
: > any news with this patch? Will it be acked by you and submitted upstream?
: > Thanks!
: 
: Give me an Acked-by and I'll pull it in.

Acked-By: Jan "Yenya" Kasprzak 

Not sure whether I should ack my own patch, though. But you may apply
it to the original one, which is identical to what I did.
http://marc.info/?l=linux-scsi&m=139277202005675&w=2

Thanks!

-Y.

-- 
| Jan "Yenya" Kasprzak   |
| New GPG 4096R/A45477D5 - see http://www.fi.muni.cz/~kas/pgp-rollover.txt |
| http://www.fi.muni.cz/~kas/Journal: http://www.fi.muni.cz/~kas/blog/ |
  There's clearly a balance between "octopus merges are fine" and "Christ,
  that's not an octopus, that's a Cthulhu merge". --Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC 0/9] fix for the race issue between scsi timer and in-flight scmd

2014-05-30 Thread liu ping fan
On Fri, May 30, 2014 at 4:26 PM, Paolo Bonzini  wrote:
> Il 30/05/2014 10:15, Liu Ping Fan ha scritto:
>
>> When running io stress test on large latency scsi-disk, e.g guest with
>> virtscsi
>> on a nfs image. It can trigger the BUG_ON(test_bit(REQ_ATOM_COMPLETE,
>> &req->atomic_flags));
>> in blk_start_request().
>> Since there is a race between latency "finishing" scmd and the
>> re-allocated scmd.
>> I.e a request is still referred by a scmd, but we had turn it back to
>> slab.
>>
>> This series introduces the ref on scmd to exclude this issue, and the
>> following is ref rules.
>>
>>   inc ref rules is like the following:
>> When setup a scmd, inited as 1. When add a timer inc 1.
>>
>>   dec ref rules is like the following:
>> -for the normal ref
>>scsi_done() will drop the ref when fail to acquire
>> REQ_ATOM_COMPLETE immediately
>>or drop the ref by scsi_end_request()
>>or drop by return SUCCESS_REMOVE
>> -for a timer ref
>>when deleting timer, if !list_empty(timeout_list), then there is a
>> timer ref, and
>>drop it.
>>
>>
>> patch1-2: fix the current potential bug
>> patch3~6: prepare for the mechanism for the ref
>> patch7:   the ref rules core
>> patch8-9:  e.g and test-issue for the new mechanism. Since lack of many
>> virtscsi background,
>>patch8 may be poor and need to be improved :)
>>
>>
>> Note: all the patches are based on rhel7, whose kernel version is
>> linux-3.10.
>>   I will rebase them onto the latest commit if my method is practical.
>
>
> This series is not necessary, this is a bug in the virtscsi driver.  I have
> a ten line patch to fix it, but I haven't yet tested it properly.
>
Could I pick up your patch, and test it?

Thx,
Fan

> Paolo
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC 0/9] fix for the race issue between scsi timer and in-flight scmd

2014-05-30 Thread Paolo Bonzini

Il 30/05/2014 10:15, Liu Ping Fan ha scritto:

When running io stress test on large latency scsi-disk, e.g guest with virtscsi
on a nfs image. It can trigger the BUG_ON(test_bit(REQ_ATOM_COMPLETE, 
&req->atomic_flags));
in blk_start_request().
Since there is a race between latency "finishing" scmd and the re-allocated 
scmd.
I.e a request is still referred by a scmd, but we had turn it back to
slab.

This series introduces the ref on scmd to exclude this issue, and the following 
is ref rules.

  inc ref rules is like the following:
When setup a scmd, inited as 1. When add a timer inc 1.

  dec ref rules is like the following:
-for the normal ref
   scsi_done() will drop the ref when fail to acquire REQ_ATOM_COMPLETE 
immediately
   or drop the ref by scsi_end_request()
   or drop by return SUCCESS_REMOVE
-for a timer ref
   when deleting timer, if !list_empty(timeout_list), then there is a timer 
ref, and
   drop it.


patch1-2: fix the current potential bug
patch3~6: prepare for the mechanism for the ref
patch7:   the ref rules core
patch8-9:  e.g and test-issue for the new mechanism. Since lack of many 
virtscsi background,
   patch8 may be poor and need to be improved :)


Note: all the patches are based on rhel7, whose kernel version is linux-3.10.
  I will rebase them onto the latest commit if my method is practical.


This series is not necessary, this is a bug in the virtscsi driver.  I 
have a ten line patch to fix it, but I haven't yet tested it properly.


Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 5/9] blk: change funcs' prototype to expose the ref of timer

2014-05-30 Thread Liu Ping Fan
req->special is normally referred by both a timer and request_queue.
This patch focus on the timer's ref. It changes a group of func's
prototype, so the caller can inc/dec ref, in according to add/del a
timer.

Signed-off-by: Liu Ping Fan 
---
 block/blk-core.c   | 49 -
 block/blk-timeout.c| 10 --
 block/blk.h|  2 +-
 include/linux/blkdev.h |  4 +++-
 4 files changed, 52 insertions(+), 13 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index b0261be..beaca2e 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1205,9 +1205,11 @@ EXPORT_SYMBOL(blk_make_request);
  *more, when that condition happens we need to put the request back
  *on the queue. Must be called with queue lock held.
  */
-void blk_requeue_request(struct request_queue *q, struct request *rq)
+bool blk_requeue_request(struct request_queue *q, struct request *rq)
 {
-   blk_delete_timer(rq);
+   bool ref;
+
+   ref = blk_delete_timer(rq);
blk_clear_rq_complete(rq);
trace_block_rq_requeue(q, rq);
 
@@ -1217,6 +1219,7 @@ void blk_requeue_request(struct request_queue *q, struct 
request *rq)
BUG_ON(blk_queued_rq(rq));
 
elv_requeue_request(q, rq);
+   return ref;
 }
 EXPORT_SYMBOL(blk_requeue_request);
 
@@ -2492,8 +2495,10 @@ EXPORT_SYMBOL_GPL(blk_unprep_request);
 /*
  * queue lock must be held
  */
-static void blk_finish_request(struct request *req, int error)
+static void blk_finish_request(struct request *req, int error, int *drop_ref)
 {
+   bool ref;
+
if (blk_rq_tagged(req))
blk_queue_end_tag(req->q, req);
 
@@ -2502,7 +2507,11 @@ static void blk_finish_request(struct request *req, int 
error)
if (unlikely(laptop_mode) && req->cmd_type == REQ_TYPE_FS)
laptop_io_completion(&req->q->backing_dev_info);
 
-   blk_delete_timer(req);
+   ref = blk_delete_timer(req);
+   if (likely(ref && drop_ref))
+   *drop_ref = 1;
+   else if (drop_ref)
+   *drop_ref = 0;
 
if (req->cmd_flags & REQ_DONTPREP)
blk_unprep_request(req);
@@ -2537,7 +2546,7 @@ static void blk_finish_request(struct request *req, int 
error)
  * %true  - still buffers pending for this request
  **/
 static bool blk_end_bidi_request(struct request *rq, int error,
-unsigned int nr_bytes, unsigned int bidi_bytes)
+   unsigned int nr_bytes, unsigned int bidi_bytes, int *drop_ref)
 {
struct request_queue *q = rq->q;
unsigned long flags;
@@ -2546,7 +2555,7 @@ static bool blk_end_bidi_request(struct request *rq, int 
error,
return true;
 
spin_lock_irqsave(q->queue_lock, flags);
-   blk_finish_request(rq, error);
+   blk_finish_request(rq, error, drop_ref);
spin_unlock_irqrestore(q->queue_lock, flags);
 
return false;
@@ -2573,7 +2582,7 @@ bool __blk_end_bidi_request(struct request *rq, int error,
if (blk_update_bidi_request(rq, error, nr_bytes, bidi_bytes))
return true;
 
-   blk_finish_request(rq, error);
+   blk_finish_request(rq, error, NULL);
 
return false;
 }
@@ -2594,11 +2603,32 @@ bool __blk_end_bidi_request(struct request *rq, int 
error,
  **/
 bool blk_end_request(struct request *rq, int error, unsigned int nr_bytes)
 {
-   return blk_end_bidi_request(rq, error, nr_bytes, 0);
+   return blk_end_bidi_request(rq, error, nr_bytes, 0, NULL);
 }
 EXPORT_SYMBOL(blk_end_request);
 
 /**
+ * blk_end_request_ref - Helper function for drivers to complete the request.
+ * @rq:   the request being processed
+ * @error:%0 for success, < %0 for error
+ * @nr_bytes: number of bytes to complete
+ *
+ * Description:
+ * Ends I/O on a number of bytes attached to @rq.
+ * If @rq has leftover, sets it up for the next range of segments.
+ *
+ * Return:
+ * %false - we are done with this request
+ * %true  - still buffers pending for this request
+ **/
+bool blk_end_request_ref(struct request *rq, int error, unsigned int nr_bytes,
+   int *drop_ref)
+{
+   return blk_end_bidi_request(rq, error, nr_bytes, 0, drop_ref);
+}
+EXPORT_SYMBOL(blk_end_request_ref);
+
+/**
  * blk_end_request_all - Helper function for drives to finish the request.
  * @rq: the request to finish
  * @error: %0 for success, < %0 for error
@@ -2614,7 +2644,8 @@ void blk_end_request_all(struct request *rq, int error)
if (unlikely(blk_bidi_rq(rq)))
bidi_bytes = blk_rq_bytes(rq->next_rq);
 
-   pending = blk_end_bidi_request(rq, error, blk_rq_bytes(rq), bidi_bytes);
+   pending = blk_end_bidi_request(rq, error, blk_rq_bytes(rq), bidi_bytes,
+   NULL);
BUG_ON(pending);
 }
 EXPORT_SYMBOL(blk_end_request_all);
diff --git a/block/blk-timeout.c b/block/blk-timeout.c
index d3067f0..839962b 100644
--- a/block/blk-timeout.c
+++ b/block/

[RFC 9/9] scsi: ibmvscsi: return SUCCESS_REMOVE when finding a abort cmd

2014-05-30 Thread Liu Ping Fan
When return SUCCESS_REMOVE, it can benifit the ref on scsi_cmnd

Signed-off-by: Liu Ping Fan 
---
 drivers/scsi/ibmvscsi/ibmvscsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index d0fa4b6..cf78be5 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -1583,7 +1583,7 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd 
*cmd)
free_event_struct(&found_evt->hostdata->pool, found_evt);
spin_unlock_irqrestore(hostdata->host->host_lock, flags);
atomic_inc(&hostdata->request_limit);
-   return SUCCESS;
+   return SUCCESS_REMOVE;
 }
 
 /**
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 3/9] scsi: introduce new internal flag SUCCESS_REMOVE

2014-05-30 Thread Liu Ping Fan
Currently when aborting a scsi_cmnd, we can not tell whether this cmd is
canceled or has not been found by scsi_try_to_abort_cmd(). So introducing
this new flag. (In the succeeding patch, if caller success to cancel
the scmd, then it should drop the ref on scmd, otherwise no ops)

Signed-off-by: Liu Ping Fan 
---
 drivers/scsi/scsi_error.c | 8 +++-
 include/scsi/scsi.h   | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 3b8b95b..8ddd8f5 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -869,10 +869,16 @@ static int scsi_try_bus_device_reset(struct scsi_cmnd 
*scmd)
 
 static int scsi_try_to_abort_cmd(struct scsi_host_template *hostt, struct 
scsi_cmnd *scmd)
 {
+   int ret;
+
if (!hostt->eh_abort_handler)
return FAILED;
 
-   return hostt->eh_abort_handler(scmd);
+   ret = hostt->eh_abort_handler(scmd);
+   /* After introducing ref on scsi_cmnd, here will handle the ref */
+   if (ret == SUCCESS_REMOVE)
+   ret = SUCCESS;
+   return ret;
 }
 
 static void scsi_abort_eh_cmnd(struct scsi_cmnd *scmd)
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index d477bfb..4183b01 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -488,6 +488,7 @@ static inline int scsi_is_wlun(unsigned int lun)
 #define TIMEOUT_ERROR   0x2007
 #define SCSI_RETURN_NOT_HANDLED   0x2008
 #define FAST_IO_FAIL   0x2009
+#define SUCCESS_REMOVE 0x200a
 
 /*
  * Midlevel queue return values.
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 7/9] scsi: adopt ref on scsi_cmnd to avoid a race on request

2014-05-30 Thread Liu Ping Fan
When running io stress test on large latency disk, e.g guest with a image on 
nfs.
It can trigger the BUG_ON(test_bit(REQ_ATOM_COMPLETE, &req->atomic_flags));
Since there is a race between latency "finishing" scmd and the re-allocated 
scmd.
I.e a request is still referred by a scmd, but we had turn it back to
slab. This patch introduces the ref on scmd to exclude this issue.

inc ref rules is like the following:
  When setup a scmd, inited as 1. When add a timer inc 1.

dec ref rules is like the following:
  -for the normal ref
 scsi_done() will drop the ref when fail to acquire REQ_ATOM_COMPLETE 
immediately
 or drop the ref by scsi_end_request()
 or drop by return SUCCESS_REMOVE
  -for a timer ref
 when deleting timer, if !list_empty(timeout_list), then there is a timer 
ref, and
 drop it.

Oops call trace:

[ 3379.866773] [ cut here ]
[ 3379.866997] kernel BUG at block/blk-core.c:2295!
[ 3379.867238] Oops: Exception in kernel mode, sig: 5 [#1]
[ 3379.867400] SMP NR_CPUS=2048 NUMA pSeries
[ 3379.867574] Modules linked in: nfsv3 sg rpcsec_gss_krb5 arc4 md4 nfsv4 
nls_utf8
[ 3379.879310] CPU: 4 PID: 0 Comm: swapper/4 Not tainted 3.10.0-105.el7.ppc64 #1
[ 3379.879586] task: c003f8bf6900 ti: c003fffd4000 task.ti: 
c003f8cb4000
[ 3379.879858] NIP: c0413324 LR: c0413380 CTR: c05b2cf0
[ 3379.881647] REGS: c003fffd76b0 TRAP: 0700   Not tainted  
(3.10.0-105.el7.ppc64)
[ 3379.881932] MSR: 80029032   CR: 42022042  XER: 

[ 3379.882533] SOFTE: 0
[ 3379.882626] CFAR: c0413388
[ 3379.882765]
GPR00: c04132e4 c003fffd7930 c12543b8 0312efc08912
GPR04: c003f650f000 c003f650f000 c0c55e48 0009f49d
GPR08: c12e43b8 0001 0008 2f7c7611
GPR12: 22022044 cfe01000 c0b270e8 0001
GPR16: c0b27128 c0b27110 c0b271c8 c0c54480
GPR20: c0ac9e00  c0ac9c58 c0b271f0
GPR24: c3a81948 c3a81848  
GPR28: c003f650f000 c003efab c003efab0004 c003f650f000
[ 3379.886311] NIP [c0413324] .blk_start_request+0x84/0x100
[ 3379.886539] LR [c0413380] .blk_start_request+0xe0/0x100
[ 3379.886760] PACATMSCRATCH [80009032]
[ 3379.886951] Call Trace:
[ 3379.887037] [c003fffd7930] [c04132e4] 
.blk_start_request+0x44/0x100 (unreliable)
[ 3379.887381] [c003fffd79b0] [c05b2ef8] 
.scsi_request_fn+0x208/0x7e0
[ 3379.887756] [c003fffd7ad0] [c04141c8] .blk_run_queue+0x68/0xa0
[ 3379.889260] [c003fffd7b50] [c05b2098] .scsi_run_queue+0x158/0x300
[ 3379.889645] [c003fffd7c10] [c05b5bec] 
.scsi_io_completion+0x22c/0xe80
[ 3379.890083] [c003fffd7ce0] [c05a58a8] 
.scsi_finish_command+0x108/0x1a0
[ 3379.890483] [c003fffd7d70] [c05b5858] 
.scsi_softirq_done+0x1c8/0x240
[ 3379.890956] [c003fffd7e00] [c0422b24] .blk_done_softirq+0xa4/0xd0
[ 3379.891364] [c003fffd7e90] [c00bb8a8] .__do_softirq+0x148/0x380
[ 3379.891632] [c003fffd7f90] [c002462c] .call_do_softirq+0x14/0x24
[ 3379.892008] [c003fffd3df0] [c0010f70] .do_softirq+0x120/0x170
[ 3379.892429] [c003fffd3e80] [c00bbe34] .irq_exit+0x1e4/0x1f0
[ 3379.893180] [c003fffd3f10] [c0010b60] .__do_irq+0xc0/0x1d0
[ 3379.893578] [c003fffd3f90] [c0024650] .call_do_irq+0x14/0x24
[ 3379.894018] [c003f8cb7830] [c0010cfc] .do_IRQ+0x8c/0x100
[ 3379.894539] [c003f8cb78d0] [c0002494] 
hardware_interrupt_common+0x114/0x180
[ 3379.895278] --- Exception: 501 at .plpar_hcall_norets+0x84/0xd4
[ 3379.895278] LR = .shared_cede_loop+0x40/0x90
[ 3379.895730] [c003f8cb7bc0] []   (null) 
(unreliable)
[ 3379.896356] [c003f8cb7c40] [c06c5054] 
.cpuidle_idle_call+0x114/0x3c0
[ 3379.897882] [c003f8cb7d10] [c007d6f0] 
.pseries_lpar_idle+0x10/0x50
[ 3379.898200] [c003f8cb7d80] [c00186a4] .arch_cpu_idle+0x64/0x150
[ 3379.898475] [c003f8cb7e00] [c0135b84] 
.cpu_startup_entry+0x1a4/0x2e0
[ 3379.898860] [c003f8cb7ed0] [c08b9a4c] 
.start_secondary+0x3a8/0x3b0
[ 3379.899173] [c003f8cb7f90] [c000976c] 
.start_secondary_prolog+0x10/0x14
[ 3379.899496] Instruction dump:
[ 3379.899631] 792a77e3 41820010 815f0050 2f8a0001 419e004c e93f0178 815f0064 
2fa9
[ 3379.900085] 915f013c 40de0074 e93f0058 792907e0 <0b09> 7fe3fb78 48010495 
6000
[ 3379.900546] ---[ end trace d57cacc25e1c8c73 ]---
[ 3379.905937]
[ 3379.906041] Sending IPI to other CPUs
[ 3389.939144] ERROR: 1 cpu(s) not responding

Signed-off-by: Liu Ping Fan 
---
 drivers/scsi/scsi.c   | 33 +---
 drivers/scsi/scsi_error.c |  5 +++--
 drivers/scsi/scsi_lib.c   | 56 +--

[RFC 6/9] blk: split the reclaim of req from blk_finish_request()

2014-05-30 Thread Liu Ping Fan
Later, the low layer (scsi) can decide when to turn back the mem of
req by blk_reclaim_request()

Signed-off-by: Liu Ping Fan 
---
 block/blk-core.c   | 52 +-
 include/linux/blkdev.h |  6 --
 2 files changed, 39 insertions(+), 19 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index beaca2e..7e8a8ae 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2495,7 +2495,7 @@ EXPORT_SYMBOL_GPL(blk_unprep_request);
 /*
  * queue lock must be held
  */
-static void blk_finish_request(struct request *req, int error, int *drop_ref)
+static void __blk_finish_request(struct request *req, int error, int *drop_ref)
 {
bool ref;
 
@@ -2517,7 +2517,10 @@ static void blk_finish_request(struct request *req, int 
error, int *drop_ref)
blk_unprep_request(req);
 
blk_account_io_done(req);
+}
 
+void blk_reclaim_request(struct request *req, int error)
+{
if (req->end_io)
req->end_io(req, error);
else {
@@ -2528,6 +2531,12 @@ static void blk_finish_request(struct request *req, int 
error, int *drop_ref)
}
 }
 
+static void blk_finish_request(struct request *req, int error, int *drop_ref)
+{
+   __blk_finish_request(req, error, drop_ref);
+   blk_reclaim_request(req, error);
+}
+
 /**
  * blk_end_bidi_request - Complete a bidi request
  * @rq: the request to complete
@@ -2555,7 +2564,11 @@ static bool blk_end_bidi_request(struct request *rq, int 
error,
return true;
 
spin_lock_irqsave(q->queue_lock, flags);
-   blk_finish_request(rq, error, drop_ref);
+   /* low level wants to manage ref, so not to reclaim rq */
+   if (drop_ref)
+   __blk_finish_request(rq, error, drop_ref);
+   else
+   blk_finish_request(rq, error, drop_ref);
spin_unlock_irqrestore(q->queue_lock, flags);
 
return false;
@@ -2608,25 +2621,15 @@ bool blk_end_request(struct request *rq, int error, 
unsigned int nr_bytes)
 EXPORT_SYMBOL(blk_end_request);
 
 /**
- * blk_end_request_ref - Helper function for drivers to complete the request.
- * @rq:   the request being processed
- * @error:%0 for success, < %0 for error
- * @nr_bytes: number of bytes to complete
- *
- * Description:
- * Ends I/O on a number of bytes attached to @rq.
- * If @rq has leftover, sets it up for the next range of segments.
- *
- * Return:
- * %false - we are done with this request
- * %true  - still buffers pending for this request
+ * blk_end_request_noreclaim - same as blk_end_request, but not reclaim rq
  **/
-bool blk_end_request_ref(struct request *rq, int error, unsigned int nr_bytes,
-   int *drop_ref)
+bool blk_end_request_noreclaim(struct request *rq, int error,
+   unsigned int nr_bytes, int *drop_ref)
 {
+   BUG_ON(!drop_ref);
return blk_end_bidi_request(rq, error, nr_bytes, 0, drop_ref);
 }
-EXPORT_SYMBOL(blk_end_request_ref);
+EXPORT_SYMBOL(blk_end_request_noreclaim);
 
 /**
  * blk_end_request_all - Helper function for drives to finish the request.
@@ -2650,6 +2653,21 @@ void blk_end_request_all(struct request *rq, int error)
 }
 EXPORT_SYMBOL(blk_end_request_all);
 
+void blk_end_request_all_noreclaim(struct request *rq, int error)
+{
+   bool pending;
+   unsigned int bidi_bytes = 0;
+   int ref;
+
+   if (unlikely(blk_bidi_rq(rq)))
+   bidi_bytes = blk_rq_bytes(rq->next_rq);
+
+   pending = blk_end_bidi_request(rq, error, blk_rq_bytes(rq), bidi_bytes,
+   &ref);
+   BUG_ON(pending);
+}
+EXPORT_SYMBOL(blk_end_request_all_noreclaim);
+
 /**
  * blk_end_request_cur - Helper function to finish the current request chunk.
  * @rq: the request to finish the current chunk for
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 7a2e79f..70c65d2 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -772,6 +772,7 @@ extern void generic_make_request(struct bio *bio);
 extern void blk_rq_init(struct request_queue *q, struct request *rq);
 extern void blk_put_request(struct request *);
 extern void __blk_put_request(struct request_queue *, struct request *);
+extern void blk_reclaim_request(struct request *req, int error);
 extern struct request *blk_get_request(struct request_queue *, int, gfp_t);
 extern struct request *blk_make_request(struct request_queue *, struct bio *,
gfp_t);
@@ -934,11 +935,12 @@ extern struct request *blk_fetch_request(struct 
request_queue *q);
  */
 extern bool blk_update_request(struct request *rq, int error,
   unsigned int nr_bytes);
-extern bool blk_end_request_ref(struct request *rq, int error,
-   unsigned int nr_bytes, int *drop_ref);
 extern bool blk_end_request(struct request *rq, int error,
unsigned int nr_bytes);
+extern bool blk_end_request_noreclaim(struct request *rq, int error,
+   un

[RFC 0/9] fix for the race issue between scsi timer and in-flight scmd

2014-05-30 Thread Liu Ping Fan
When running io stress test on large latency scsi-disk, e.g guest with virtscsi
on a nfs image. It can trigger the BUG_ON(test_bit(REQ_ATOM_COMPLETE, 
&req->atomic_flags));
in blk_start_request().
Since there is a race between latency "finishing" scmd and the re-allocated 
scmd.
I.e a request is still referred by a scmd, but we had turn it back to
slab. 

This series introduces the ref on scmd to exclude this issue, and the following 
is ref rules.

  inc ref rules is like the following:
When setup a scmd, inited as 1. When add a timer inc 1.
  
  dec ref rules is like the following:
-for the normal ref
   scsi_done() will drop the ref when fail to acquire REQ_ATOM_COMPLETE 
immediately
   or drop the ref by scsi_end_request()
   or drop by return SUCCESS_REMOVE
-for a timer ref
   when deleting timer, if !list_empty(timeout_list), then there is a timer 
ref, and
   drop it.


patch1-2: fix the current potential bug 
patch3~6: prepare for the mechanism for the ref
patch7:   the ref rules core
patch8-9:  e.g and test-issue for the new mechanism. Since lack of many 
virtscsi background,
   patch8 may be poor and need to be improved :)


Note: all the patches are based on rhel7, whose kernel version is linux-3.10.
  I will rebase them onto the latest commit if my method is practical.


Liu Ping Fan (9):
  block: make timeout_list protectd by REQ_ATOM_COMPLETE bit
  scsi: ensure request is dequeue when finishing scmd
  scsi: introduce new internal flag SUCCESS_REMOVE
  blk: change the prototype of blk_complete_request()
  blk: change funcs' prototype to expose the ref of timer
  blk: split the reclaim of req from blk_finish_request()
  scsi: adopt ref on scsi_cmnd to avoid a race on request
  scsi: virtscsi: work around to abort a scmd
  scsi: ibmvscsi: return SUCCESS_REMOVE when finding a abort cmd

 block/blk-core.c | 67 ++-
 block/blk-softirq.c  | 13 +--
 block/blk-timeout.c  | 15 +---
 block/blk.h  |  3 +-
 drivers/scsi/ibmvscsi/ibmvscsi.c |  2 +-
 drivers/scsi/scsi.c  | 33 -
 drivers/scsi/scsi_error.c| 10 +-
 drivers/scsi/scsi_lib.c  | 76 +++-
 drivers/scsi/scsi_priv.h |  4 +++
 drivers/scsi/virtio_scsi.c   | 61 ++--
 include/linux/blkdev.h   |  9 +++--
 include/scsi/scsi.h  |  1 +
 include/scsi/scsi_cmnd.h |  1 +
 13 files changed, 246 insertions(+), 49 deletions(-)

-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 2/9] scsi: ensure request is dequeue when finishing scmd

2014-05-30 Thread Liu Ping Fan
When a timer requeue a request, it clears out REQ_ATOM_COMPLETE bit.
Hence if there is an in-flight scmd asks scsi-eh to handle an error by
joining the eh_entry list, then when scsi_error_handler() handles a scmd,
the scmd->request may be still on request_queue.  This will trigger
the BUG_ON(!list_empty(&req->queuelist)) in __blk_put_request().

Signed-off-by: Liu Ping Fan 
---
note: I hit this bug in my test, and the above comment is my guess. Hope for
more comments about it.

---
 block/blk.h   |  1 -
 drivers/scsi/scsi_error.c |  1 +
 drivers/scsi/scsi_lib.c   | 20 +++-
 drivers/scsi/scsi_priv.h  |  1 +
 include/linux/blkdev.h|  1 +
 5 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/block/blk.h b/block/blk.h
index c90e1d8..a9cad62 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -29,7 +29,6 @@ int blk_rq_append_bio(struct request_queue *q, struct request 
*rq,
  struct bio *bio);
 void blk_queue_bypass_start(struct request_queue *q);
 void blk_queue_bypass_end(struct request_queue *q);
-void blk_dequeue_request(struct request *rq);
 void __blk_queue_free_tags(struct request_queue *q);
 bool __blk_end_bidi_request(struct request *rq, int error,
unsigned int nr_bytes, unsigned int bidi_bytes);
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index c5f49cf..3b8b95b 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -2068,6 +2068,7 @@ void scsi_eh_flush_done_q(struct list_head *done_q)
SCSI_LOG_ERROR_RECOVERY(3, printk("%s: flush finish"
" cmd: %p\n",
current->comm, scmd));
+   scsi_queue_dequeue(scmd);
scsi_finish_command(scmd);
}
}
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 7fb2afe..e117579 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -210,6 +210,21 @@ void scsi_queue_insert(struct scsi_cmnd *cmd, int reason)
 {
__scsi_queue_insert(cmd, reason, 1);
 }
+
+void scsi_queue_dequeue(struct scsi_cmnd *cmd)
+{
+   struct scsi_device *device = cmd->device;
+   struct request_queue *q = device->request_queue;
+   struct request *req = cmd->request;
+   unsigned long flags;
+
+   if (list_empty(&cmd->request->queuelist))
+   return;
+   spin_lock_irqsave(q->queue_lock, flags);
+   blk_dequeue_request(req);
+   spin_unlock_irqrestore(q->queue_lock, flags);
+}
+
 /**
  * scsi_execute - insert request and wait for the result
  * @sdev:  scsi device
@@ -859,6 +874,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int 
good_bytes)
 */
req->next_rq->resid_len = scsi_in(cmd)->resid;
 
+   scsi_queue_dequeue(cmd);
scsi_release_buffers(cmd);
blk_end_request_all(req, 0);
 
@@ -1038,8 +1054,10 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned 
int good_bytes)
}
if (blk_end_request_err(req, error))
scsi_requeue_command(q, cmd);
-   else
+   else {
+   scsi_queue_dequeue(cmd);
scsi_next_command(cmd);
+   }
break;
case ACTION_REPREP:
/* Unprep the request and put it back at the head of the queue.
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
index f079a59..601b964 100644
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -84,6 +84,7 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd);
 extern int scsi_maybe_unblock_host(struct scsi_device *sdev);
 extern void scsi_device_unbusy(struct scsi_device *sdev);
 extern void scsi_queue_insert(struct scsi_cmnd *cmd, int reason);
+extern void scsi_queue_dequeue(struct scsi_cmnd *cmd);
 extern void scsi_next_command(struct scsi_cmnd *cmd);
 extern void scsi_io_completion(struct scsi_cmnd *, unsigned int);
 extern void scsi_run_host_queues(struct Scsi_Host *shost);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 8168524..ee7ddcd 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -916,6 +916,7 @@ static inline unsigned int blk_rq_count_bios(struct request 
*rq)
  */
 extern struct request *blk_peek_request(struct request_queue *q);
 extern void blk_start_request(struct request *rq);
+extern void blk_dequeue_request(struct request *rq);
 extern struct request *blk_fetch_request(struct request_queue *q);
 
 /*
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 8/9] scsi: virtscsi: work around to abort a scmd

2014-05-30 Thread Liu Ping Fan
This patch is just an "eg and test-issue" for this series. The main
changes is that when abort a scmd, distinguishing the case of removing
from the case of not found. ( I think it should be better to remove the
scmd directly from vq, but for the time being, I have no idea about
this detail in virtio)

Signed-off-by: Liu Ping Fan 
---
 drivers/scsi/virtio_scsi.c | 61 --
 1 file changed, 59 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index b26f1a5..d08aae5 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -31,8 +31,14 @@
 #define VIRTIO_SCSI_EVENT_LEN 8
 #define VIRTIO_SCSI_VQ_BASE 2
 
+/* should be per virtscsi dev */
+static struct list_head active_cmds = LIST_HEAD_INIT(active_cmds);
+static spinlock_t cmds_lock;
+
 /* Command queue element */
 struct virtio_scsi_cmd {
+   struct list_head list;
+   unsigned long abort;
struct scsi_cmnd *sc;
struct completion *comp;
union {
@@ -148,6 +154,18 @@ static void virtscsi_compute_resid(struct scsi_cmnd *sc, 
u32 resid)
 static void virtscsi_complete_cmd(struct virtio_scsi *vscsi, void *buf)
 {
struct virtio_scsi_cmd *cmd = buf;
+   unsigned long flags;
+   int skip = 0;
+   spin_lock_irqsave(&cmds_lock, flags);
+   list_del_init(&cmd->list);
+   if (cmd->abort)
+   skip = 1;
+   spin_unlock_irqrestore(&cmds_lock, flags);
+   if (skip) {
+   mempool_free(cmd, virtscsi_cmd_pool);
+   return;
+   }
+
struct scsi_cmnd *sc = cmd->sc;
struct virtio_scsi_cmd_resp *resp = &cmd->resp.cmd;
struct virtio_scsi_target_state *tgt =
@@ -273,11 +291,16 @@ static void virtscsi_req_done(struct virtqueue *vq)
 static void virtscsi_complete_free(struct virtio_scsi *vscsi, void *buf)
 {
struct virtio_scsi_cmd *cmd = buf;
+   unsigned long flags;
 
if (cmd->comp)
complete_all(cmd->comp);
-   else
+   else {
+   spin_lock_irqsave(&cmds_lock, flags);
+   list_del_init(&cmd->list);
+   spin_unlock_irqrestore(&cmds_lock, flags);
mempool_free(cmd, virtscsi_cmd_pool);
+   }
 }
 
 static void virtscsi_ctrl_done(struct virtqueue *vq)
@@ -477,6 +500,10 @@ static int virtscsi_kick_cmd(struct virtio_scsi_vq *vq,
int err;
bool needs_kick = false;
 
+   spin_lock_irqsave(&cmds_lock, flags);
+   list_add_tail(&cmd->list, &active_cmds);
+   spin_unlock_irqrestore(&cmds_lock, flags);
+
spin_lock_irqsave(&vq->vq_lock, flags);
err = virtscsi_add_cmd(vq->vq, cmd, req_size, resp_size, gfp);
if (!err)
@@ -495,6 +522,7 @@ static int virtscsi_queuecommand(struct virtio_scsi *vscsi,
 {
struct virtio_scsi_cmd *cmd;
int ret;
+   unsigned long flags;
 
struct Scsi_Host *shost = virtio_scsi_host(vscsi->vdev);
BUG_ON(scsi_sg_count(sc) > shost->sg_tablesize);
@@ -511,6 +539,7 @@ static int virtscsi_queuecommand(struct virtio_scsi *vscsi,
goto out;
 
memset(cmd, 0, sizeof(*cmd));
+   INIT_LIST_HEAD(&cmd->list);
cmd->sc = sc;
cmd->req.cmd = (struct virtio_scsi_cmd_req){
.lun[0] = 1,
@@ -530,8 +559,12 @@ static int virtscsi_queuecommand(struct virtio_scsi *vscsi,
  sizeof cmd->req.cmd, sizeof cmd->resp.cmd,
  GFP_ATOMIC) == 0)
ret = 0;
-   else
+   else {
+   spin_lock_irqsave(&cmds_lock, flags);
+   list_del_init(&cmd->list);
+   spin_unlock_irqrestore(&cmds_lock, flags);
mempool_free(cmd, virtscsi_cmd_pool);
+   }
 
 out:
return ret;
@@ -590,6 +623,7 @@ static int virtscsi_tmf(struct virtio_scsi *vscsi, struct 
virtio_scsi_cmd *cmd)
 {
DECLARE_COMPLETION_ONSTACK(comp);
int ret = FAILED;
+   unsigned long flags;
 
cmd->comp = ∁
if (virtscsi_kick_cmd(&vscsi->ctrl_vq, cmd,
@@ -603,6 +637,9 @@ static int virtscsi_tmf(struct virtio_scsi *vscsi, struct 
virtio_scsi_cmd *cmd)
ret = SUCCESS;
 
 out:
+   spin_lock_irqsave(&cmds_lock, flags);
+   list_del_init(&cmd->list);
+   spin_unlock_irqrestore(&cmds_lock, flags);
mempool_free(cmd, virtscsi_cmd_pool);
return ret;
 }
@@ -618,6 +655,7 @@ static int virtscsi_device_reset(struct scsi_cmnd *sc)
return FAILED;
 
memset(cmd, 0, sizeof(*cmd));
+   INIT_LIST_HEAD(&cmd->list);
cmd->sc = sc;
cmd->req.tmf = (struct virtio_scsi_ctrl_tmf_req){
.type = VIRTIO_SCSI_T_TMF,
@@ -634,13 +672,31 @@ static int virtscsi_abort(struct scsi_cmnd *sc)
 {
struct virtio_scsi *vscsi = shost_priv(sc->device->host);
struct virtio_scsi_cmd *cmd;
+   struct virtio_scsi_cmd *entry, *tmp;
+   unsigned long 

[RFC 4/9] blk: change the prototype of blk_complete_request()

2014-05-30 Thread Liu Ping Fan
This patch is for the incoming refcnt on scsi_cmnd. It can help the
scsi_done handler to run against the abort handler in parallel.

In the following patch, if a thread takes the REQ_ATOM_COMPLETE,
then it can drop the ref when end of this request. But if it fails
to take REQ_ATOM_COMPLETE, it should drop the ref immediately.
Here, using the return of blk_complete_request() to notice its caller.

Signed-off-by: Liu Ping Fan 
---
 block/blk-softirq.c| 13 ++---
 include/linux/blkdev.h |  2 +-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/block/blk-softirq.c b/block/blk-softirq.c
index 467c8de..6a841ae 100644
--- a/block/blk-softirq.c
+++ b/block/blk-softirq.c
@@ -156,6 +156,9 @@ do_local:
  * blk_complete_request - end I/O on a request
  * @req:  the request being processed
  *
+ * return -1 if fail to call __blk_complete_request which implies another
+ * routine is handling this req
+ *
  * Description:
  * Ends all I/O on a request. It does not handle partial completions,
  * unless the driver actually implements this in its completion callback
@@ -163,12 +166,16 @@ do_local:
  * through a softirq handler. The user must have registered a completion
  * callback through blk_queue_softirq_done().
  **/
-void blk_complete_request(struct request *req)
+int blk_complete_request(struct request *req)
 {
+   int ret = -1;
if (unlikely(blk_should_fake_timeout(req->q)))
-   return;
-   if (!blk_mark_rq_complete(req))
+   return ret;
+   if (!blk_mark_rq_complete(req)) {
__blk_complete_request(req);
+   ret = 0;
+   }
+   return ret;
 }
 EXPORT_SYMBOL(blk_complete_request);
 
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index ee7ddcd..23deadb 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -945,7 +945,7 @@ extern void __blk_end_request_all(struct request *rq, int 
error);
 extern bool __blk_end_request_cur(struct request *rq, int error);
 extern bool __blk_end_request_err(struct request *rq, int error);
 
-extern void blk_complete_request(struct request *);
+extern int blk_complete_request(struct request *);
 extern void __blk_complete_request(struct request *);
 extern void blk_abort_request(struct request *);
 extern void blk_unprep_request(struct request *);
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 1/9] block: make timeout_list protectd by REQ_ATOM_COMPLETE bit

2014-05-30 Thread Liu Ping Fan
The "request->timeout_list" is under the risk of modified by both timeout
(abort handler) and a "finishing" handler. Using bit REQ_ATOM_COMPLETE in
atomic_flags as a guard to shield this issue.

Signed-off-by: Liu Ping Fan 
---
 block/blk-timeout.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/blk-timeout.c b/block/blk-timeout.c
index 7a882f7..d3067f0 100644
--- a/block/blk-timeout.c
+++ b/block/blk-timeout.c
@@ -120,13 +120,14 @@ void blk_rq_check_expired(struct request *rq, unsigned 
long *next_timeout,
  unsigned int *next_set)
 {
if (time_after_eq(jiffies, rq->deadline)) {
-   list_del_init(&rq->timeout_list);
 
/*
 * Check if we raced with end io completion
 */
-   if (!blk_mark_rq_complete(rq))
+   if (!blk_mark_rq_complete(rq)) {
+   list_del_init(&rq->timeout_list);
blk_rq_timed_out(rq);
+   }
} else if (!*next_set || time_after(*next_timeout, rq->deadline)) {
*next_timeout = rq->deadline;
*next_set = 1;
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 4/9] blk: change the prototype of blk_complete_request()

2014-05-30 Thread Liu Ping Fan
This patch is for the incoming refcnt on scsi_cmnd. It can help the
scsi_done handler to run against the abort handler in parallel.

In the following patch, if a thread takes the REQ_ATOM_COMPLETE,
then it can drop the ref when end of this request. But if it fails
to take REQ_ATOM_COMPLETE, it should drop the ref immediately.
Here, using the return of blk_complete_request() to notice its caller.

Signed-off-by: Liu Ping Fan 
---
 block/blk-softirq.c| 13 ++---
 include/linux/blkdev.h |  2 +-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/block/blk-softirq.c b/block/blk-softirq.c
index 467c8de..6a841ae 100644
--- a/block/blk-softirq.c
+++ b/block/blk-softirq.c
@@ -156,6 +156,9 @@ do_local:
  * blk_complete_request - end I/O on a request
  * @req:  the request being processed
  *
+ * return -1 if fail to call __blk_complete_request which implies another
+ * routine is handling this req
+ *
  * Description:
  * Ends all I/O on a request. It does not handle partial completions,
  * unless the driver actually implements this in its completion callback
@@ -163,12 +166,16 @@ do_local:
  * through a softirq handler. The user must have registered a completion
  * callback through blk_queue_softirq_done().
  **/
-void blk_complete_request(struct request *req)
+int blk_complete_request(struct request *req)
 {
+   int ret = -1;
if (unlikely(blk_should_fake_timeout(req->q)))
-   return;
-   if (!blk_mark_rq_complete(req))
+   return ret;
+   if (!blk_mark_rq_complete(req)) {
__blk_complete_request(req);
+   ret = 0;
+   }
+   return ret;
 }
 EXPORT_SYMBOL(blk_complete_request);
 
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index ee7ddcd..23deadb 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -945,7 +945,7 @@ extern void __blk_end_request_all(struct request *rq, int 
error);
 extern bool __blk_end_request_cur(struct request *rq, int error);
 extern bool __blk_end_request_err(struct request *rq, int error);
 
-extern void blk_complete_request(struct request *);
+extern int blk_complete_request(struct request *);
 extern void __blk_complete_request(struct request *);
 extern void blk_abort_request(struct request *);
 extern void blk_unprep_request(struct request *);
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ncr53c8xx: remove ancient configuration macros

2014-05-30 Thread Paul Bolle
It has not been possible to set CONFIG_SCSI_NCR53C8XX_FORCE_SYNC_NEGO,
CONFIG_SCSI_NCR53C8XX_DISABLE_MPARITY_CHECK, and
CONFIG_SCSI_NCR53C8XX_DISABLE_PARITY_CHECK through the configuration
system since v2.1.20. Remove these ancient macros.

To enable (or disable) the functionality they covered one should edit a
header file and set related preprocessor macros. Since this is actually
a documented feature those related macros remain available.

Signed-off-by: Paul Bolle 
---
Untested.

Note that the documentation still contains
insmod ncr53c8xx

Besides insmod being outdated, the modules that use ncr53c8xx's code
appear to be NCR_Q720_mod.ko and zalon7xx.ko. So the documentation needs
probably to be updated to reflect this.

 Documentation/scsi/ncr53c8xx.txt |  5 -
 drivers/scsi/ncr53c8xx.h | 12 
 2 files changed, 17 deletions(-)

diff --git a/Documentation/scsi/ncr53c8xx.txt b/Documentation/scsi/ncr53c8xx.txt
index 49c7b723225b..df4a1b97e659 100644
--- a/Documentation/scsi/ncr53c8xx.txt
+++ b/Documentation/scsi/ncr53c8xx.txt
@@ -580,11 +580,6 @@ CONFIG_SCSI_NCR53C8XX_SYNC(default answer: 5)
 This frequency can be changed later with the "setsync" control command.
 0 means "asynchronous data transfers".
 
-CONFIG_SCSI_NCR53C8XX_FORCE_SYNC_NEGO (default answer: n)
-Force synchronous negotiation for all SCSI-2 devices.
-Some SCSI-2 devices do not report this feature in byte 7 of inquiry 
-response but do support it properly (TAMARACK scanners for example).
-
 CONFIG_SCSI_NCR53C8XX_NO_DISCONNECT   (default and only reasonable answer: n)
 If you suspect a device of yours does not properly support disconnections,
 you can answer "y". Then, all SCSI devices will never disconnect the bus 
diff --git a/drivers/scsi/ncr53c8xx.h b/drivers/scsi/ncr53c8xx.h
index e34ec5a2ea5e..8043635982bc 100644
--- a/drivers/scsi/ncr53c8xx.h
+++ b/drivers/scsi/ncr53c8xx.h
@@ -148,29 +148,17 @@
 /*
  * Force synchronous negotiation for all targets
  */
-#ifdef CONFIG_SCSI_NCR53C8XX_FORCE_SYNC_NEGO
-#define SCSI_NCR_SETUP_FORCE_SYNC_NEGO (1)
-#else
 #define SCSI_NCR_SETUP_FORCE_SYNC_NEGO (0)
-#endif
 
 /*
  * Disable master parity checking (flawed hardwares need that)
  */
-#ifdef CONFIG_SCSI_NCR53C8XX_DISABLE_MPARITY_CHECK
-#define SCSI_NCR_SETUP_MASTER_PARITY   (0)
-#else
 #define SCSI_NCR_SETUP_MASTER_PARITY   (1)
-#endif
 
 /*
  * Disable scsi parity checking (flawed devices may need that)
  */
-#ifdef CONFIG_SCSI_NCR53C8XX_DISABLE_PARITY_CHECK
-#define SCSI_NCR_SETUP_SCSI_PARITY (0)
-#else
 #define SCSI_NCR_SETUP_SCSI_PARITY (1)
-#endif
 
 /*
  * Settle time after reset at boot-up
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ncr53c8xx: remove remnants of immediate arbitration

2014-05-30 Thread Paul Bolle
The code for immediate arbitration was removed from (what looks like a
predecessor of) the ncr53c8xx code in v2.6.0. Remove its remnants now.

Signed-off-by: Paul Bolle 
---
Untested.

 Documentation/scsi/ncr53c8xx.txt | 52 
 drivers/scsi/ncr53c8xx.c | 12 --
 drivers/scsi/ncr53c8xx.h |  8 ---
 3 files changed, 72 deletions(-)

diff --git a/Documentation/scsi/ncr53c8xx.txt b/Documentation/scsi/ncr53c8xx.txt
index 1d508dcbf859..49c7b723225b 100644
--- a/Documentation/scsi/ncr53c8xx.txt
+++ b/Documentation/scsi/ncr53c8xx.txt
@@ -52,12 +52,10 @@ Written by Gerard Roudier 
  10.2.19 Check SCSI BUS 
  10.2.20 Exclude a host from being attached
  10.2.21 Suggest a default SCSI id for hosts
- 10.2.22 Enable use of IMMEDIATE ARBITRATION
   10.3 Advised boot setup commands
   10.4 PCI configuration fix-up boot option
   10.5 Serial NVRAM support boot option
   10.6 SCSI BUS checking boot option
-  10.7 IMMEDIATE ARBITRATION boot option
 11. Some constants and flags of the ncr53c8xx.h header file
 12. Installation
 13. Architecture dependent features
@@ -843,16 +841,6 @@ port address 0x1400.
 try to deduce the value previously set in the hardware and use value 
 7 if the hardware value is zero.
 
-10.2.22 Enable use of IMMEDIATE ARBITRATION
-(only supported by the sym53c8xx driver. See 10.7 for more details)
-iarb:0do not use this feature.
-iarb:#x   use this feature according to bit fields as follow:
-
-bit 0 (1) : enable IARB each time the initiator has been reselected 
-when it arbitrated for the SCSI BUS.
-(#x >> 4) : maximum number of successive settings of IARB if the initiator 
-win arbitration and it has other commands to send to a device.
-
 Boot fail safe
 safe:y load the following assumed fail safe initial setup
 
@@ -876,7 +864,6 @@ Boot fail safe
   differential support from BIOS settings  diff:1
   irq mode from BIOS settings  irqm:1
   SCSI BUS check   do not attach on error  buschk:1
-  immediate arbitrationdisablediarb:0
 
 10.3 Advised boot setup commands
 
@@ -1005,45 +992,6 @@ Unfortunately, the following common SCSI BUS problems are 
not detected:
 On the other hand, either bad cabling, broken devices, not conformant 
 devices, ... may cause a SCSI signal to be wrong when te driver reads it.
 
-10.7 IMMEDIATE ARBITRATION boot option
-
-This option is only supported by the SYM53C8XX driver (not by the NCR53C8XX).
-
-SYMBIOS 53C8XX chips are able to arbitrate for the SCSI BUS as soon as they 
-have detected an expected disconnection (BUS FREE PHASE). For this process 
-to be started, bit 1 of SCNTL1 IO register must be set when the chip is 
-connected to the SCSI BUS.
-
-When this feature has been enabled for the current connection, the chip has 
-every chance to win arbitration if only devices with lower priority are 
-competing for the SCSI BUS. By the way, when the chip is using SCSI id 7, 
-then it will for sure win the next SCSI BUS arbitration.
-
-Since, there is no way to know what devices are trying to arbitrate for the 
-BUS, using this feature can be extremely unfair. So, you are not advised
-to enable it, or at most enable this feature for the case the chip lost 
-the previous arbitration (boot option 'iarb:1').
-
-This feature has the following advantages:
-
-a) Allow the initiator with ID 7 to win arbitration when it wants so.
-b) Overlap at least 4 micro-seconds of arbitration time with the execution 
-   of SCRIPTS that deal with the end of the current connection and that 
-   starts the next job.
-
-Hmmm... But (a) may just prevent other devices from reselecting the initiator, 
-and delay data transfers or status/completions, and (b) may just waste 
-SCSI BUS bandwidth if the SCRIPTS execution lasts more than 4 micro-seconds.
-
-The use of IARB needs the SCSI_NCR_IARB_SUPPORT option to have been defined 
-at compile time and the 'iarb' boot option to have been set to a non zero 
-value at boot time. It is not that useful for real work, but can be used 
-to stress SCSI devices or for some applications that can gain advantage of 
-it. By the way, if you experience badnesses like 'unexpected disconnections', 
-'bad reselections', etc... when using IARB on heavy IO load, you should not 
-be surprised, because force-feeding anything and blocking its arse at the 
-same time cannot work for a long time. :-))
-
 
 11. Some constants and flags of the ncr53c8xx.h header file
 
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c
index 7d014b11df62..9661a2c9e13c 100644
--- a/drivers/scsi/ncr53c8xx.c
+++ b/drivers/scsi/ncr53c8xx.c
@@ -615,10 +615,6 @@ static struct ncr_driver_setup
 #define OPT_EXCLUDE24
 #define OPT_HOST_ID25
 
-#ifdef SCSI_NCR_IARB_SUPPORT
-#defi

[PATCH] ncr53c8xx: remove remnants of integrity checking

2014-05-30 Thread Paul Bolle
The code for integrity checking was removed in v2.6.10. Remove its
remnants now.

Signed-off-by: Paul Bolle 
---
Untested.

 drivers/scsi/ncr53c8xx.h | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/scsi/ncr53c8xx.h b/drivers/scsi/ncr53c8xx.h
index 0e008dacf679..736a9df68d58 100644
--- a/drivers/scsi/ncr53c8xx.h
+++ b/drivers/scsi/ncr53c8xx.h
@@ -63,14 +63,6 @@
 #define SCSI_NCR_BOOT_COMMAND_LINE_SUPPORT
 #define SCSI_NCR_DEBUG_INFO_SUPPORT
 
-/*
-** To disable integrity checking, do not define the 
-** following option.
-*/
-#ifdef CONFIG_SCSI_NCR53C8XX_INTEGRITY_CHECK
-#  define SCSI_NCR_ENABLE_INTEGRITY_CHECK
-#endif
-
 /* -
 ** Take into account kernel configured parameters.
 ** Most of these options can be overridden at startup by a command line.
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html