Whamcloud - gitweb
if client_disconnect_export was called without force flag set,
[fs/lustre-release.git] / lustre / obdclass / obd_mount.c
index 29d5022..a09dc36 100644 (file)
@@ -40,6 +40,7 @@
 #include <lustre_param.h>
 
 static int (*client_fill_super)(struct super_block *sb) = NULL;
+static void (*kill_super_cb)(struct super_block *sb) = NULL;
 
 /*********** mount lookup *********/
 
@@ -749,8 +750,8 @@ static int lustre_stop_mgc(struct super_block *sb)
 {
         struct lustre_sb_info *lsi = s2lsi(sb);
         struct obd_device *obd;
-        char *niduuid, *ptr = 0;
-        int i, rc = 0, len;
+        char *niduuid = 0, *ptr = 0;
+        int i, rc = 0, len = 0;
         ENTRY;
 
         if (!lsi)
@@ -769,11 +770,8 @@ static int lustre_stop_mgc(struct super_block *sb)
                 GOTO(out, rc = -EBUSY);
         }
 
-        /* MGC must always stop */
-        obd->obd_force = 1;
-        /* client_disconnect_export uses the no_recov flag to decide whether it
-           should disconnect or just invalidate.  (The MGC has no
-           recoverable data in any case.) */
+        /* The MGC has no recoverable data in any case. 
+         * force shotdown set in umount_begin */
         obd->obd_no_recov = 1;
 
         if (obd->u.cli.cl_mgc_mgsexp)
@@ -1193,7 +1191,7 @@ out_mgc:
                 }
 
                 /* log has been fully processed */
-                obd_notify(obd, NULL, OBD_NOTIFY_CONFIG, 0);
+                obd_notify(obd, NULL, OBD_NOTIFY_CONFIG, (void *)CONFIG_LOG);
         }
 
         RETURN(rc);
@@ -1304,6 +1302,7 @@ static struct vfsmount *server_kernel_mount(struct super_block *sb)
         struct vfsmount *mnt;
         char *options = NULL;
         unsigned long page, s_flags;
+        struct page *__page;
         int rc;
         ENTRY;
 
@@ -1320,25 +1319,10 @@ static struct vfsmount *server_kernel_mount(struct super_block *sb)
         mnt = ll_kern_mount("ldiskfs", s_flags, lmd->lmd_dev, 0);
         if (IS_ERR(mnt)) {
                 rc = PTR_ERR(mnt);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
-                /* 2.6 kernels: if ldiskfs fails, try ldiskfs2 */
-                mnt = ll_kern_mount("ldiskfs2", s_flags, lmd->lmd_dev, 0);
-                if (IS_ERR(mnt)) {
-                        int rc2 = PTR_ERR(mnt);
-                        CERROR("premount %s:%#lx ldiskfs failed: %d, ldiskfs2 "
-                               "failed: %d.  Is the ldiskfs module available?\n",
-                               lmd->lmd_dev, s_flags, rc, rc2);
-                        GOTO(out_free, rc);
-                }
-#else
-                /* 2.4 kernels: if ldiskfs fails, try ext3 */
-                mnt = ll_kern_mount("ext3", s_flags, lmd->lmd_dev, 0);
-                if (IS_ERR(mnt)) {
-                        rc = PTR_ERR(mnt);
-                        CERROR("premount ext3 failed: rc = %d\n", rc);
-                        GOTO(out_free, rc);
-                }
-#endif
+                CERROR("premount %s:%#lx ldiskfs failed: %d "
+                        "Is the ldiskfs module available?\n",
+                        lmd->lmd_dev, s_flags, rc );
+                GOTO(out_free, rc);
         }
 
         OBD_SET_CTXT_MAGIC(&mount_ctxt);
@@ -1357,9 +1341,10 @@ static struct vfsmount *server_kernel_mount(struct super_block *sb)
         /* Done with our pre-mount, now do the real mount. */
 
         /* Glom up mount options */
-        page = __get_free_page(GFP_KERNEL);
-        if (!page)
+        OBD_PAGE_ALLOC(__page, CFS_ALLOC_STD);
+        if (!__page)
                 GOTO(out_free, rc = -ENOMEM);
+        page = (unsigned long)cfs_page_address(__page);
 
         options = (char *)page;
         memset(options, 0, CFS_PAGE_SIZE);
