From c4beaea00ab812cf526c119ee0df35779d2bb470 Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Mon, 16 Dec 2013 02:09:13 -0500 Subject: [PATCH] LU-4365 quota: wait for global lock cancel In qsd_qtype_fini(), we'd wait for the global lock cancel done. Test-Parameters: envdefinitions=SLOW=yes,ENABLE_QUOTA=yes mdtfilesystemtype=zfs mdsfilesystemtype=zfs ostfilesystemtype=zfs testlist=recovery-small Signed-off-by: Niu Yawei Change-Id: Ib51dba4e4e4b13693c49560162d53cb28937e253 Reviewed-on: http://review.whamcloud.com/8583 Tested-by: Jenkins Reviewed-by: Johann Lombardi Reviewed-by: Fan Yong Tested-by: Maloo --- lustre/quota/qsd_lib.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lustre/quota/qsd_lib.c b/lustre/quota/qsd_lib.c index d1ef8393..9d9887c 100644 --- a/lustre/quota/qsd_lib.c +++ b/lustre/quota/qsd_lib.c @@ -268,6 +268,7 @@ static void qsd_qtype_fini(const struct lu_env *env, struct qsd_instance *qsd, int qtype) { struct qsd_qtype_info *qqi; + int repeat = 0; ENTRY; if (qsd->qsd_type_array[qtype] == NULL) @@ -285,6 +286,29 @@ static void qsd_qtype_fini(const struct lu_env *env, struct qsd_instance *qsd, qqi->qqi_site = NULL; } + /* The qqi may still be holding by global locks which are being + * canceled asynchronously (LU-4365), see the following steps: + * + * - On server umount, we try to clear all quota locks first by + * disconnecting LWP (which will invalidate import and cleanup + * all locks on it), however, if quota reint process is holding + * the global lock for reintegration at that time, global lock + * will fail to be cleared on LWP disconnection. + * + * - Umount process goes on and stops reint process, the global + * lock will be dropped on reint process exit, however, the lock + * cancel in done in asynchronous way, so the + * qsd_glb_blocking_ast() might haven't been called yet when we + * get here. + */ + while (cfs_atomic_read(&qqi->qqi_ref) > 1) { + CDEBUG(D_QUOTA, "qqi reference count %u, repeat: %d\n", + cfs_atomic_read(&qqi->qqi_ref), repeat); + repeat++; + schedule_timeout_and_set_state(TASK_INTERRUPTIBLE, + cfs_time_seconds(1)); + } + /* by now, all qqi users should have gone away */ LASSERT(cfs_atomic_read(&qqi->qqi_ref) == 1); lu_ref_fini(&qqi->qqi_reference); -- 1.8.3.1