Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9bf05098 authored by Sebastian Ott's avatar Sebastian Ott Committed by Martin Schwidefsky
Browse files

[S390] cio: fix unreg race in set_online path



In ccw_device_set_online we basically start path verification and
wait for the device to reach a final state. If it turns out that the
device has no useable path we schedule the deregistration of the
device (which is still in an non-final state) and wake up the waiting
process. The deregistration process will set a final state, but if
the wake up happens to be prior to this, the device will hang forever
in ccw_device_set_online.

To fix this just set the final NOT_OPER state prior to the scheduled
deregistration of the device.

Signed-off-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent caebc160
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -408,9 +408,10 @@ ccw_device_done(struct ccw_device *cdev, int state)
		CIO_MSG_EVENT(0, "Disconnected device %04x on subchannel "
		CIO_MSG_EVENT(0, "Disconnected device %04x on subchannel "
			      "%04x\n", cdev->private->dev_id.devno,
			      "%04x\n", cdev->private->dev_id.devno,
			      sch->schid.sch_no);
			      sch->schid.sch_no);
		if (ccw_device_notify(cdev, CIO_NO_PATH) != NOTIFY_OK)
		if (ccw_device_notify(cdev, CIO_NO_PATH) != NOTIFY_OK) {
			cdev->private->state = DEV_STATE_NOT_OPER;
			ccw_device_sched_todo(cdev, CDEV_TODO_UNREG);
			ccw_device_sched_todo(cdev, CDEV_TODO_UNREG);
		else
		} else
			ccw_device_set_disconnected(cdev);
			ccw_device_set_disconnected(cdev);
		cdev->private->flags.donotify = 0;
		cdev->private->flags.donotify = 0;
		break;
		break;