@@ -1381,7 +1366,7 @@ static struct vfsmount *server_kernel_mount(struct super_block *sb)
                MT_STR(ldd), lmd->lmd_dev, options);
         mnt = ll_kern_mount(MT_STR(ldd), s_flags, lmd->lmd_dev,
                             (void *)options);
-        free_page(page);
+        OBD_PAGE_FREE(__page);
         if (IS_ERR(mnt)) {
                 rc = PTR_ERR(mnt);
                 CERROR("ll_kern_mount failed: rc = %d\n", rc);
@@ -1402,7 +1387,7 @@ static void server_wait_finished(struct vfsmount *mnt)
 {
         wait_queue_head_t   waitq;
         struct l_wait_info  lwi;
-        int                 retries = 120;
+        int                 retries = 330;
 
         init_waitqueue_head(&waitq);
 
@@ -1460,12 +1445,10 @@ static void server_put_super(struct super_block *sb)
                 obd = class_name2obd(lsi->lsi_ldd->ldd_svname);
                 if (obd) {
                         CDEBUG(D_MOUNT, "stopping %s\n", obd->obd_name);
-                        if (lsi->lsi_flags & LSI_UMOUNT_FORCE)
-                                obd->obd_force = 1;
                         if (lsi->lsi_flags & LSI_UMOUNT_FAILOVER)
                                 obd->obd_fail = 1;
                         /* We can't seem to give an error return code
-                           to .put_super, so we better make sure we clean up! */
+                         * to .put_super, so we better make sure we clean up! */
                         obd->obd_force = 1;
                         class_manual_cleanup(obd);
                 } else {
@@ -2113,10 +2096,13 @@ void lustre_register_client_fill_super(int (*cfs)(struct super_block *sb))
         client_fill_super = cfs;
 }
 
+void lustre_register_kill_super_cb(void (*cfs)(struct super_block *sb))
+{
+        kill_super_cb = cfs;
+}
+
 /***************** FS registration ******************/
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
-/* 2.5 and later */
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18))
 struct super_block * lustre_get_sb(struct file_system_type *fs_type,
                                int flags, const char *devname, void * data)
@@ -2138,35 +2124,23 @@ int lustre_get_sb(struct file_system_type *fs_type,
 }
 #endif
 
-struct file_system_type lustre_fs_type = {
-        .owner        = THIS_MODULE,
-        .name         = "lustre",
-        .get_sb       = lustre_get_sb,
-        .kill_sb      = kill_anon_super,
-        .fs_flags     = FS_BINARY_MOUNTDATA,
-};
-
-#else
-/* 2.4 */
-static struct super_block *lustre_read_super(struct super_block *sb,
-                                             void *data, int silent)
+void lustre_kill_super(struct super_block *sb)
 {
-        int rc;
-        ENTRY;
+        struct lustre_sb_info *lsi = s2lsi(sb);
 
-        rc = lustre_fill_super(sb, data, silent);
-        if (rc)
-                RETURN(NULL);
-        RETURN(sb);
+        if (kill_super_cb && lsi &&(lsi->lsi_flags & LSI_SERVER))
+                (*kill_super_cb)(sb);
+
+        kill_anon_super(sb);
 }
 
-static struct file_system_type lustre_fs_type = {
-        .owner          = THIS_MODULE,
-        .name           = "lustre",
-        .fs_flags       = FS_NFSEXP_FSID,
-        .read_super     = lustre_read_super,
+struct file_system_type lustre_fs_type = {
+        .owner        = THIS_MODULE,
+        .name         = "lustre",
+        .get_sb       = lustre_get_sb,
+        .kill_sb      = lustre_kill_super,
+        .fs_flags     = FS_BINARY_MOUNTDATA | FS_REQUIRES_DEV,
 };
-#endif
 
 int lustre_register_fs(void)
 {
@@ -2179,6 +2153,7 @@ int lustre_unregister_fs(void)
 }
 
 EXPORT_SYMBOL(lustre_register_client_fill_super);
+EXPORT_SYMBOL(lustre_register_kill_super_cb);
 EXPORT_SYMBOL(lustre_common_put_super);
 EXPORT_SYMBOL(lustre_process_log);
 EXPORT_SYMBOL(lustre_end_log);