From: Juergen Gross <jgross@suse.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org,
JBottomley@parallels.com, xen-devel@lists.xen.org
Subject: Re: [Xen-devel] [PATCH V2 2/4] Introduce xen-scsifront module
Date: Wed, 30 Jul 2014 06:53:59 +0200 [thread overview]
Message-ID: <53D87A67.8050005@suse.com> (raw)
In-Reply-To: <53D7B65C.8030701@suse.com>
On 07/29/2014 04:57 PM, Juergen Gross wrote:
> On 07/29/2014 03:53 PM, Christoph Hellwig wrote:
>>> + switch (op) {
>>> + case VSCSIFRONT_OP_ADD_LUN:
>>> + if (device_state == XenbusStateInitialised) {
>>> + sdev = scsi_device_lookup(info->host, chn, tgt,
>>> + lun);
>>> + if (sdev) {
>>> + dev_err(&dev->dev,
>>> + "Device already in use.\n");
>>> + scsi_device_put(sdev);
>>> + xenbus_printf(XBT_NIL, dev->nodename,
>>> + state_str, "%d",
>>> + XenbusStateClosed);
>>> + } else {
>>> + scsi_add_device(info->host, chn, tgt,
>>> + lun);
>>> + xenbus_printf(XBT_NIL, dev->nodename,
>>> + state_str, "%d",
>>> + XenbusStateConnected);
>>> + }
>>> + }
>>> + break;
>>
>> scsi_add_device handles an already existing device just fine, and unlike
>> this construct isn't racy.
>
> Okay. I'll change it.
Hmm, I looked into scsi_add_device(). It seems as if the caller can't
distinguish between a new created and an already existing device. Am I
missing something?
The race is not existing: scsi_add_device() (and scsi_remove_device()
as well) for this scsi_host is called in scsifront_do_lun_hotplug()
only, and this function is always called in the same thread (xenbus
watch). A comment seems to be a good idea.
Juergen
next prev parent reply other threads:[~2014-07-30 4:53 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-25 11:37 [PATCH V2 0/4] Add XEN pvSCSI support jgross
2014-07-25 11:37 ` [PATCH V2 1/4] Add XEN pvSCSI protocol description jgross
2014-07-28 14:28 ` [Xen-devel] " David Vrabel
2014-07-29 7:39 ` Juergen Gross
2014-07-29 7:39 ` Juergen Gross
2014-07-28 14:28 ` David Vrabel
2014-07-25 11:37 ` jgross
2014-07-25 11:37 ` [PATCH V2 2/4] Introduce xen-scsifront module jgross
2014-07-29 13:53 ` Christoph Hellwig
2014-07-29 14:57 ` [Xen-devel] " Juergen Gross
2014-07-30 4:53 ` Juergen Gross [this message]
2014-08-01 12:08 ` Christoph Hellwig
2014-08-01 13:06 ` Juergen Gross
2014-08-01 13:06 ` [Xen-devel] " Juergen Gross
2014-08-01 13:41 ` Christoph Hellwig
2014-08-01 13:41 ` [Xen-devel] " Christoph Hellwig
2014-08-01 12:08 ` Christoph Hellwig
2014-07-30 4:53 ` Juergen Gross
2014-07-29 14:57 ` Juergen Gross
2014-07-29 13:53 ` Christoph Hellwig
2014-07-25 11:37 ` jgross
2014-07-25 11:37 ` [PATCH V2 3/4] Introduce XEN scsiback module jgross
2014-07-26 15:23 ` Christoph Hellwig
2014-07-26 15:23 ` Christoph Hellwig
2014-07-28 3:35 ` [Xen-devel] " Jürgen Groß
2014-07-29 12:28 ` Christoph Hellwig
2014-07-29 12:28 ` [Xen-devel] " Christoph Hellwig
2014-07-28 3:35 ` Jürgen Groß
2014-07-25 11:37 ` jgross
2014-07-25 11:37 ` [PATCH V2 4/4] add xen pvscsi maintainer jgross
2014-07-25 11:37 ` jgross
2014-07-25 17:38 ` [PATCH V2 0/4] Add XEN pvSCSI support Konrad Rzeszutek Wilk
2014-07-25 17:38 ` Konrad Rzeszutek Wilk
2014-07-26 7:28 ` Juergen Gross
2014-07-26 7:28 ` Juergen Gross
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=53D87A67.8050005@suse.com \
--to=jgross@suse.com \
--cc=JBottomley@parallels.com \
--cc=hch@infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=target-devel@vger.kernel.org \
--cc=xen-devel@lists.xen.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.