From cf54bda257dc3287458a9157bb4647f05d8f8469 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Mon, 8 Aug 2016 11:49:16 -0600 Subject: [PATCH] LU-8480 ofd: hold obd_dev_lock across grant comparison 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 Change-Id: I19ffd102b657df2df539d01d182a782aa17ad924 Reviewed-on: http://review.whamcloud.com/21813 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin --- lustre/ofd/ofd_grant.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lustre/ofd/ofd_grant.c b/lustre/ofd/ofd_grant.c index 02b86c7..6ed619a 100644 --- a/lustre/ofd/ofd_grant.c +++ b/lustre/ofd/ofd_grant.c @@ -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); } /** -- 1.8.3.1