All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Smart <James.Smart@Emulex.Com>
To: James Bottomley <James.Bottomley@SteelEye.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] bug fix: SCSI async scan sysfs -EEXIST problem
Date: Tue, 22 May 2007 17:10:34 -0400	[thread overview]
Message-ID: <46535C4A.8020509@emulex.com> (raw)
In-Reply-To: <1179848907.3738.19.camel@mulgrave.il.steeleye.com>



James Bottomley wrote:
> On Mon, 2007-05-07 at 14:57 -0400, James Smart wrote:
>> +       mutex_lock(&shost->scan_mutex);
>>         scsi_sysfs_add_devices(shost);
>> +       atomic_set(&shost->async_scan, 0);
>> +       mutex_unlock(&shost->scan_mutex);
> 
> It really seems that the only safety here is expanding the scan mutex to
> cover more of the code.  I don't really see any value to using the
> atomic types ... it's not a simultaneous variable update problem, it's a
> scan race which the mutex can be used to mediate.
> 
> James

True. First requirement is that scsi_sysfs_add_devices() must be under
the scan_mutex.  Additionally, (ignoring the atomic) shost->async_scan,
based on its use in scsi_add_lun(), should be changed under the mutex
as well, thus the "proper" placement in the snippet above is while
under the scan mutex.

The real headache was the other code paths that read the value of
async_scan and determine whether to enumerate or ignore the sdev.
Reorganizing that code to place it under scan_mutex was very ugly.
Converting to an atomic simply addressed the synchronicity on sampling,
although it essentially makes it independent of the scan_mutex.

Are you suggesting you would rather rework all the other code paths for
scan_mutex encapsulating async_scan ?

-- james





      reply	other threads:[~2007-05-22 21:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-07 18:57 [PATCH] bug fix: SCSI async scan sysfs -EEXIST problem James Smart
2007-05-22 15:48 ` James Bottomley
2007-05-22 21:10   ` James Smart [this message]

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=46535C4A.8020509@emulex.com \
    --to=james.smart@emulex.com \
    --cc=James.Bottomley@SteelEye.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.