diff options
author | Yan, Zheng <zyan@redhat.com> | 2014-09-16 19:45:12 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@redhat.com> | 2014-10-14 13:03:39 -0400 |
commit | 6cd3bcad0d269f96667ea704d4f6459a5c6ccbab (patch) | |
tree | b1b9f47e26f0553902803e7e58d23a0a3d3b5b0b /fs/ceph/caps.c | |
parent | 508b32d8661b12da4c9ca41a9b2054e1dc92fa7e (diff) |
ceph: move ceph_find_inode() outside the s_mutex
ceph_find_inode() may wait on freeing inode, using it inside the s_mutex
may cause deadlock. (the freeing inode is waiting for OSD read reply, but
dispatch thread is blocked by the s_mutex)
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r-- | fs/ceph/caps.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 6d1cd45dca89..b3b0a913589f 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -3045,6 +3045,12 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
3045 | } | 3045 | } |
3046 | } | 3046 | } |
3047 | 3047 | ||
3048 | /* lookup ino */ | ||
3049 | inode = ceph_find_inode(sb, vino); | ||
3050 | ci = ceph_inode(inode); | ||
3051 | dout(" op %s ino %llx.%llx inode %p\n", ceph_cap_op_name(op), vino.ino, | ||
3052 | vino.snap, inode); | ||
3053 | |||
3048 | mutex_lock(&session->s_mutex); | 3054 | mutex_lock(&session->s_mutex); |
3049 | session->s_seq++; | 3055 | session->s_seq++; |
3050 | dout(" mds%d seq %lld cap seq %u\n", session->s_mds, session->s_seq, | 3056 | dout(" mds%d seq %lld cap seq %u\n", session->s_mds, session->s_seq, |
@@ -3053,11 +3059,6 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
3053 | if (op == CEPH_CAP_OP_IMPORT) | 3059 | if (op == CEPH_CAP_OP_IMPORT) |
3054 | ceph_add_cap_releases(mdsc, session); | 3060 | ceph_add_cap_releases(mdsc, session); |
3055 | 3061 | ||
3056 | /* lookup ino */ | ||
3057 | inode = ceph_find_inode(sb, vino); | ||
3058 | ci = ceph_inode(inode); | ||
3059 | dout(" op %s ino %llx.%llx inode %p\n", ceph_cap_op_name(op), vino.ino, | ||
3060 | vino.snap, inode); | ||
3061 | if (!inode) { | 3062 | if (!inode) { |
3062 | dout(" i don't have ino %llx\n", vino.ino); | 3063 | dout(" i don't have ino %llx\n", vino.ino); |
3063 | 3064 | ||