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

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

[S390] cio: disallow online setting of device in transient state



Return -EAGAIN on writes to sysfs online attribute if the corresponding
ccw device is in transient state.

Signed-off-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 47593bfa
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -515,7 +515,11 @@ static ssize_t online_store (struct device *dev, struct device_attribute *attr,
	int force, ret;
	unsigned long i;

	if (atomic_cmpxchg(&cdev->private->onoff, 0, 1) != 0)
	if ((cdev->private->state != DEV_STATE_OFFLINE &&
	     cdev->private->state != DEV_STATE_ONLINE &&
	     cdev->private->state != DEV_STATE_BOXED &&
	     cdev->private->state != DEV_STATE_DISCONNECTED) ||
	    atomic_cmpxchg(&cdev->private->onoff, 0, 1) != 0)
		return -EAGAIN;

	if (cdev->drv && !try_module_get(cdev->drv->owner)) {