block/swim3: Fix -EBUSY error when re-opening device after unmount
commit41c8920c515619cd77e15f7ea3a97f52ae83aec6
authorFinn Thain <fthain@telegraphics.com.au>
Mon, 31 Dec 2018 05:44:09 +0000 (31 16:44 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Feb 2019 19:02:30 +0000 (12 20:02 +0100)
tree2bab9c8da86b3271b4cdfc843302165ad8f052db
parentf48987c8a42ab27857c31d3755cf27f05095cc20
block/swim3: Fix -EBUSY error when re-opening device after unmount

[ Upstream commit 296dcc40f2f2e402facf7cd26cf3f2c8f4b17d47 ]

When the block device is opened with FMODE_EXCL, ref_count is set to -1.
This value doesn't get reset when the device is closed which means the
device cannot be opened again. Fix this by checking for refcount <= 0
in the release method.

Reported-and-tested-by: Stan Johnson <userm57@yahoo.com>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/block/swim3.c