From: Jeff Layton Date: Wed, 24 Apr 2019 14:05:39 +0000 (-0400) Subject: ceph: just call get_session in __ceph_lookup_mds_session X-Git-Tag: v5.4-rc1~952^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=488f5284e29b2dbb7c224d51b56fc20348e73735;p=platform%2Fkernel%2Flinux-rpi.git 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 Reviewed-by: "Yan, Zheng" Signed-off-by: Ilya Dryomov --- diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 0026ca0..5f3f375 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) struct ceph_mds_session *__ceph_lookup_mds_session(struct ceph_mds_client *mdsc, int mds) { - struct ceph_mds_session *session; - if (mds >= mdsc->max_sessions || !mdsc->sessions[mds]) return NULL; - session = mdsc->sessions[mds]; - dout("lookup_mds_session %p %d\n", session, - refcount_read(&session->s_ref)); - get_session(session); - return session; + return get_session(mdsc->sessions[mds]); } static bool __have_session(struct ceph_mds_client *mdsc, int mds)