summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@kernel.org>2021-06-01 09:24:38 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-08-18 08:59:18 +0200
commita23aced54c2c9053a0956fc1a8a6d7c0a0fff96f (patch)
tree84d93c5ff66f14c5e8ca208e21d2c5259bc1b804 /fs
parentb0efc93271caf3868885a953f7f71c3aced7ba61 (diff)
downloadlinux-stable-a23aced54c2c9053a0956fc1a8a6d7c0a0fff96f.tar.gz
linux-stable-a23aced54c2c9053a0956fc1a8a6d7c0a0fff96f.tar.bz2
linux-stable-a23aced54c2c9053a0956fc1a8a6d7c0a0fff96f.zip
ceph: clean up locking annotation for ceph_get_snap_realm and __lookup_snap_realm
commit df2c0cb7f8e8c83e495260ad86df8c5da947f2a7 upstream. They both say that the snap_rwsem must be held for write, but I don't see any real reason for it, and it's not currently always called that way. The lookup is just walking the rbtree, so holding it for read should be fine there. The "get" is bumping the refcount and (possibly) removing it from the empty list. I see no need to hold the snap_rwsem for write for that. Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ceph/snap.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
index f9278d35db57..1bee6aeee913 100644
--- a/fs/ceph/snap.c
+++ b/fs/ceph/snap.c
@@ -60,12 +60,12 @@
/*
* increase ref count for the realm
*
- * caller must hold snap_rwsem for write.
+ * caller must hold snap_rwsem.
*/
void ceph_get_snap_realm(struct ceph_mds_client *mdsc,
struct ceph_snap_realm *realm)
{
- lockdep_assert_held_write(&mdsc->snap_rwsem);
+ lockdep_assert_held(&mdsc->snap_rwsem);
dout("get_realm %p %d -> %d\n", realm,
atomic_read(&realm->nref), atomic_read(&realm->nref)+1);
@@ -139,7 +139,7 @@ static struct ceph_snap_realm *ceph_create_snap_realm(
/*
* lookup the realm rooted at @ino.
*
- * caller must hold snap_rwsem for write.
+ * caller must hold snap_rwsem.
*/
static struct ceph_snap_realm *__lookup_snap_realm(struct ceph_mds_client *mdsc,
u64 ino)
@@ -147,7 +147,7 @@ static struct ceph_snap_realm *__lookup_snap_realm(struct ceph_mds_client *mdsc,
struct rb_node *n = mdsc->snap_realms.rb_node;
struct ceph_snap_realm *r;
- lockdep_assert_held_write(&mdsc->snap_rwsem);
+ lockdep_assert_held(&mdsc->snap_rwsem);
while (n) {
r = rb_entry(n, struct ceph_snap_realm, node);