Skip to content

Commit a23aced

Browse files
jtlaytongregkh
authored andcommitted
ceph: clean up locking annotation for ceph_get_snap_realm and __lookup_snap_realm
commit df2c0cb 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>
1 parent b0efc93 commit a23aced

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

fs/ceph/snap.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@
6060
/*
6161
* increase ref count for the realm
6262
*
63-
* caller must hold snap_rwsem for write.
63+
* caller must hold snap_rwsem.
6464
*/
6565
void ceph_get_snap_realm(struct ceph_mds_client *mdsc,
6666
struct ceph_snap_realm *realm)
6767
{
68-
lockdep_assert_held_write(&mdsc->snap_rwsem);
68+
lockdep_assert_held(&mdsc->snap_rwsem);
6969

7070
dout("get_realm %p %d -> %d\n", realm,
7171
atomic_read(&realm->nref), atomic_read(&realm->nref)+1);
@@ -139,15 +139,15 @@ static struct ceph_snap_realm *ceph_create_snap_realm(
139139
/*
140140
* lookup the realm rooted at @ino.
141141
*
142-
* caller must hold snap_rwsem for write.
142+
* caller must hold snap_rwsem.
143143
*/
144144
static struct ceph_snap_realm *__lookup_snap_realm(struct ceph_mds_client *mdsc,
145145
u64 ino)
146146
{
147147
struct rb_node *n = mdsc->snap_realms.rb_node;
148148
struct ceph_snap_realm *r;
149149

150-
lockdep_assert_held_write(&mdsc->snap_rwsem);
150+
lockdep_assert_held(&mdsc->snap_rwsem);
151151

152152
while (n) {
153153
r = rb_entry(n, struct ceph_snap_realm, node);

0 commit comments

Comments
 (0)