Commit 78333233 authored by Jeff Layton's avatar Jeff Layton Committed by Ilya Dryomov

ceph: don't take i_ceph_lock in handle_cap_import

Just take it before calling it. This means we have to do a couple of
minor in-memory operations under the spinlock now, but those shouldn't
be an issue.
Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 7391fba2
...@@ -3805,7 +3805,6 @@ static void handle_cap_import(struct ceph_mds_client *mdsc, ...@@ -3805,7 +3805,6 @@ static void handle_cap_import(struct ceph_mds_client *mdsc,
struct ceph_mds_cap_peer *ph, struct ceph_mds_cap_peer *ph,
struct ceph_mds_session *session, struct ceph_mds_session *session,
struct ceph_cap **target_cap, int *old_issued) struct ceph_cap **target_cap, int *old_issued)
__acquires(ci->i_ceph_lock)
{ {
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
struct ceph_cap *cap, *ocap, *new_cap = NULL; struct ceph_cap *cap, *ocap, *new_cap = NULL;
...@@ -3830,14 +3829,13 @@ static void handle_cap_import(struct ceph_mds_client *mdsc, ...@@ -3830,14 +3829,13 @@ static void handle_cap_import(struct ceph_mds_client *mdsc,
dout("handle_cap_import inode %p ci %p mds%d mseq %d peer %d\n", dout("handle_cap_import inode %p ci %p mds%d mseq %d peer %d\n",
inode, ci, mds, mseq, peer); inode, ci, mds, mseq, peer);
retry: retry:
spin_lock(&ci->i_ceph_lock);
cap = __get_cap_for_mds(ci, mds); cap = __get_cap_for_mds(ci, mds);
if (!cap) { if (!cap) {
if (!new_cap) { if (!new_cap) {
spin_unlock(&ci->i_ceph_lock); spin_unlock(&ci->i_ceph_lock);
new_cap = ceph_get_cap(mdsc, NULL); new_cap = ceph_get_cap(mdsc, NULL);
spin_lock(&ci->i_ceph_lock);
goto retry; goto retry;
} }
cap = new_cap; cap = new_cap;
...@@ -4051,6 +4049,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, ...@@ -4051,6 +4049,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
} else { } else {
down_read(&mdsc->snap_rwsem); down_read(&mdsc->snap_rwsem);
} }
spin_lock(&ci->i_ceph_lock);
handle_cap_import(mdsc, inode, h, peer, session, handle_cap_import(mdsc, inode, h, peer, session,
&cap, &extra_info.issued); &cap, &extra_info.issued);
handle_cap_grant(inode, session, cap, handle_cap_grant(inode, session, cap,
......
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