|
@@ -654,10 +654,17 @@ static int scsifront_dev_reset_handler(struct scsi_cmnd *sc)
|
|
static int scsifront_sdev_configure(struct scsi_device *sdev)
|
|
static int scsifront_sdev_configure(struct scsi_device *sdev)
|
|
{
|
|
{
|
|
struct vscsifrnt_info *info = shost_priv(sdev->host);
|
|
struct vscsifrnt_info *info = shost_priv(sdev->host);
|
|
|
|
+ int err;
|
|
|
|
|
|
- if (info && current == info->curr)
|
|
|
|
- xenbus_printf(XBT_NIL, info->dev->nodename,
|
|
|
|
|
|
+ if (info && current == info->curr) {
|
|
|
|
+ err = xenbus_printf(XBT_NIL, info->dev->nodename,
|
|
info->dev_state_path, "%d", XenbusStateConnected);
|
|
info->dev_state_path, "%d", XenbusStateConnected);
|
|
|
|
+ if (err) {
|
|
|
|
+ xenbus_dev_error(info->dev, err,
|
|
|
|
+ "%s: writing dev_state_path", __func__);
|
|
|
|
+ return err;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -665,10 +672,15 @@ static int scsifront_sdev_configure(struct scsi_device *sdev)
|
|
static void scsifront_sdev_destroy(struct scsi_device *sdev)
|
|
static void scsifront_sdev_destroy(struct scsi_device *sdev)
|
|
{
|
|
{
|
|
struct vscsifrnt_info *info = shost_priv(sdev->host);
|
|
struct vscsifrnt_info *info = shost_priv(sdev->host);
|
|
|
|
+ int err;
|
|
|
|
|
|
- if (info && current == info->curr)
|
|
|
|
- xenbus_printf(XBT_NIL, info->dev->nodename,
|
|
|
|
|
|
+ if (info && current == info->curr) {
|
|
|
|
+ err = xenbus_printf(XBT_NIL, info->dev->nodename,
|
|
info->dev_state_path, "%d", XenbusStateClosed);
|
|
info->dev_state_path, "%d", XenbusStateClosed);
|
|
|
|
+ if (err)
|
|
|
|
+ xenbus_dev_error(info->dev, err,
|
|
|
|
+ "%s: writing dev_state_path", __func__);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
static struct scsi_host_template scsifront_sht = {
|
|
static struct scsi_host_template scsifront_sht = {
|
|
@@ -1003,9 +1015,12 @@ static void scsifront_do_lun_hotplug(struct vscsifrnt_info *info, int op)
|
|
|
|
|
|
if (scsi_add_device(info->host, chn, tgt, lun)) {
|
|
if (scsi_add_device(info->host, chn, tgt, lun)) {
|
|
dev_err(&dev->dev, "scsi_add_device\n");
|
|
dev_err(&dev->dev, "scsi_add_device\n");
|
|
- xenbus_printf(XBT_NIL, dev->nodename,
|
|
|
|
|
|
+ err = xenbus_printf(XBT_NIL, dev->nodename,
|
|
info->dev_state_path,
|
|
info->dev_state_path,
|
|
"%d", XenbusStateClosed);
|
|
"%d", XenbusStateClosed);
|
|
|
|
+ if (err)
|
|
|
|
+ xenbus_dev_error(dev, err,
|
|
|
|
+ "%s: writing dev_state_path", __func__);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case VSCSIFRONT_OP_DEL_LUN:
|
|
case VSCSIFRONT_OP_DEL_LUN:
|
|
@@ -1019,10 +1034,14 @@ static void scsifront_do_lun_hotplug(struct vscsifrnt_info *info, int op)
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case VSCSIFRONT_OP_READD_LUN:
|
|
case VSCSIFRONT_OP_READD_LUN:
|
|
- if (device_state == XenbusStateConnected)
|
|
|
|
- xenbus_printf(XBT_NIL, dev->nodename,
|
|
|
|
|
|
+ if (device_state == XenbusStateConnected) {
|
|
|
|
+ err = xenbus_printf(XBT_NIL, dev->nodename,
|
|
info->dev_state_path,
|
|
info->dev_state_path,
|
|
"%d", XenbusStateConnected);
|
|
"%d", XenbusStateConnected);
|
|
|
|
+ if (err)
|
|
|
|
+ xenbus_dev_error(dev, err,
|
|
|
|
+ "%s: writing dev_state_path", __func__);
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|