From: James Bottomley <James.Bottomley@steeleye.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Patrick Mansfield <patmans@us.ibm.com>,
Mike Anderson <andmike@us.ibm.com>,
SCSI development list <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] fix sd open/remove race
Date: 09 Apr 2004 10:35:05 -0500 [thread overview]
Message-ID: <1081524905.2203.52.camel@mulgrave> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0404091116020.1000-100000@ida.rowland.org>
On Fri, 2004-04-09 at 10:24, Alan Stern wrote:
> You're right. However, you still want calls to sd_open to start failing
> as soon as the disconnection notice is received. Since the
> disk-unavailable state can't be indicated by clearing disk->private_data,
> it has to be indicated in some other way. How to do it is up to you, but
> whatever way you choose, the indicator should be cleared in sd_remove (and
> that change must be synchronized by acquiring the new semaphore).
That's what the original bug2400 thread was all about. I think opening
with an already degraded device (one that will EIO to everything) is
just as good as refusing the open. That's why the only race is the
reference race. It's better to refuse the open, but the effects of
either are the same.
> Ah, yes. However there's no reason to hold the semaphore _every_ time you
> do a scsi_disk_put. And once you use something else as an indicator,
> there won't be any need to clear disk->private_data.
Actually, there is a (very obscure) three thread SMP race that this
prevents. Thread 1 -> sd_remove; Thread 2 -> sd_close (for last close)
and Thread 3 -> sd_open
Thread 2 might end up doing the last put and if it were not protected it
would still race with sd_open.
James
next prev parent reply other threads:[~2004-04-09 15:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20040408115148.A12041@beaverton.ibm.com>
2004-04-09 14:11 ` [PATCH] fix sd open/remove race Alan Stern
2004-04-09 14:28 ` James Bottomley
2004-04-09 15:24 ` Alan Stern
2004-04-09 15:35 ` James Bottomley [this message]
2004-04-09 15:55 ` Alan Stern
2004-04-09 16:08 ` James Bottomley
2004-04-09 18:29 ` Alan Stern
2004-04-09 18:45 ` James Bottomley
2004-04-09 19:58 ` Alan Stern
2004-04-07 3:25 James Bottomley
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=1081524905.2203.52.camel@mulgrave \
--to=james.bottomley@steeleye.com \
--cc=andmike@us.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=patmans@us.ibm.com \
--cc=stern@rowland.harvard.edu \
/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