]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
ceph: get snap_rwsem read lock in handle_cap_export for ceph_add_cap
authorNiels Dossche <dossche.niels@gmail.com>
Tue, 15 Mar 2022 15:29:47 +0000 (16:29 +0100)
committerJeff Layton <jlayton@kernel.org>
Fri, 29 Apr 2022 20:06:34 +0000 (16:06 -0400)
commitd8a208c7a8cdc3c48ddc915a4ef636b53c8d57b3
tree3df0c6e437d9039416e743e85700e19f9bff7ca1
parent6b10d4d234b6088808274723426c164db011147e
ceph: get snap_rwsem read lock in handle_cap_export for ceph_add_cap

ceph_add_cap says in its function documentation that the caller should
hold the read lock on the session snap_rwsem. Furthermore, not only
ceph_add_cap needs that lock, when it calls to ceph_lookup_snap_realm it
eventually calls ceph_get_snap_realm which states via lockdep that
snap_rwsem needs to be held. handle_cap_export calls ceph_add_cap
without that mdsc->snap_rwsem held. Thus, since ceph_get_snap_realm
and ceph_add_cap both need the lock, the common place to acquire that
lock is inside handle_cap_export.

Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/caps.c