Whamcloud - gitweb
b=14230
[fs/lustre-release.git] / lustre / mdt / mdt_handler.c
index 34620b8..a19234b 100644 (file)
@@ -348,7 +348,7 @@ void mdt_pack_size2body(struct mdt_thread_info *info, struct mdt_object *o)
 {
         struct mdt_body *b;
         struct lu_attr *attr = &info->mti_attr.ma_attr;
-        
+
         b = req_capsule_server_get(info->mti_pill, &RMF_MDT_BODY);
 
         /* Check if Size-on-MDS is enabled. */
@@ -392,7 +392,7 @@ void mdt_pack_attr2body(struct mdt_thread_info *info, struct mdt_body *b,
                 b->ino  =  fid_oid(fid);       /* 1.6 compatibility */
                 b->generation = fid_ver(fid);  /* 1.6 compatibility */
                 b->valid |= OBD_MD_FLGENER;    /* 1.6 compatibility */
-                
+
                 CDEBUG(D_INODE, DFID": nlink=%d, mode=%o, size="LPU64"\n",
                                 PFID(fid), b->nlink, b->mode, b->size);
         }
@@ -778,7 +778,7 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info,
         if (name == NULL)
                 RETURN(err_serious(-EFAULT));
 
-        namelen = req_capsule_get_size(info->mti_pill, &RMF_NAME, 
+        namelen = req_capsule_get_size(info->mti_pill, &RMF_NAME,
                                        RCL_CLIENT) - 1;
         LASSERT(namelen >= 0);
 
@@ -1320,7 +1320,7 @@ static int mdt_writepage(struct mdt_thread_info *info)
 cleanup_lwi:
         OBD_FREE_PTR(lwi);
 cleanup_page:
-        __cfs_free_page(page);
+        cfs_free_page(page);
 desc_cleanup:
         ptlrpc_free_bulk(desc);
         RETURN(rc);
@@ -1381,7 +1381,7 @@ free_rdpg:
 
         for (i = 0; i < rdpg->rp_npages; i++)
                 if (rdpg->rp_pages[i] != NULL)
-                        __cfs_free_page(rdpg->rp_pages[i]);
+                        cfs_free_page(rdpg->rp_pages[i]);
         OBD_FREE(rdpg->rp_pages, rdpg->rp_npages * sizeof rdpg->rp_pages[0]);
 
         if (OBD_FAIL_CHECK(OBD_FAIL_MDS_SENDPAGE))
@@ -1489,6 +1489,12 @@ static int mdt_reint(struct mdt_thread_info *info)
 
         ENTRY;
 
+        if (OBD_FAIL_CHECK_RESET(OBD_FAIL_MDS_REINT_NET,
+                                 OBD_FAIL_MDS_REINT_NET)) {
+                info->mti_fail_id = OBD_FAIL_MDS_REINT_NET;
+                RETURN(0);
+        }
+
         opc = mdt_reint_opcode(info, reint_fmts);
         if (opc >= 0) {
                 /*
@@ -3514,14 +3520,37 @@ static void mdt_stack_fini(const struct lu_env *env,
 
         lu_site_purge(env, top->ld_site, ~0);
         while (d != NULL) {
-                struct obd_type *type;
                 struct lu_device_type *ldt = d->ld_type;
 
                 /* each fini() returns next device in stack of layers
-                 * so we can avoid the recursion */
+                 * so we can avoid the recursion */
                 n = ldt->ldt_ops->ldto_device_fini(env, d);
                 lu_device_put(d);
-                ldt->ldt_ops->ldto_device_free(env, d);
+
+                /* switch to the next device in the layer */
+                d = n;
+        }
+        /* purge again. */
+        lu_site_purge(env, top->ld_site, ~0);
+
+        if (!list_empty(&top->ld_site->ls_lru) || top->ld_site->ls_total != 0) {
+                /*
+                 * Uh-oh, objects still exist.
+                 */
+                static DECLARE_LU_CDEBUG_PRINT_INFO(cookie, D_ERROR);
+
+                lu_site_print(env, top->ld_site, &cookie, lu_cdebug_printer);
+        }
+
+        d = top;
+        while (d != NULL) {
+                struct obd_type *type;
+                struct lu_device_type *ldt = d->ld_type;
+
+                /* each free() returns next device in stack of layers
+                 * so we can avoid the recursion */
+                n = ldt->ldt_ops->ldto_device_free(env, d);
                 type = ldt->ldt_obd_type;
                 type->typ_refcnt--;
                 class_put_type(type);
@@ -3659,7 +3688,7 @@ static void mdt_fini(const struct lu_env *env, struct mdt_device *m)
         ENTRY;
 
         ping_evictor_stop();
-        
+
         target_recovery_fini(obd);
         mdt_stop_ptlrpc_service(m);
 
@@ -3690,15 +3719,6 @@ static void mdt_fini(const struct lu_env *env, struct mdt_device *m)
         mdt_stack_fini(env, m, md2lu_dev(m->mdt_child));
 
         if (ls) {
-                if (!list_empty(&ls->ls_lru) || ls->ls_total != 0) {
-                        /*
-                         * Uh-oh, objects still exist.
-                         */
-                        static DECLARE_LU_CDEBUG_PRINT_INFO(cookie, D_ERROR);
-
-                        lu_site_print(env, ls, &cookie, lu_cdebug_printer);
-                }
-
                 lu_site_fini(ls);
                 OBD_FREE_PTR(ls);
                 d->ld_site = NULL;
@@ -3713,6 +3733,15 @@ static void fsoptions_to_mdt_flags(struct mdt_device *m, char *options)
 {
         char *p = options;
 
+#ifdef CONFIG_FS_POSIX_ACL
+        /* ACLs should be enabled by default (b=13829) */
+        m->mdt_opts.mo_acl = 1;
+        LCONSOLE_INFO("Enabling ACL\n");
+#else
+        m->mdt_opts.mo_acl = 0;
+        LCONSOLE_INFO("Disabling ACL\n");
+#endif
+
         if (!options)
                 return;
 
@@ -3731,16 +3760,6 @@ static void fsoptions_to_mdt_flags(struct mdt_device *m, char *options)
                            (memcmp(options, "nouser_xattr", len) == 0)) {
                         m->mdt_opts.mo_user_xattr = 0;
                         LCONSOLE_INFO("Disabling user_xattr\n");
-                } else if ((len == sizeof("acl") - 1) &&
-                           (memcmp(options, "acl", len) == 0)) {
-#ifdef CONFIG_FS_POSIX_ACL
-                        m->mdt_opts.mo_acl = 1;
-                        LCONSOLE_INFO("Enabling ACL\n");
-#else
-                        m->mdt_opts.mo_acl = 0;
-                        CWARN("ignoring unsupported acl mount option\n");
-                        LCONSOLE_INFO("Disabling ACL\n");
-#endif
                 } else if ((len == sizeof("noacl") - 1) &&
                            (memcmp(options, "noacl", len) == 0)) {
                         m->mdt_opts.mo_acl = 0;
@@ -4547,11 +4566,11 @@ int mdt_postrecov(const struct lu_env *env, struct mdt_device *mdt)
         struct obd_device *obd = mdt->mdt_md_dev.md_lu_dev.ld_obd;
         int rc, lost;
         ENTRY;
-        /* if some clients didn't participate in recovery then we can possibly 
+        /* if some clients didn't participate in recovery then we can possibly
          * lost sequence. Now we should increase sequence for safe value */
         lost = obd->obd_max_recoverable_clients - obd->obd_connected_clients;
         mdt_seq_adjust(env, mdt, lost);
-        
+
         rc = ld->ld_ops->ldo_recovery_complete(env, ld);
         RETURN(rc);
 }
@@ -4591,11 +4610,14 @@ static struct lu_device* mdt_device_fini(const struct lu_env *env,
         RETURN(NULL);
 }
 
-static void mdt_device_free(const struct lu_env *env, struct lu_device *d)
+static struct lu_device *mdt_device_free(const struct lu_env *env,
+                                         struct lu_device *d)
 {
         struct mdt_device *m = mdt_dev(d);
+        ENTRY;
 
         OBD_FREE_PTR(m);
+        RETURN(NULL);
 }
 
 static struct lu_device *mdt_device_alloc(const struct lu_env *env,