Whamcloud - gitweb
LU-4008 mdt: update mdt_getattr comments about EA sizing
[fs/lustre-release.git] / lustre / mdt / mdt_handler.c
index 329c5fc..ccbf2a9 100644 (file)
@@ -1078,6 +1078,10 @@ static int mdt_getattr(struct tgt_session_info *tsi)
         LASSERT(obj != NULL);
        LASSERT(lu_object_assert_exists(&obj->mot_obj));
 
+       /* Unlike intent case where we need to pre-fill out buffers early on
+        * in intent policy for ldlm reasons, here we can have a much better
+        * guess at EA size by just reading it from disk.
+        * Exceptions are readdir and (missing) directory striping */
        /* Readlink */
        if (reqbody->valid & OBD_MD_LINKNAME) {
                /* No easy way to know how long is the symlink, but it cannot
@@ -1096,15 +1100,13 @@ static int mdt_getattr(struct tgt_session_info *tsi)
                 * will reallocate */
                rc = DEF_REP_MD_SIZE;
        } else {
-               /* Hopefully no race in EA change for either file or directory?
-                */
+               /* Read the actual EA size from disk */
                rc = mdt_attr_get_eabuf_size(info, obj);
        }
 
        if (rc < 0)
                GOTO(out_shrink, rc);
 
-       /* old clients may not report needed easize, use max value then */
        req_capsule_set_size(pill, &RMF_MDT_MD, RCL_SERVER, rc);
 
        rc = req_capsule_server_pack(pill);
@@ -3579,10 +3581,8 @@ static void mdt_seq_fini_cli(struct mdt_device *mdt)
        if (ss == NULL)
                return;
 
-       if (ss->ss_server_seq == NULL)
+       if (ss->ss_server_seq != NULL)
                seq_server_set_cli(NULL, ss->ss_server_seq, NULL);
-
-       return;
 }
 
 static int mdt_seq_fini(const struct lu_env *env, struct mdt_device *mdt)