Whamcloud - gitweb
LU-5547 mdt: handle NULL parent in mdt_getattr_name_lock() 10/11610/2
authorJohn L. Hammond <john.hammond@intel.com>
Tue, 26 Aug 2014 22:11:22 +0000 (17:11 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 26 Sep 2014 23:09:13 +0000 (23:09 +0000)
In mdt_getattr_name_lock() if the parent object (from mti_object) is
NULL then return -ENOENT rather than asserting.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I081cb54068bba7825e2a5593f293f48cb2eda874
Reviewed-on: http://review.whamcloud.com/11610
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdt/mdt_handler.c

index 9abfa46..204ebd5 100644 (file)
@@ -1323,7 +1323,6 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info,
         struct mdt_body        *reqbody   = NULL;
         struct mdt_object      *parent    = info->mti_object;
         struct mdt_object      *child;
-        struct md_object       *next      = mdt_object_child(parent);
         struct lu_fid          *child_fid = &info->mti_tmp_fid1;
         struct lu_name         *lname     = NULL;
         struct mdt_lock_handle *lhp       = NULL;
@@ -1338,7 +1337,8 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info,
        LASSERT(ergo(is_resent,
                     lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT));
 
-       LASSERT(parent != NULL);
+       if (parent == NULL)
+               RETURN(-ENOENT);
 
        if (info->mti_cross_ref) {
                /* Only getattr on the child. Parent is on another node. */
@@ -1447,8 +1447,8 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info,
 
                 /* step 2: lookup child's fid by name */
                 fid_zero(child_fid);
-                rc = mdo_lookup(info->mti_env, next, lname, child_fid,
-                                &info->mti_spec);
+               rc = mdo_lookup(info->mti_env, mdt_object_child(parent), lname,
+                               child_fid, &info->mti_spec);
                if (rc == -ENOENT)
                        mdt_set_disposition(info, ldlm_rep, DISP_LOOKUP_NEG);