Skip to content

Commit da0345d

Browse files
jtlaytongregkh
authored andcommitted
ceph: unlock dangling spinlock in try_flush_caps()
commit 6c2838fbdedb9b72a81c931d49e56b229b6cdbca upstream. 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. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5f1d33a commit da0345d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

fs/ceph/caps.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1850,6 +1850,7 @@ static int try_flush_caps(struct inode *inode, u64 *ptid)
18501850
retry:
18511851
spin_lock(&ci->i_ceph_lock);
18521852
if (ci->i_ceph_flags & CEPH_I_NOFLUSH) {
1853+
spin_unlock(&ci->i_ceph_lock);
18531854
dout("try_flush_caps skipping %p I_NOFLUSH set\n", inode);
18541855
goto out;
18551856
}
@@ -1867,8 +1868,10 @@ static int try_flush_caps(struct inode *inode, u64 *ptid)
18671868
mutex_lock(&session->s_mutex);
18681869
goto retry;
18691870
}
1870-
if (cap->session->s_state < CEPH_MDS_SESSION_OPEN)
1871+
if (cap->session->s_state < CEPH_MDS_SESSION_OPEN) {
1872+
spin_unlock(&ci->i_ceph_lock);
18711873
goto out;
1874+
}
18721875

18731876
flushing = __mark_caps_flushing(inode, session, &flush_tid,
18741877
&oldest_flush_tid);

0 commit comments

Comments
 (0)