Skip to content

Commit 169e6cf

Browse files
jgross1David Vrabel
authored andcommitted
xen: scsiback: add LUN of restored domain
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. Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
1 parent 7857487 commit 169e6cf

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

drivers/xen/xen-scsiback.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -990,15 +990,15 @@ static int scsiback_del_translation_entry(struct vscsibk_info *info,
990990
}
991991

992992
static void scsiback_do_add_lun(struct vscsibk_info *info, const char *state,
993-
char *phy, struct ids_tuple *vir)
993+
char *phy, struct ids_tuple *vir, int try)
994994
{
995995
if (!scsiback_add_translation_entry(info, phy, vir)) {
996996
if (xenbus_printf(XBT_NIL, info->dev->nodename, state,
997997
"%d", XenbusStateInitialised)) {
998998
pr_err("xenbus_printf error %s\n", state);
999999
scsiback_del_translation_entry(info, vir);
10001000
}
1001-
} else {
1001+
} else if (!try) {
10021002
xenbus_printf(XBT_NIL, info->dev->nodename, state,
10031003
"%d", XenbusStateClosed);
10041004
}
@@ -1058,10 +1058,19 @@ static void scsiback_do_1lun_hotplug(struct vscsibk_info *info, int op,
10581058

10591059
switch (op) {
10601060
case VSCSIBACK_OP_ADD_OR_DEL_LUN:
1061-
if (device_state == XenbusStateInitialising)
1062-
scsiback_do_add_lun(info, state, phy, &vir);
1063-
if (device_state == XenbusStateClosing)
1061+
switch (device_state) {
1062+
case XenbusStateInitialising:
1063+
scsiback_do_add_lun(info, state, phy, &vir, 0);
1064+
break;
1065+
case XenbusStateConnected:
1066+
scsiback_do_add_lun(info, state, phy, &vir, 1);
1067+
break;
1068+
case XenbusStateClosing:
10641069
scsiback_do_del_lun(info, state, &vir);
1070+
break;
1071+
default:
1072+
break;
1073+
}
10651074
break;
10661075

10671076
case VSCSIBACK_OP_UPDATEDEV_STATE:

0 commit comments

Comments
 (0)