Whamcloud - gitweb
LU-3952 nfs: don't panic NFS server if MDS fails to find FID 59/8459/5
authorBobi Jam <bobijam.xu@intel.com>
Tue, 5 Nov 2013 09:14:40 +0000 (17:14 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 2 Jan 2014 17:20:47 +0000 (17:20 +0000)
When MDS fails to retrive the parent's fid, we'd handle it without
crashing the NFS server.

Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Change-Id: Ic15c7f8f99aed38fc77c46d24da7775e1a12b4ff
Reviewed-on: http://review.whamcloud.com/8459
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@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>
lustre/llite/llite_nfs.c

index 2926caf..2a2eb19 100644 (file)
@@ -127,8 +127,8 @@ ll_iget_for_nfs(struct super_block *sb, struct lu_fid *fid, struct lu_fid *paren
         struct dentry *result;
         ENTRY;
 
         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));
 
 
        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,
 
        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);
                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 = {
 }
 
 struct export_operations lustre_export_operations = {