diff options
author | Jeff Layton <jlayton@redhat.com> | 2017-10-19 08:52:58 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2017-10-25 08:31:15 +0200 |
commit | 6c2838fbdedb9b72a81c931d49e56b229b6cdbca (patch) | |
tree | ee717ca5689cc898b7d7e9ac07739067dae2bf61 /fs/ceph/caps.c | |
parent | bb176f67090ca54869fc1262c913aa69d2ede070 (diff) | |
download | lwn-6c2838fbdedb9b72a81c931d49e56b229b6cdbca.tar.gz lwn-6c2838fbdedb9b72a81c931d49e56b229b6cdbca.zip |
ceph: unlock dangling spinlock in try_flush_caps()
sparse warns:
fs/ceph/caps.c:2042:9: warning: context imbalance in 'try_flush_caps' - wrong count at exit
We need to exit this function with the lock unlocked, but a couple of
cases leave it locked.
Cc: stable@vger.kernel.org
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r-- | fs/ceph/caps.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 157fe59fbabe..1978a8cb1cb1 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -1991,6 +1991,7 @@ static int try_flush_caps(struct inode *inode, u64 *ptid) retry: spin_lock(&ci->i_ceph_lock); if (ci->i_ceph_flags & CEPH_I_NOFLUSH) { + spin_unlock(&ci->i_ceph_lock); dout("try_flush_caps skipping %p I_NOFLUSH set\n", inode); goto out; } @@ -2008,8 +2009,10 @@ retry: mutex_lock(&session->s_mutex); goto retry; } - if (cap->session->s_state < CEPH_MDS_SESSION_OPEN) + if (cap->session->s_state < CEPH_MDS_SESSION_OPEN) { + spin_unlock(&ci->i_ceph_lock); goto out; + } flushing = __mark_caps_flushing(inode, session, true, &flush_tid, &oldest_flush_tid); |