]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: make sync_fs wait on unsafe mds requests
authorSage Weil <sage@newdream.net>
Thu, 9 Jul 2009 19:00:17 +0000 (12:00 -0700)
committerSage Weil <sage@newdream.net>
Thu, 9 Jul 2009 19:00:17 +0000 (12:00 -0700)
src/TODO
src/kernel/mds_client.c

index 931da36903f44db290da20e3a7fcdf649c8b0eec..9efef53fa7d0a98c121e84cb44099f9c5b95a2ff 100644 (file)
--- a/src/TODO
+++ b/src/TODO
@@ -32,8 +32,7 @@ v0.10
 - osd bugfixes
 
 bugs
-09.07.08 11:18:33.628589 mds0.locker  NOT changing wanted p -> - (issue_seq 16 != last_issue 0)
-
+- kclient: lingering dirty caps on umount
 - premature filejournal trimming?
 
 later
@@ -81,6 +80,8 @@ repair
 - mds scrubbing
 
 kclient
+- make wait on cap flush smarter
+  - assign a tid to cap flush ops?
 - return EBADF on files without caps
 - fix up mds selection, and ESTALE handling
 - make cap import/export efficient
index 34346ce546c59d06f4aec5da51aecf6f9149ce05..3fc5444c2b18ecf2b7a604e1e2c91bfbb43aa960 100644 (file)
@@ -2535,10 +2535,45 @@ static int are_no_sync_caps(struct ceph_mds_client *mdsc)
        return num == 0;
 }
 
+/*
+ * wait for all write mds requests to flush.
+ */
+static void wait_unsafe_requests(struct ceph_mds_client *mdsc)
+{
+       struct ceph_mds_request *req;
+       u64 last_tid, next_tid;
+       int got;
+
+       mutex_lock(&mdsc->mutex);
+       last_tid = mdsc->last_tid;
+       dout(10, "wait_unsafe_requests last is %lld\n", last_tid);
+       while (1) {
+               got = radix_tree_gang_lookup(&mdsc->request_tree, (void **)&req,
+                                            next_tid, 1);
+               if (!got)
+                       break;
+               if (req->r_tid > last_tid)
+                       break;
+               if ((req->r_op & CEPH_MDS_OP_WRITE) == 0)
+                       continue;  /* not a write op */
+
+               next_tid = req->r_tid + 1;
+               ceph_mdsc_get_request(req);
+               mutex_unlock(&mdsc->mutex);
+               dout(10, "wait_unsafe_requests  wait on %llu (last is %llu)\n",
+                    req->r_tid, last_tid);
+               wait_for_completion(&req->r_safe_completion);
+               mutex_lock(&mdsc->mutex);
+               ceph_mdsc_put_request(req);
+       }
+       mutex_unlock(&mdsc->mutex);
+}
+
 void ceph_mdsc_sync(struct ceph_mds_client *mdsc)
 {
        dout(10, "sync\n");
        ceph_check_delayed_caps(mdsc);
+       wait_unsafe_requests(mdsc);
        wait_event(mdsc->cap_flushing_wq, are_no_sync_caps(mdsc));
 }