aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/caps.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-06-10 17:21:36 -0400
committerSage Weil <sage@newdream.net>2010-08-01 23:11:39 -0400
commitca81f3f6bd759f90a4b940cddda1f8bc61a7725a (patch)
tree77b0f3a45d48303246f26e85b3945916f388805a /fs/ceph/caps.c
parent3b454c4945c756686e91d77eeefac80cb5d21baf (diff)
ceph: skip if no auth cap in flush_snaps
If we have a capsnap but no auth cap (e.g. because it is migrating to another mds), bail out and do nothing for now. Do NOT remove the capsnap from the flush list. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r--fs/ceph/caps.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 82ffde618af0..dbf0d6a02a77 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -339,7 +339,7 @@ static struct ceph_cap *__get_cap_for_mds(struct ceph_inode_info *ci, int mds)
339/* 339/*
340 * Return id of any MDS with a cap, preferably FILE_WR|BUFFER|EXCL, else -1. 340 * Return id of any MDS with a cap, preferably FILE_WR|BUFFER|EXCL, else -1.
341 */ 341 */
342static int __ceph_get_cap_mds(struct ceph_inode_info *ci, u32 *mseq) 342static int __ceph_get_cap_mds(struct ceph_inode_info *ci)
343{ 343{
344 struct ceph_cap *cap; 344 struct ceph_cap *cap;
345 int mds = -1; 345 int mds = -1;
@@ -349,8 +349,6 @@ static int __ceph_get_cap_mds(struct ceph_inode_info *ci, u32 *mseq)
349 for (p = rb_first(&ci->i_caps); p; p = rb_next(p)) { 349 for (p = rb_first(&ci->i_caps); p; p = rb_next(p)) {
350 cap = rb_entry(p, struct ceph_cap, ci_node); 350 cap = rb_entry(p, struct ceph_cap, ci_node);
351 mds = cap->mds; 351 mds = cap->mds;
352 if (mseq)
353 *mseq = cap->mseq;
354 if (cap->issued & (CEPH_CAP_FILE_WR | 352 if (cap->issued & (CEPH_CAP_FILE_WR |
355 CEPH_CAP_FILE_BUFFER | 353 CEPH_CAP_FILE_BUFFER |
356 CEPH_CAP_FILE_EXCL)) 354 CEPH_CAP_FILE_EXCL))
@@ -363,7 +361,7 @@ int ceph_get_cap_mds(struct inode *inode)
363{ 361{
364 int mds; 362 int mds;
365 spin_lock(&inode->i_lock); 363 spin_lock(&inode->i_lock);
366 mds = __ceph_get_cap_mds(ceph_inode(inode), NULL); 364 mds = __ceph_get_cap_mds(ceph_inode(inode));
367 spin_unlock(&inode->i_lock); 365 spin_unlock(&inode->i_lock);
368 return mds; 366 return mds;
369} 367}
@@ -1231,7 +1229,13 @@ retry:
1231 BUG_ON(capsnap->dirty == 0); 1229 BUG_ON(capsnap->dirty == 0);
1232 1230
1233 /* pick mds, take s_mutex */ 1231 /* pick mds, take s_mutex */
1234 mds = __ceph_get_cap_mds(ci, &mseq); 1232 if (ci->i_auth_cap == NULL) {
1233 dout("no auth cap (migrating?), doing nothing\n");
1234 goto out;
1235 }
1236 mds = ci->i_auth_cap->session->s_mds;
1237 mseq = ci->i_auth_cap->mseq;
1238
1235 if (session && session->s_mds != mds) { 1239 if (session && session->s_mds != mds) {
1236 dout("oops, wrong session %p mutex\n", session); 1240 dout("oops, wrong session %p mutex\n", session);
1237 mutex_unlock(&session->s_mutex); 1241 mutex_unlock(&session->s_mutex);
@@ -1250,8 +1254,8 @@ retry:
1250 } 1254 }
1251 /* 1255 /*
1252 * if session == NULL, we raced against a cap 1256 * if session == NULL, we raced against a cap
1253 * deletion. retry, and we'll get a better 1257 * deletion or migration. retry, and we'll
1254 * @mds value next time. 1258 * get a better @mds value next time.
1255 */ 1259 */
1256 spin_lock(&inode->i_lock); 1260 spin_lock(&inode->i_lock);
1257 goto retry; 1261 goto retry;
@@ -1289,6 +1293,7 @@ retry:
1289 list_del_init(&ci->i_snap_flush_item); 1293 list_del_init(&ci->i_snap_flush_item);
1290 spin_unlock(&mdsc->snap_flush_lock); 1294 spin_unlock(&mdsc->snap_flush_lock);
1291 1295
1296out:
1292 if (psession) 1297 if (psession)
1293 *psession = session; 1298 *psession = session;
1294 else if (session) { 1299 else if (session) {