aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-02-22 16:59:00 -0500
committerSage Weil <sage@newdream.net>2010-02-23 17:26:35 -0500
commita6369741c48815fedfce7072b7a9cd98b5bafd56 (patch)
treedd9ce7da7a6c5556d6c7731423dff0824aad9545
parent4ce1e9adabbad8f2c45ceeeb6de56cc368484297 (diff)
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: Sage Weil <sage@newdream.net>
-rw-r--r--fs/ceph/caps.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 289f6c65a17e..b6154ffe70df 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -856,8 +856,8 @@ static int __ceph_is_any_caps(struct ceph_inode_info *ci)
856} 856}
857 857
858/* 858/*
859 * caller should hold i_lock, and session s_mutex. 859 * caller should hold i_lock.
860 * returns true if this is the last cap. if so, caller should iput. 860 * caller will not hold session s_mutex if called from destroy_inode.
861 */ 861 */
862void __ceph_remove_cap(struct ceph_cap *cap) 862void __ceph_remove_cap(struct ceph_cap *cap)
863{ 863{
@@ -974,15 +974,14 @@ static int send_cap_msg(struct ceph_mds_session *session,
974} 974}
975 975
976/* 976/*
977 * Queue cap releases when an inode is dropped from our 977 * Queue cap releases when an inode is dropped from our cache. Since
978 * cache. 978 * inode is about to be destroyed, there is no need for i_lock.
979 */ 979 */
980void ceph_queue_caps_release(struct inode *inode) 980void ceph_queue_caps_release(struct inode *inode)
981{ 981{
982 struct ceph_inode_info *ci = ceph_inode(inode); 982 struct ceph_inode_info *ci = ceph_inode(inode);
983 struct rb_node *p; 983 struct rb_node *p;
984 984
985 spin_lock(&inode->i_lock);
986 p = rb_first(&ci->i_caps); 985 p = rb_first(&ci->i_caps);
987 while (p) { 986 while (p) {
988 struct ceph_cap *cap = rb_entry(p, struct ceph_cap, ci_node); 987 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 spin_unlock(&session->s_cap_lock); 1023 spin_unlock(&session->s_cap_lock);
1025 p = rb_next(p); 1024 p = rb_next(p);
1026 __ceph_remove_cap(cap); 1025 __ceph_remove_cap(cap);
1027
1028 } 1026 }
1029 spin_unlock(&inode->i_lock);
1030} 1027}
1031 1028
1032/* 1029/*