提交 a6369741 编写于 作者: S Sage Weil

ceph: fix comments, locking in destroy_inode

The destroy_inode path needs no inode locks since there are no
inode references.  Update __ceph_remove_cap comment to reflect
that it is called without cap->session->s_mutex in this case.
Signed-off-by: NSage Weil <sage@newdream.net>
上级 4ce1e9ad
...@@ -856,8 +856,8 @@ static int __ceph_is_any_caps(struct ceph_inode_info *ci) ...@@ -856,8 +856,8 @@ static int __ceph_is_any_caps(struct ceph_inode_info *ci)
} }
/* /*
* caller should hold i_lock, and session s_mutex. * caller should hold i_lock.
* returns true if this is the last cap. if so, caller should iput. * caller will not hold session s_mutex if called from destroy_inode.
*/ */
void __ceph_remove_cap(struct ceph_cap *cap) void __ceph_remove_cap(struct ceph_cap *cap)
{ {
...@@ -974,15 +974,14 @@ static int send_cap_msg(struct ceph_mds_session *session, ...@@ -974,15 +974,14 @@ static int send_cap_msg(struct ceph_mds_session *session,
} }
/* /*
* Queue cap releases when an inode is dropped from our * Queue cap releases when an inode is dropped from our cache. Since
* cache. * inode is about to be destroyed, there is no need for i_lock.
*/ */
void ceph_queue_caps_release(struct inode *inode) void ceph_queue_caps_release(struct inode *inode)
{ {
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
struct rb_node *p; struct rb_node *p;
spin_lock(&inode->i_lock);
p = rb_first(&ci->i_caps); p = rb_first(&ci->i_caps);
while (p) { while (p) {
struct ceph_cap *cap = rb_entry(p, struct ceph_cap, ci_node); struct ceph_cap *cap = rb_entry(p, struct ceph_cap, ci_node);
...@@ -1024,9 +1023,7 @@ void ceph_queue_caps_release(struct inode *inode) ...@@ -1024,9 +1023,7 @@ void ceph_queue_caps_release(struct inode *inode)
spin_unlock(&session->s_cap_lock); spin_unlock(&session->s_cap_lock);
p = rb_next(p); p = rb_next(p);
__ceph_remove_cap(cap); __ceph_remove_cap(cap);
} }
spin_unlock(&inode->i_lock);
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册