From 31b26bb23ba4d2cfde2f7ac661a5efbda69ca570 Mon Sep 17 00:00:00 2001
From: wangdi <wangdi>
Date: Fri, 4 Jun 2004 11:47:07 +0000
Subject: [PATCH] move mds_check_mds_num right after fill_inode to avoid race.

---
 lustre/mds/handler.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c
index b0b945410a..6b20e03cc0 100644
--- a/lustre/mds/handler.c
+++ b/lustre/mds/handler.c
@@ -949,15 +949,17 @@ static int mds_getattr_name(int offset, struct ptlrpc_request *req,
         cleanup_phase = 2; /* dchild, dparent, locks */
 
 fill_inode:
+        if (dparent) {
+                rc = mds_check_mds_num(obd, dparent->d_cache_inode, name,
+                                       namesize);
+                if (rc)
+                        GOTO(cleanup, rc); 
+        }
         if (!DENTRY_VALID(dchild)) {
                 intent_set_disposition(rep, DISP_LOOKUP_NEG);
                 /* in the intent case, the policy clears this error:
                    the disposition is enough */
                 rc = -ENOENT;
-                if (dparent) {
-                        rc = mds_check_mds_num(obd, dparent->d_inode, name,
-                                               namesize);
-                }
                 GOTO(cleanup, rc);
         } else {
                 intent_set_disposition(rep, DISP_LOOKUP_POS);
-- 
GitLab