ceph: don't leak snap_rwsem in handle_cap_grant
authorJeff Layton <jlayton@kernel.org>
Fri, 3 Jun 2022 20:39:57 +0000 (16:39 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:40:13 +0000 (11:40 +0200)
commitf546faa216d0f53a42ca73ba1fd8c48765b22d77
treeb6082f6aec01626c876a7ba0e301c547ec203ef0
parent3e7ee4dd1ea43831935c0af39302788d67397584
ceph: don't leak snap_rwsem in handle_cap_grant

commit 58dd4385577ed7969b80cdc9e2a31575aba6c712 upstream.

When handle_cap_grant is called on an IMPORT op, then the snap_rwsem is
held and the function is expected to release it before returning. It
currently fails to do that in all cases which could lead to a deadlock.

Fixes: 6f05b30ea063 ("ceph: reset i_requested_max_size if file write is not wanted")
Link: https://tracker.ceph.com/issues/55857
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Luís Henriques <lhenriques@suse.de>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ceph/caps.c