From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Juergen Gross <jgross@suse.com>,
linux-kernel@vger.kernel.org, xen-devel@lists.xensource.com,
konrad.wilk@oracle.com, david.vrabel@citrix.com
Subject: Re: [PATCH V2 2/3] xen: scsiback: add LUN of restored domain
Date: Wed, 18 Feb 2015 12:02:32 -0500 [thread overview]
Message-ID: <54E4C5A8.9070109@oracle.com> (raw)
In-Reply-To: <1424156569-13642-3-git-send-email-jgross@suse.com>
On 02/17/2015 02:02 AM, Juergen Gross wrote:
> When a xen domain is being restored the LUN state of a pvscsi device
> is "Connected" and not "Initialising" as in case of attaching a new
> pvscsi LUN.
>
> This must be taken into account when adding a new pvscsi device for
> a domain as otherwise the pvscsi LUN won't be connected to the
> SCSI target associated with it.
scsiback_do_add_lun() is being called from scsiback_frontend_changed()
which eventually sets the state to Connected. Is the added test of
'try' an optimization or is it needed for correctness?
-boris
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
> drivers/xen/xen-scsiback.c | 19 ++++++++++++++-----
> 1 file changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
> index 9faca6a..9d60176 100644
> --- a/drivers/xen/xen-scsiback.c
> +++ b/drivers/xen/xen-scsiback.c
> @@ -992,7 +992,7 @@ found:
> }
>
> static void scsiback_do_add_lun(struct vscsibk_info *info, const char *state,
> - char *phy, struct ids_tuple *vir)
> + char *phy, struct ids_tuple *vir, int try)
> {
> if (!scsiback_add_translation_entry(info, phy, vir)) {
> if (xenbus_printf(XBT_NIL, info->dev->nodename, state,
> @@ -1000,7 +1000,7 @@ static void scsiback_do_add_lun(struct vscsibk_info *info, const char *state,
> pr_err("xen-pvscsi: xenbus_printf error %s\n", state);
> scsiback_del_translation_entry(info, vir);
> }
> - } else {
> + } else if (!try) {
> xenbus_printf(XBT_NIL, info->dev->nodename, state,
> "%d", XenbusStateClosed);
> }
> @@ -1060,10 +1060,19 @@ static void scsiback_do_1lun_hotplug(struct vscsibk_info *info, int op,
>
> switch (op) {
> case VSCSIBACK_OP_ADD_OR_DEL_LUN:
> - if (device_state == XenbusStateInitialising)
> - scsiback_do_add_lun(info, state, phy, &vir);
> - if (device_state == XenbusStateClosing)
> + switch (device_state) {
> + case XenbusStateInitialising:
> + scsiback_do_add_lun(info, state, phy, &vir, 0);
> + break;
> + case XenbusStateConnected:
> + scsiback_do_add_lun(info, state, phy, &vir, 1);
> + break;
> + case XenbusStateClosing:
> scsiback_do_del_lun(info, state, &vir);
> + break;
> + default:
> + break;
> + }
> break;
>
> case VSCSIBACK_OP_UPDATEDEV_STATE:
>
next prev parent reply other threads:[~2015-02-18 17:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-17 7:02 [PATCH V2 0/3] xen: pvscsi: avoid race, support suspend/resume Juergen Gross
2015-02-17 7:02 ` [PATCH V2 1/3] xen: mark pvscsi frontend request consumed only after last read Juergen Gross
2015-02-20 13:52 ` [Xen-devel] " David Vrabel
2015-02-17 7:02 ` [PATCH V2 2/3] xen: scsiback: add LUN of restored domain Juergen Gross
2015-02-18 17:02 ` Boris Ostrovsky [this message]
2015-02-24 6:06 ` Juergen Gross
2015-02-24 15:12 ` Boris Ostrovsky
2015-03-16 14:49 ` [Xen-devel] " David Vrabel
2015-02-17 7:02 ` [PATCH V2 3/3] xen: support suspend/resume in pvscsi frontend Juergen Gross
2015-03-16 14:50 ` [Xen-devel] " David Vrabel
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=54E4C5A8.9070109@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=david.vrabel@citrix.com \
--cc=jgross@suse.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xen-devel@lists.xensource.com \
/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