ceph: unlock dangling spinlock in try_flush_caps
PATCH 1/1 ceph: unlock dangling spinlock in try_flush_caps
From: Jeff Layton <[email protected]>
sparose 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.
--- fs/ceph/caps.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/ceph/caps.c +4 -1
@@ -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 @@ static int try_flush_caps(struct inode *inode, u64 *ptid)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);
Signature · 1 line
2.13.6
Quoted 44 lines · Jeff Layton
From: Jeff Layton <[email protected]>
sparose warns:
fs/ceph/caps.c:2042:9: warning: context imbalance in 'try_flush_caps' - wrong count at exitWe need to exit this function with the lock unlocked, but a couple of cases leave it locked.
Signed-off-by Jeff Layton <[email protected]>---
fs/ceph/caps.c| 5 ++++-1 file changed, 4 insertions(+), 1 deletion(-)fs/ceph/caps.c +0
-0@@ -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) {fs/ceph/caps.c +1
-0+spin_unlock (&ci->i_ceph_lock);dout("try_flush_caps skipping %p I_NOFLUSH set\n", inode); goto out; }fs/ceph/caps.c +3
-1@@ -2008,8 +2009,10 @@ static int try_flush_caps(struct inode *inode, u64 *ptid)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);Signature · 1 line
2.13.6
good catch
Quoted 28 lines · Jeff Layton
From: Jeff Layton <[email protected]>
sparose warns:
fs/ceph/caps.c:2042:9: warning: context imbalance in 'try_flush_caps' - wrong count at exitWe need to exit this function with the lock unlocked, but a couple of cases leave it locked.
Signed-off-by Jeff Layton <[email protected]>--- fs/ceph/caps.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/ceph/caps.c +1
-0@@ -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 @@ static int try_flush_caps(struct inode *inode, u64 *ptid)mutex_lock (&session->s_mutex);
fs/ceph/caps.c static int try_flush_caps(struct inode *inode, u64 *ptid) · line 2018
Quoted 10 lines
fs/ceph/caps.c +3
-1goto 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);
Applied.
Thanks,
Ilya