From 8b94ccf3452c81290424a2bcd3a7480bb86db709 Mon Sep 17 00:00:00 2001
From: bobijam <bobijam>
Date: Thu, 10 Jan 2008 03:48:40 +0000
Subject: [PATCH] Branch HEAD b=13375 i=adilger i=johann i=nathan

Descriptoin: make lov_create() will not stuck in obd_statfs_rqset()
Details    : If an OST is down the MDS will hang indefinitely in
             obd_statfs_rqset() waiting for the statfs data. While for
             MDS QOS usage of statfs, it should not stuck in waiting.
---
 lustre/ChangeLog           |  7 +++++++
 lustre/include/obd_class.h | 16 ++++++++++++++--
 lustre/liblustre/super.c   |  2 +-
 lustre/llite/llite_lib.c   |  2 +-
 lustre/lov/lov_obd.c       |  2 +-
 5 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/lustre/ChangeLog b/lustre/ChangeLog
index 68459cc621..fd5745a99d 100644
--- a/lustre/ChangeLog
+++ b/lustre/ChangeLog
@@ -10,6 +10,13 @@ tbd  Sun Microsystems, Inc.
        * Recommended e2fsprogs version: 1.40.2-cfs5
        * Note that reiserfs quotas are disabled on SLES 10 in this kernel.
 
+Severity   : normal
+Bugzilla   : 13375
+Descriptoin: make lov_create() will not stuck in obd_statfs_rqset()
+Details    : If an OST is down the MDS will hang indefinitely in
+             obd_statfs_rqset() waiting for the statfs data. While for
+	     MDS QOS usage of statfs, it should not stuck in waiting.
+
 Severity   : enhancement
 Bugzilla   : 14288
 Description: Update to RHEL4 U6 kernel-2.6.9-67.EL.
diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h
index b863841f47..46b1196a09 100644
--- a/lustre/include/obd_class.h
+++ b/lustre/include/obd_class.h
@@ -1006,7 +1006,8 @@ static inline int obd_statfs_async(struct obd_device *obd,
 }
 
 static inline int obd_statfs_rqset(struct obd_device *obd,
-                                   struct obd_statfs *osfs, __u64 max_age)
+                                   struct obd_statfs *osfs, __u64 max_age,
+                                   int quick_pry)
 {
         struct ptlrpc_request_set *set = NULL;
         struct obd_info oinfo = { { { 0 } } };
@@ -1019,8 +1020,19 @@ static inline int obd_statfs_rqset(struct obd_device *obd,
 
         oinfo.oi_osfs = osfs;
         rc = obd_statfs_async(obd, &oinfo, max_age, set);
-        if (rc == 0)
+        if (rc == 0) {
+                struct ptlrpc_request *req;
+
+                if (quick_pry)
+                        list_for_each_entry(req, &set->set_requests,
+                                            rq_set_chain) {
+                                spin_lock(&req->rq_lock);
+                                req->rq_no_resend = 1;
+                                req->rq_no_delay  = 1;
+                                spin_unlock(&req->rq_lock);
+                        }
                 rc = ptlrpc_set_wait(set);
+        }
         ptlrpc_set_destroy(set);
         RETURN(rc);
 }
diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c
index cefd4a0949..e24258cb93 100644
--- a/lustre/liblustre/super.c
+++ b/lustre/liblustre/super.c
@@ -1205,7 +1205,7 @@ static int llu_statfs_internal(struct llu_sb_info *sbi,
                osfs->os_bavail, osfs->os_blocks, osfs->os_ffree,osfs->os_files);
 
         rc = obd_statfs_rqset(class_exp2obd(sbi->ll_dt_exp),
-                              &obd_statfs, max_age);
+                              &obd_statfs, max_age, 0);
         if (rc) {
                 CERROR("obd_statfs fails: rc = %d\n", rc);
                 RETURN(rc);
diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c
index 06e3b79859..ed8ae792ff 100644
--- a/lustre/llite/llite_lib.c
+++ b/lustre/llite/llite_lib.c
@@ -1442,7 +1442,7 @@ int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs,
                osfs->os_bavail, osfs->os_blocks, osfs->os_ffree,osfs->os_files);
 
         rc = obd_statfs_rqset(class_exp2obd(sbi->ll_dt_exp),
-                              &obd_osfs, max_age);
+                              &obd_osfs, max_age, 0);
         if (rc) {
                 CERROR("obd_statfs fails: rc = %d\n", rc);
                 RETURN(rc);
diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c
index a3a45637d9..50ebb49f7b 100644
--- a/lustre/lov/lov_obd.c
+++ b/lustre/lov/lov_obd.c
@@ -1017,7 +1017,7 @@ static int lov_create(struct obd_export *exp, struct obdo *src_oa,
         }
 
         maxage = cfs_time_shift_64(-lov->desc.ld_qos_maxage);
-        obd_statfs_rqset(exp->exp_obd, &osfs, maxage);
+        obd_statfs_rqset(exp->exp_obd, &osfs, maxage, 1);
 
         rc = lov_prep_create_set(exp, &oinfo, ea, src_oa, oti, &set);
         if (rc)
-- 
GitLab