Whamcloud - gitweb
LU-8592 mdt: hold mdt_device::mdt_md_root until service stop
[fs/lustre-release.git] / lustre / mdt / mdt_handler.c
index 12cc56e..c3e8cf1 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -2392,11 +2388,15 @@ int mdt_remote_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
                break;
        }
        case LDLM_CB_CANCELING: {
+               struct obd_device *obd = ldlm_lock_to_ns(lock)->ns_obd;
+               struct mdt_device *mdt =
+                               mdt_dev(obd->obd_lu_dev->ld_site->ls_top_dev);
+
                LDLM_DEBUG(lock, "Revoke remote lock\n");
 
                /* discard slc lock here so that it can be cleaned anytime,
                 * especially for cleanup_resource() */
-               tgt_discard_slc_lock(lock);
+               tgt_discard_slc_lock(&mdt->mdt_lut, lock);
 
                /* once we cache lock, l_ast_data is set to mdt_object */
                if (lock->l_ast_data != NULL) {
@@ -2405,9 +2405,6 @@ int mdt_remote_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
 
                        rc = lu_env_init(&env, LCT_MD_THREAD);
                        if (unlikely(rc != 0)) {
-                               struct obd_device *obd;
-
-                               obd = ldlm_lock_to_ns(lock)->ns_obd;
                                CWARN("%s: lu_env initialization failed, object"
                                      "%p "DFID" is leaked!\n",
                                      obd->obd_name, mo,
@@ -2807,7 +2804,8 @@ static void mdt_save_remote_lock(struct mdt_thread_info *info,
                        struct ptlrpc_request *req = mdt_info_req(info);
 
                        LASSERT(req != NULL);
-                       tgt_save_slc_lock(lock, req->rq_transno);
+                       tgt_save_slc_lock(&info->mti_mdt->mdt_lut, lock,
+                                         req->rq_transno);
                        ldlm_lock_decref(h, mode);
                }
                h->cookie = 0ull;
@@ -4511,11 +4509,6 @@ static void mdt_fini(const struct lu_env *env, struct mdt_device *m)
        struct lfsck_stop        stop;
        ENTRY;
 
-       if (m->mdt_md_root != NULL) {
-               mdt_object_put(env, m->mdt_md_root);
-               m->mdt_md_root = NULL;
-       }
-
        stop.ls_status = LS_PAUSED;
        stop.ls_flags = 0;
        next->md_ops->mdo_iocontrol(env, next, OBD_IOC_STOP_LFSCK, 0, &stop);
@@ -4550,6 +4543,11 @@ static void mdt_fini(const struct lu_env *env, struct mdt_device *m)
                d->ld_obd->obd_namespace = m->mdt_namespace = NULL;
        }
 
+       if (m->mdt_md_root != NULL) {
+               mdt_object_put(env, m->mdt_md_root);
+               m->mdt_md_root = NULL;
+       }
+
        mdt_quota_fini(env, m);
 
        cfs_free_nidlist(&m->mdt_squash.rsi_nosquash_nids);
@@ -5072,6 +5070,10 @@ static int mdt_obd_set_info_async(const struct lu_env *env,
  * connect flags from the obd_connect_data::ocd_connect_flags field of the
  * reply. \see mdt_connect().
  *
+ * Before 2.7.50 clients will send a struct obd_connect_data_v1 rather than a
+ * full struct obd_connect_data. So care must be taken when accessing fields
+ * that are not present in struct obd_connect_data_v1. See LU-16.
+ *
  * \param exp   the obd_export associated with this client/target pair
  * \param mdt   the target device for the connection
  * \param data  stores data for this connect request
@@ -5087,7 +5089,10 @@ static int mdt_connect_internal(struct obd_export *exp,
        LASSERT(data != NULL);
 
        data->ocd_connect_flags &= MDT_CONNECT_SUPPORTED;
-       data->ocd_connect_flags2 &= MDT_CONNECT_SUPPORTED2;
+
+       if (data->ocd_connect_flags & OBD_CONNECT_FLAGS2)
+               data->ocd_connect_flags2 &= MDT_CONNECT_SUPPORTED2;
+
        data->ocd_ibits_known &= MDS_INODELOCK_FULL;
 
        if (!(data->ocd_connect_flags & OBD_CONNECT_MDS_MDS) &&
@@ -5717,9 +5722,9 @@ static int mdt_fid2path(struct mdt_thread_info *info,
                RETURN(-EINVAL);
 
        if (!fid_is_namespace_visible(&fp->gf_fid)) {
-               CWARN("%s: "DFID" is invalid, sequence should be "
-                     ">= %#llx\n", mdt_obd_name(mdt),
-                     PFID(&fp->gf_fid), (__u64)FID_SEQ_NORMAL);
+               CDEBUG(D_INFO, "%s: "DFID" is invalid, f_seq should be >= %#llx"
+                      ", or f_oid != 0, or f_ver == 0\n", mdt_obd_name(mdt),
+                      PFID(&fp->gf_fid), (__u64)FID_SEQ_NORMAL);
                RETURN(-EINVAL);
        }