]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: munging up umount a bit, not real change tho
authorSage Weil <sage@newdream.net>
Thu, 1 May 2008 23:41:42 +0000 (16:41 -0700)
committerSage Weil <sage@newdream.net>
Thu, 1 May 2008 23:41:42 +0000 (16:41 -0700)
src/kernel/mds_client.c
src/kernel/mds_client.h
src/kernel/super.c

index 740e9a46c214f46f264aa19c0b7138a897aa2753..f42c2d20a5e7516ec3ffb76412ac1b755d083bea 100644 (file)
@@ -841,25 +841,6 @@ bad:
 }
 
 
-/*
- * drop all leases (and dentry refs) in preparation for umount
- */
-void ceph_mdsc_drop_leases(struct ceph_mds_client *mdsc)
-{
-       int i;
-       
-       spin_lock(&mdsc->lock);
-       for (i = 0; i < mdsc->max_sessions; i++) {
-               struct ceph_mds_session *session = __get_session(mdsc, i);
-               if (!session)
-                       continue;
-               spin_unlock(&mdsc->lock);
-               remove_session_leases(session);
-               spin_lock(&mdsc->lock);
-       }
-       spin_unlock(&mdsc->lock);
-}
-
 
 /* exported functions */
 
@@ -1862,6 +1843,38 @@ void ceph_mdsc_init(struct ceph_mds_client *mdsc, struct ceph_client *client)
        spin_lock_init(&mdsc->cap_delay_lock);
 }
 
+/*
+ * drop all leases (and dentry refs) in preparation for umount
+ */
+static void drop_leases(struct ceph_mds_client *mdsc)
+{
+       int i;
+       
+       spin_lock(&mdsc->lock);
+       for (i = 0; i < mdsc->max_sessions; i++) {
+               struct ceph_mds_session *session = __get_session(mdsc, i);
+               if (!session)
+                       continue;
+               spin_unlock(&mdsc->lock);
+               remove_session_leases(session);
+               spin_lock(&mdsc->lock);
+       }
+       spin_unlock(&mdsc->lock);
+}
+
+/*
+ * called before mount is ro, and before dentries are torn down.
+ * (hmm, does this still race with new lookups?)
+ */
+void ceph_mdsc_pre_umount(struct ceph_mds_client *mdsc)
+{
+       drop_leases(mdsc);
+       check_delayed_caps(mdsc);
+}
+
+/*
+ * called after sb is ro.
+ */
 void ceph_mdsc_stop(struct ceph_mds_client *mdsc)
 {
        struct ceph_mds_session *session;
@@ -1897,6 +1910,7 @@ void ceph_mdsc_stop(struct ceph_mds_client *mdsc)
        }
 
        spin_unlock(&mdsc->lock);
+       dout(10, "stopped\n");
 }
 
 
index d478c09bde2b9aeda017816379f187d06b17a838..9b62a30282b1ba45c09c6715b9b528845870fb69 100644 (file)
@@ -148,6 +148,6 @@ extern int __ceph_mdsc_send_cap(struct ceph_mds_client *mdsc,
                                struct ceph_mds_session *session,
                                struct ceph_inode_cap *cap,
                                int used, int wanted, int cancel_work);
-extern void ceph_mdsc_drop_leases(struct ceph_mds_client *mdsc);
+extern void ceph_mdsc_pre_umount(struct ceph_mds_client *mdsc);
 
 #endif
index d23dc53eb71df9a48c2177f06ea8f6970d0f61ea..5e47c52e58568e09713e783506275f1fb37a5f4d 100644 (file)
@@ -54,25 +54,22 @@ static int ceph_write_inode(struct inode *inode, int unused)
        return 0;
 }
 
-
-static void ceph_umount_start(struct ceph_client *cl)
+static void ceph_put_super(struct super_block *s)
 {
+       struct ceph_client *cl = ceph_client(s);
        int rc;
        int seconds = 15;
 
+       dout(30, "put_super\n");
        ceph_mdsc_stop(&cl->mdsc);
        ceph_monc_request_umount(&cl->monc);
+
        rc = wait_event_timeout(cl->mount_wq,
                                (cl->mount_state == CEPH_MOUNT_UNMOUNTED),
                                seconds*HZ);
        if (rc == 0)
                derr(0, "umount timed out after %d seconds\n", seconds);
-}
 
-static void ceph_put_super(struct super_block *s)
-{
-       dout(30, "ceph_put_super\n");
-       ceph_umount_start(ceph_client(s));
        return;
 }
 
@@ -891,7 +888,7 @@ static void ceph_kill_sb(struct super_block *s)
 {
        struct ceph_client *client = ceph_sb_to_client(s);
        dout(1, "kill_sb %p\n", s);
-       ceph_mdsc_drop_leases(&client->mdsc);
+       ceph_mdsc_pre_umount(&client->mdsc);
        kill_anon_super(s);    /* will call put_super after sb is r/o */
        ceph_destroy_client(client);
 }