aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorJeff Layton <jlayton@kernel.org>2019-04-24 10:05:39 -0400
committerIlya Dryomov <idryomov@gmail.com>2019-05-07 13:22:38 -0400
commit488f5284e29b2dbb7c224d51b56fc20348e73735 (patch)
tree78d4778770179e78350624efff6841ff5dd41d0e /fs/ceph
parent1199d7da2d29dac5e3983ea1078dbd4ab107e33f (diff)
ceph: just call get_session in __ceph_lookup_mds_session
I originally thought there was a potential race here, but the fact that this is called with the mdsc->mutex held, ensures that the last reference to the session can't be put here. Still, it's clearer to just return the value from get_session here, and may prevent a bug later if we ever rework this code to be less reliant on mutexes. Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: "Yan, Zheng" <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/mds_client.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 0026ca094e22..5f3f375cf0e9 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -550,15 +550,9 @@ void ceph_put_mds_session(struct ceph_mds_session *s)
550struct ceph_mds_session *__ceph_lookup_mds_session(struct ceph_mds_client *mdsc, 550struct ceph_mds_session *__ceph_lookup_mds_session(struct ceph_mds_client *mdsc,
551 int mds) 551 int mds)
552{ 552{
553 struct ceph_mds_session *session;
554
555 if (mds >= mdsc->max_sessions || !mdsc->sessions[mds]) 553 if (mds >= mdsc->max_sessions || !mdsc->sessions[mds])
556 return NULL; 554 return NULL;
557 session = mdsc->sessions[mds]; 555 return get_session(mdsc->sessions[mds]);
558 dout("lookup_mds_session %p %d\n", session,
559 refcount_read(&session->s_ref));
560 get_session(session);
561 return session;
562} 556}
563 557
564static bool __have_session(struct ceph_mds_client *mdsc, int mds) 558static bool __have_session(struct ceph_mds_client *mdsc, int mds)