public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Christof Schmitt <christof.schmitt@de.ibm.com>
To: Hannes Reinecke <hare@suse.de>
Cc: Julia Lawall <julia@diku.dk>,
	"James E.J. Bottomley" <James.Bottomley@suse.de>,
	linux-scsi@vger.kernel.org, joe@perches.com,
	James Smart <James.Smart@Emulex.Com>
Subject: Re: question about drivers/scsi/scsi_transport_fc.c
Date: Thu, 2 Sep 2010 16:28:36 +0200	[thread overview]
Message-ID: <20100902142835.GA4992@schmichrtp.mainz.de.ibm.com> (raw)
In-Reply-To: <4C7FA91B.60607@suse.de>

On Thu, Sep 02, 2010 at 03:39:39PM +0200, Hannes Reinecke wrote:
> Christof Schmitt wrote:
> > On Sat, Aug 28, 2010 at 07:11:12PM +0200, Julia Lawall wrote:
> >> The function fc_bsg_goose_queue in the file drivers/scsi/scsi_transport_fc.c
> >> contains the following code:
> >>
> >>         flagset = test_bit(QUEUE_FLAG_REENTER, &rport->rqst_q->queue_flags) &&
> >>                   !test_bit(QUEUE_FLAG_REENTER, &rport->rqst_q->queue_flags);
> >>
> >> I have the impression that this is always 0.  QUEUE_FLAG_REENTER is 
> >> defined with quite a lot of other constants, so I don't really have a 
> >> guess as to what was intended.
> > 
> > I just came across the code in scsi_run_queue in
> > drivers/scsi/scsi_lib.c. It looks like the check of QUEUE_FLAG_REENTER
> > in fc_bsg_goose_queue is modeled after the check in scsi_run_queue.
> > 
> > The check in scsi_run_queue has been introduced with this commit,
> > maybe this helps understanding the code:
> > 
> > commit 04846f25920d4b05d6040c531cc601049260db52
> > Author: Andreas Herrmann <aherrman@de.ibm.com>
> > Date:   Wed Aug 9 17:31:16 2006 +0200
> > 
> >     [SCSI] limit recursion when flushing shost->starved_list
> > 
> Then it's still wrong. The above commit has:
> 
> +               if (test_bit(QUEUE_FLAG_REENTER, &q->queue_flags) &&
> +                   !test_and_set_bit(QUEUE_FLAG_REENTER,
> +                                     &sdev->request_queue->queue_flags)) {
> 
> Which is slightly different than the above. Looks like a copy and past error.

I missed one commit that changed the locking and the flag handling:

commit 75ad23bc0fcb4f992a5d06982bf0857ab1738e9e
Author: Nick Piggin <npiggin@suse.de>
Date:   Tue Apr 29 14:48:33 2008 +0200

    block: make queue flags non-atomic

This one introduced
+               spin_lock(sdev->request_queue->queue_lock);
+               flagset = test_bit(QUEUE_FLAG_REENTER, &q->queue_flags) &&
+                               !test_bit(QUEUE_FLAG_REENTER,
+				&sdev->request_queue->queue_flags);
which does not make sense to me, maybe it would be enough to test the
bit?

> It probably should read
> 
>          flagset = test_bit(QUEUE_FLAG_REENTER, &rport->rqst_q->queue_flags) &&
>                    !test_and_set_bit(QUEUE_FLAG_REENTER, &rport->rqst_q->queue_flags);
> 
> This was introduced by
> 
> commit 9e4f5e29610162fd426366f3b29e3cc6e575b858
> Author: James Smart <James.Smart@Emulex.Com>
> Date:   Thu Mar 26 13:33:19 2009 -0400
> 
>     [SCSI] FC Pass Thru support
> 
> so we should be blaming^Wasking him.

Or could the whole handling of the QUEUE_FLAG_REENTER simply be
removed from the SCSI and FC code? The flag is set before calling
__blk_run_queue, but this function already sets the flag internally to
avoid recursion.

--
Christof

  reply	other threads:[~2010-09-02 14:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-28 17:11 question about drivers/scsi/scsi_transport_fc.c Julia Lawall
2010-09-02 10:53 ` Christof Schmitt
2010-09-02 13:39   ` Hannes Reinecke
2010-09-02 14:28     ` Christof Schmitt [this message]
2010-09-02 15:01       ` [PATCH] scsi: Remove QUEUE_FLAG_REENTER from SCSI code Christof Schmitt
2010-09-27  7:58         ` James Bottomley
2010-10-04 13:47           ` Christof Schmitt
2010-10-05  9:00             ` [PATCH v2] " Christof Schmitt

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=20100902142835.GA4992@schmichrtp.mainz.de.ibm.com \
    --to=christof.schmitt@de.ibm.com \
    --cc=James.Bottomley@suse.de \
    --cc=James.Smart@Emulex.Com \
    --cc=hare@suse.de \
    --cc=joe@perches.com \
    --cc=julia@diku.dk \
    --cc=linux-scsi@vger.kernel.org \
    /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