Skip to content

Commit 0449a35

Browse files
jtlaytonidryomov
authored andcommitted
ceph: don't take s_mutex in try_flush_caps
The s_mutex doesn't protect anything in this codepath. Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Luis Henriques <lhenriques@suse.de> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent 6a92b08 commit 0449a35

1 file changed

Lines changed: 2 additions & 14 deletions

File tree

fs/ceph/caps.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2146,26 +2146,17 @@ static int try_flush_caps(struct inode *inode, u64 *ptid)
21462146
{
21472147
struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
21482148
struct ceph_inode_info *ci = ceph_inode(inode);
2149-
struct ceph_mds_session *session = NULL;
21502149
int flushing = 0;
21512150
u64 flush_tid = 0, oldest_flush_tid = 0;
21522151

2153-
retry:
21542152
spin_lock(&ci->i_ceph_lock);
21552153
retry_locked:
21562154
if (ci->i_dirty_caps && ci->i_auth_cap) {
21572155
struct ceph_cap *cap = ci->i_auth_cap;
21582156
struct cap_msg_args arg;
2157+
struct ceph_mds_session *session = cap->session;
21592158

2160-
if (session != cap->session) {
2161-
spin_unlock(&ci->i_ceph_lock);
2162-
if (session)
2163-
mutex_unlock(&session->s_mutex);
2164-
session = cap->session;
2165-
mutex_lock(&session->s_mutex);
2166-
goto retry;
2167-
}
2168-
if (cap->session->s_state < CEPH_MDS_SESSION_OPEN) {
2159+
if (session->s_state < CEPH_MDS_SESSION_OPEN) {
21692160
spin_unlock(&ci->i_ceph_lock);
21702161
goto out;
21712162
}
@@ -2202,9 +2193,6 @@ static int try_flush_caps(struct inode *inode, u64 *ptid)
22022193
spin_unlock(&ci->i_ceph_lock);
22032194
}
22042195
out:
2205-
if (session)
2206-
mutex_unlock(&session->s_mutex);
2207-
22082196
*ptid = flush_tid;
22092197
return flushing;
22102198
}

0 commit comments

Comments
 (0)