aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/mds_client.h
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-02-16 14:39:45 -0500
committerSage Weil <sage@newdream.net>2010-02-17 13:02:47 -0500
commit7c1332b8cb5b27656cf6ab1f5fe808a8eb8bb2c0 (patch)
treef990ab6b339a88896f41a6b3541d0676684c935d /fs/ceph/mds_client.h
parent85ccce43a3fc15a40ded6ae1603e3f68a17f4d24 (diff)
ceph: fix iterate_caps removal race
We need to be able to iterate over all caps on a session with a possibly slow callback on each cap. To allow this, we used to prevent cap reordering while we were iterating. However, we were not safe from races with removal: removing the 'next' cap would make the next pointer from list_for_each_entry_safe be invalid, and cause a lock up or similar badness. Instead, we keep an iterator pointer in the session pointing to the current cap. As before, we avoid reordering. For removal, if the cap isn't the current cap we are iterating over, we are fine. If it is, we clear cap->ci (to mark the cap as pending removal) but leave it in the session list. In iterate_caps, we can safely finish removal and get the next cap pointer. While we're at it, clean up put_cap to not take a cap reservation context, as it was never used. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/mds_client.h')
-rw-r--r--fs/ceph/mds_client.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h
index 9d6b90173879..961cc6f65878 100644
--- a/fs/ceph/mds_client.h
+++ b/fs/ceph/mds_client.h
@@ -114,7 +114,7 @@ struct ceph_mds_session {
114 int s_num_cap_releases; 114 int s_num_cap_releases;
115 struct list_head s_cap_releases; /* waiting cap_release messages */ 115 struct list_head s_cap_releases; /* waiting cap_release messages */
116 struct list_head s_cap_releases_done; /* ready to send */ 116 struct list_head s_cap_releases_done; /* ready to send */
117 bool s_iterating_caps; 117 struct ceph_cap *s_cap_iterator;
118 118
119 /* protected by mutex */ 119 /* protected by mutex */
120 struct list_head s_cap_flushing; /* inodes w/ flushing caps */ 120 struct list_head s_cap_flushing; /* inodes w/ flushing caps */