Skip to content

Commit

Permalink
[S390] cio: disallow online setting of device in transient state
Browse files Browse the repository at this point in the history
Return -EAGAIN on writes to sysfs online attribute if the corresponding
ccw device is in transient state.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Sebastian Ott authored and Martin Schwidefsky committed Mar 31, 2009
1 parent 47593bf commit b5cd99e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/s390/cio/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit b5cd99e

Please sign in to comment.