X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fquota%2Fqsd_reint.c;h=4e5a4ad6b4b550e75d5179b5bb7680a6cbd9dea3;hb=624364420970f5df04aad5354566bce2b362e4b1;hp=f50862ede4269a8808644db0e5edb5edd11c0e38;hpb=676c2fe47c8de0825db3001f1e964347be3dc479;p=fs%2Flustre-release.git diff --git a/lustre/quota/qsd_reint.c b/lustre/quota/qsd_reint.c index f50862e..4e5a4ad 100644 --- a/lustre/quota/qsd_reint.c +++ b/lustre/quota/qsd_reint.c @@ -21,7 +21,7 @@ * GPL HEADER END */ /* - * Copyright (c) 2012, 2014, Intel Corporation. + * Copyright (c) 2012, 2017, Intel Corporation. * Use is subject to license terms. * * Author: Johann Lombardi @@ -89,6 +89,14 @@ static int qsd_reint_qid(const struct lu_env *env, struct qsd_qtype_info *qqi, rc = qsd_update_index(env, qqi, qid, global, 0, rec); out: + + if (global && qid->qid_uid == 0) { + struct lquota_glb_rec *glb_rec = (struct lquota_glb_rec *)rec; + qsd_update_default_quota(qqi, glb_rec->qbr_hardlimit, + glb_rec->qbr_softlimit, + glb_rec->qbr_time); + } + lqe_putref(lqe); RETURN(rc); } @@ -411,7 +419,6 @@ static int qsd_reint_main(void *args) struct qsd_qtype_info *qqi = (struct qsd_qtype_info *)args; struct qsd_instance *qsd = qqi->qqi_qsd; struct ptlrpc_thread *thread = &qqi->qqi_reint_thread; - struct l_wait_info lwi = { 0 }; int rc; ENTRY; @@ -435,8 +442,8 @@ static int qsd_reint_main(void *args) qti = qsd_info(env); /* wait for the connection to master established */ - l_wait_event(thread->t_ctl_waitq, - qsd_connected(qsd) || !thread_is_running(thread), &lwi); + wait_event_idle(thread->t_ctl_waitq, + qsd_connected(qsd) || !thread_is_running(thread)); /* Step 1: enqueue global index lock */ if (!thread_is_running(thread)) @@ -508,8 +515,8 @@ static int qsd_reint_main(void *args) } /* wait for the qsd instance started (target recovery done) */ - l_wait_event(thread->t_ctl_waitq, - qsd_started(qsd) || !thread_is_running(thread), &lwi); + wait_event_idle(thread->t_ctl_waitq, + qsd_started(qsd) || !thread_is_running(thread)); if (!thread_is_running(thread)) GOTO(out_lock, rc = 0); @@ -544,14 +551,13 @@ out: void qsd_stop_reint_thread(struct qsd_qtype_info *qqi) { struct ptlrpc_thread *thread = &qqi->qqi_reint_thread; - struct l_wait_info lwi = { 0 }; if (!thread_is_stopped(thread)) { thread_set_flags(thread, SVC_STOPPING); wake_up(&thread->t_ctl_waitq); - l_wait_event(thread->t_ctl_waitq, - thread_is_stopped(thread), &lwi); + wait_event_idle(thread->t_ctl_waitq, + thread_is_stopped(thread)); } } @@ -625,17 +631,23 @@ int qsd_start_reint_thread(struct qsd_qtype_info *qqi) { struct ptlrpc_thread *thread = &qqi->qqi_reint_thread; struct qsd_instance *qsd = qqi->qqi_qsd; - struct l_wait_info lwi = { 0 }; struct task_struct *task; int rc; char *name; ENTRY; + /* do not try to start a new thread as this can lead to a deadlock */ + if (current->flags & (PF_MEMALLOC | PF_KSWAPD)) + RETURN(0); + + if (qsd->qsd_dev->dd_rdonly) + RETURN(0); + /* don't bother to do reintegration when quota isn't enabled */ if (!qsd_type_enabled(qsd, qqi->qqi_qtype)) RETURN(0); - if (qsd->qsd_acct_failed) + if (qqi->qqi_acct_failed) /* no space accounting support, can't enable enforcement */ RETURN(0); @@ -680,8 +692,7 @@ int qsd_start_reint_thread(struct qsd_qtype_info *qqi) RETURN(rc); } - l_wait_event(thread->t_ctl_waitq, - thread_is_running(thread) || thread_is_stopped(thread), - &lwi); + wait_event_idle(thread->t_ctl_waitq, + thread_is_running(thread) || thread_is_stopped(thread)); RETURN(0); }