summaryrefslogtreecommitdiffstats
path: root/fs/binfmt_em86.c
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2021-07-03 11:31:26 +0200
committerIlya Dryomov <idryomov@gmail.com>2021-07-20 17:57:33 +0200
commited9eb71085ecb7ded9a5118cec2ab70667cc7350 (patch)
treedfd2877b2a298b43ef8415f8317a00f8e6dbb00f /fs/binfmt_em86.c
parent8798d070d416d18a75770fc19787e96705073f43 (diff)
downloadlinux-ed9eb71085ecb7ded9a5118cec2ab70667cc7350.tar.gz
linux-ed9eb71085ecb7ded9a5118cec2ab70667cc7350.tar.bz2
linux-ed9eb71085ecb7ded9a5118cec2ab70667cc7350.zip
rbd: don't hold lock_rwsem while running_list is being drained
Currently rbd_quiesce_lock() holds lock_rwsem for read while blocking on releasing_wait completion. On the I/O completion side, each image request also needs to take lock_rwsem for read. Because rw_semaphore implementation doesn't allow new readers after a writer has indicated interest in the lock, this can result in a deadlock if something that needs to take lock_rwsem for write gets involved. For example: 1. watch error occurs 2. rbd_watch_errcb() takes lock_rwsem for write, clears owner_cid and releases lock_rwsem 3. after reestablishing the watch, rbd_reregister_watch() takes lock_rwsem for write and calls rbd_reacquire_lock() 4. rbd_quiesce_lock() downgrades lock_rwsem to for read and blocks on releasing_wait until running_list becomes empty 5. another watch error occurs 6. rbd_watch_errcb() blocks trying to take lock_rwsem for write 7. no in-flight image request can complete and delete itself from running_list because lock_rwsem won't be granted anymore A similar scenario can occur with "lock has been acquired" and "lock has been released" notification handers which also take lock_rwsem for write to update owner_cid. We don't actually get anything useful from sitting on lock_rwsem in rbd_quiesce_lock() -- owner_cid updates certainly don't need to be synchronized with. In fact the whole owner_cid tracking logic could probably be removed from the kernel client because we don't support proxied maintenance operations. Cc: stable@vger.kernel.org # 5.3+ URL: https://tracker.ceph.com/issues/42757 Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Tested-by: Robin Geuze <robin.geuze@nl.team.blue>
Diffstat (limited to 'fs/binfmt_em86.c')
0 files changed, 0 insertions, 0 deletions