Commit 6c2838fb authored by Jeff Layton's avatar Jeff Layton Committed by Ilya Dryomov

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: default avatarJeff Layton <jlayton@redhat.com>
Reviewed-by: default avatar"Yan, Zheng" <zyan@redhat.com>
Reviewed-by: default avatarIlya Dryomov <idryomov@gmail.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent bb176f67
...@@ -1991,6 +1991,7 @@ static int try_flush_caps(struct inode *inode, u64 *ptid) ...@@ -1991,6 +1991,7 @@ static int try_flush_caps(struct inode *inode, u64 *ptid)
retry: retry:
spin_lock(&ci->i_ceph_lock); spin_lock(&ci->i_ceph_lock);
if (ci->i_ceph_flags & CEPH_I_NOFLUSH) { 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); dout("try_flush_caps skipping %p I_NOFLUSH set\n", inode);
goto out; goto out;
} }
...@@ -2008,8 +2009,10 @@ static int try_flush_caps(struct inode *inode, u64 *ptid) ...@@ -2008,8 +2009,10 @@ static int try_flush_caps(struct inode *inode, u64 *ptid)
mutex_lock(&session->s_mutex); mutex_lock(&session->s_mutex);
goto retry; 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; goto out;
}
flushing = __mark_caps_flushing(inode, session, true, flushing = __mark_caps_flushing(inode, session, true,
&flush_tid, &oldest_flush_tid); &flush_tid, &oldest_flush_tid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment