From: Bobi Jam Date: Tue, 5 Nov 2013 09:14:40 +0000 (+0800) Subject: LU-3952 nfs: don't panic NFS server if MDS fails to find FID X-Git-Tag: 2.5.1-RC1~83 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F06%2F8706%2F2;p=fs%2Flustre-release.git 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. Lustre-commit: 57649535fee8e92412db6806a30d2fa0752f762f Lustre-change: http://review.whamcloud.com/8459 Signed-off-by: Bobi Jam Signed-off-by: Bob Glossman Reviewed-by: Fan Yong Reviewed-by: wangdi Reviewed-by: Oleg Drokin Change-Id: I2ad36aa1ac2b7ae131cb21bf955a8ec6933d1dc3 Reviewed-on: http://review.whamcloud.com/8706 Tested-by: Jenkins Tested-by: Maloo --- diff --git a/lustre/llite/llite_nfs.c b/lustre/llite/llite_nfs.c index 2df61f6..ea0f6c9 100644 --- a/lustre/llite/llite_nfs.c +++ b/lustre/llite/llite_nfs.c @@ -295,26 +295,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); - - rc = md_getattr_name(sbi->ll_md_exp, op_data, &req); - ll_finish_md_op_data(op_data); - if (rc) { - CERROR("failure %d inode %lu get parent\n", rc, dir->i_ino); - 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); + 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) { + 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); + /* + * 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 = {