Whamcloud - gitweb
LU-8480 ofd: hold obd_dev_lock across grant comparison 13/21813/2
authorAndreas Dilger <andreas.dilger@intel.com>
Mon, 8 Aug 2016 17:49:16 +0000 (11:49 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 29 Aug 2016 03:52:11 +0000 (03:52 +0000)
Hold obd_dev_lock until the global ofd_tot_* grant values are saved,
so that their comparison is not racy.  Otherwise it is possible to
report grant inconsistencies when multiple clients are unmounted.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: I19ffd102b657df2df539d01d182a782aa17ad924
Reviewed-on: http://review.whamcloud.com/21813
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ofd/ofd_grant.c

index 02b86c7..6ed619a 100644 (file)
@@ -246,10 +246,11 @@ void ofd_grant_sanity_check(struct obd_device *obd, const char *func)
                tot_dirty += fed->fed_dirty;
        }
 
-       spin_unlock(&obd->obd_dev_lock);
        fo_tot_granted = ofd->ofd_tot_granted;
        fo_tot_pending = ofd->ofd_tot_pending;
        fo_tot_dirty = ofd->ofd_tot_dirty;
+       spin_unlock(&obd->obd_dev_lock);
+       spin_unlock(&ofd->ofd_grant_lock);
 
        if (tot_granted != fo_tot_granted)
                CERROR("%s: tot_granted "LPU64" != fo_tot_granted "LPU64"\n",
@@ -269,7 +270,6 @@ void ofd_grant_sanity_check(struct obd_device *obd, const char *func)
        if (tot_dirty > maxsize)
                CERROR("%s: tot_dirty "LPU64" > maxsize "LPU64"\n",
                       func, tot_dirty, maxsize);
-       spin_unlock(&ofd->ofd_grant_lock);
 }
 
 /**