From 8479c416031f93c5d99b3f9cd457d48af407abd1 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Tue, 26 Aug 2014 17:11:22 -0500 Subject: [PATCH] LU-5547 mdt: handle NULL parent in mdt_getattr_name_lock() 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 Change-Id: I081cb54068bba7825e2a5593f293f48cb2eda874 Reviewed-on: http://review.whamcloud.com/11610 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Mike Pershin Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin --- lustre/mdt/mdt_handler.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 9abfa46..204ebd5 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -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); -- 1.8.3.1