]> git.baikalelectronics.ru Git - kernel.git/commit
[S390] dasd: fix refcounting in dasd_change_state
authorSebastian Ott <sebott@linux.vnet.ibm.com>
Mon, 22 Jun 2009 10:08:21 +0000 (12:08 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Mon, 22 Jun 2009 10:08:23 +0000 (12:08 +0200)
commitb40c90816b227758fb535bc8c997007f28b51f74
tree9962496049dad3c4ed5695d09886d0804be51462
parentf2cc7aa5d7869fcec1fe6eaf4b8f378ea8004b65
[S390] dasd: fix refcounting in dasd_change_state

To set a dasd online dasd_change_state is called twice. The first
cycle will schedule initial analysis of the device, set the rc to
-EAGAIN and will not touch the device state any more.
The initial analysis will in turn call dasd_change_state to increase
the state to the final DASD_STATE_ONLINE.

If the dasd_change_state on the second thread outruns the other one
both finish with the state set to DASD_STATE_ONLINE and the device
refcount will be decreased by 2.

Fix this by leaving dasd_change_state on rc == -EAGAIN so that the
refcount will always be decreased by 1.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/block/dasd.c