Whamcloud - gitweb
Branch: HEAD
authorwangdi <wangdi>
Wed, 17 Aug 2005 15:25:24 +0000 (15:25 +0000)
committerwangdi <wangdi>
Wed, 17 Aug 2005 15:25:24 +0000 (15:25 +0000)
the inflight page should also be teardown when unmount

lustre/lov/lov_internal.h
lustre/lov/lov_obd.c

index 723ce86..1b1211b 100644 (file)
@@ -150,6 +150,22 @@ lov_tgt_incref(struct lov_obd *lov, struct lov_tgt_desc *tgt)
         lov_tgts_unlock(lov);
 }
 
+static inline int
+lov_tgt_pending(struct lov_obd *lov, struct lov_tgt_desc *tgt, int gen)
+{
+        int rc = 0;
+        lov_tgts_lock(lov);
+
+        if (((gen == 0) || (gen == tgt->ltd_gen)) &&
+            (tgt->ltd_flags &(LTD_ACTIVE|LTD_DEL_PENDING)) == LTD_DEL_PENDING) {
+                tgt->ltd_refcount++;
+                rc = 1;
+        }
+
+        lov_tgts_unlock(lov);
+        return rc;
+}
+
 struct lov_async_page {
         int                             lap_magic;
         int                             lap_stripe;
index 00a2a96..a986ea6 100644 (file)
@@ -1632,8 +1632,11 @@ static int lov_teardown_async_page(struct obd_export *exp,
         loi = &lsm->lsm_oinfo[lap->lap_stripe];
         tgt = lov->tgts + loi->loi_ost_idx;
 
-        if (!lov_tgt_ready(lov, tgt, loi->loi_ost_gen))
-                RETURN(-EIO);
+        if (!lov_tgt_ready(lov, tgt, loi->loi_ost_gen) && 
+            !lov_tgt_pending(lov, tgt, loi->loi_ost_gen))
+                 RETURN(-EIO);
+
+        lov_tgt_incref(lov,tgt);
 
         rc = obd_teardown_async_page(tgt->ltd_exp, lsm, loi,
                                      lap->lap_sub_cookie);