Whamcloud - gitweb
b=23196 take lov reference in lov_quota_adjust_qunit so as to avoid races
authorAndrew Perepechko <Andrew.Perepechko@sun.com>
Wed, 18 Aug 2010 18:12:07 +0000 (22:12 +0400)
committerMikhail Pershin <tappro@sun.com>
Thu, 19 Aug 2010 09:22:11 +0000 (13:22 +0400)
a=Johann Lombardi
i=ZhiYong Tian
i=Andrew Perepechko

lustre/quota/quota_adjust_qunit.c

index 7839972..6b1f5ca 100644 (file)
@@ -351,10 +351,11 @@ int lov_quota_adjust_qunit(struct obd_export *exp,
                 RETURN(-EFAULT);
         }
 
                 RETURN(-EFAULT);
         }
 
+        obd_getref(obd);
         for (i = 0; i < lov->desc.ld_tgt_count; i++) {
                 int err;
 
         for (i = 0; i < lov->desc.ld_tgt_count; i++) {
                 int err;
 
-                if (!lov->lov_tgts[i]->ltd_active) {
+                if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_active) {
                         CDEBUG(D_HA, "ost %d is inactive\n", i);
                         continue;
                 }
                         CDEBUG(D_HA, "ost %d is inactive\n", i);
                         continue;
                 }
@@ -367,5 +368,6 @@ int lov_quota_adjust_qunit(struct obd_export *exp,
                         continue;
                 }
         }
                         continue;
                 }
         }
+        obd_putref(obd);
         RETURN(rc);
 }
         RETURN(rc);
 }