From 57649535fee8e92412db6806a30d2fa0752f762f Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Tue, 5 Nov 2013 17:14:40 +0800 Subject: [PATCH] LU-3952 nfs: don't panic NFS server if MDS fails to find FID When MDS fails to retrive the parent's fid, we'd handle it without crashing the NFS server. Signed-off-by: Bobi Jam Change-Id: Ic15c7f8f99aed38fc77c46d24da7775e1a12b4ff Reviewed-on: http://review.whamcloud.com/8459 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: wangdi Reviewed-by: Oleg Drokin --- lustre/llite/llite_nfs.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/lustre/llite/llite_nfs.c b/lustre/llite/llite_nfs.c index 2926caf..2a2eb19 100644 --- a/lustre/llite/llite_nfs.c +++ b/lustre/llite/llite_nfs.c @@ -127,8 +127,8 @@ ll_iget_for_nfs(struct super_block *sb, struct lu_fid *fid, struct lu_fid *paren struct dentry *result; ENTRY; - if (!fid_is_sane(fid)) - RETURN(ERR_PTR(-ESTALE)); + if (!fid_is_sane(fid)) + RETURN(ERR_PTR(-ESTALE)); CDEBUG(D_INFO, "Get dentry for fid: "DFID"\n", PFID(fid)); @@ -311,28 +311,31 @@ static struct dentry *ll_get_parent(struct dentry *dchild) op_data = ll_prep_md_op_data(NULL, dir, NULL, dotdot, strlen(dotdot), lmmsize, - LUSTRE_OPC_ANY, NULL); - if (IS_ERR(op_data)) - RETURN((void *)op_data); + LUSTRE_OPC_ANY, NULL); + if (IS_ERR(op_data)) + RETURN((void *)op_data); - rc = md_getattr_name(sbi->ll_md_exp, op_data, &req); - ll_finish_md_op_data(op_data); - if (rc) { + rc = md_getattr_name(sbi->ll_md_exp, op_data, &req); + ll_finish_md_op_data(op_data); + if (rc) { CERROR("%s: failure inode "DFID" get parent: rc = %d\n", ll_get_fsname(dir->i_sb, NULL, 0), PFID(ll_inode2fid(dir)), rc); - RETURN(ERR_PTR(rc)); - } - body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY); - LASSERT(body->valid & OBD_MD_FLID); - - CDEBUG(D_INFO, "parent for "DFID" is "DFID"\n", - PFID(ll_inode2fid(dir)), PFID(&body->fid1)); - - result = ll_iget_for_nfs(dir->i_sb, &body->fid1, NULL); + RETURN(ERR_PTR(rc)); + } + body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY); + /* + * LU-3952: MDT may lost the FID of its parent, we should not crash + * the NFS server, ll_iget_for_nfs() will handle the error. + */ + if (body->valid & OBD_MD_FLID) { + CDEBUG(D_INFO, "parent for "DFID" is "DFID"\n", + PFID(ll_inode2fid(dir)), PFID(&body->fid1)); + } + result = ll_iget_for_nfs(dir->i_sb, &body->fid1, NULL); - ptlrpc_req_finished(req); - RETURN(result); + ptlrpc_req_finished(req); + RETURN(result); } struct export_operations lustre_export_operations = { -- 1.8.3.1