Whamcloud - gitweb
LU-3952 nfs: don't panic NFS server if MDS fails to find FID 06/8706/2
authorBobi Jam <bobijam.xu@intel.com>
Tue, 5 Nov 2013 09:14:40 +0000 (17:14 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 6 Jan 2014 03:47:13 +0000 (03:47 +0000)
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 <bobijam.xu@intel.com>
Signed-off-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Change-Id: I2ad36aa1ac2b7ae131cb21bf955a8ec6933d1dc3
Reviewed-on: http://review.whamcloud.com/8706
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
lustre/llite/llite_nfs.c

index 2df61f6..ea0f6c9 100644 (file)
@@ -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 = {