Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-12678 lnet: remove locking protection ln_testprotocompat
[fs/lustre-release.git]
/
lustre
/
quota
/
qsd_reint.c
diff --git
a/lustre/quota/qsd_reint.c
b/lustre/quota/qsd_reint.c
index
33e4988
..
4e5a4ad
100644
(file)
--- a/
lustre/quota/qsd_reint.c
+++ b/
lustre/quota/qsd_reint.c
@@
-21,7
+21,7
@@
* GPL HEADER END
*/
/*
* GPL HEADER END
*/
/*
- * Copyright (c) 2012, 201
4
, Intel Corporation.
+ * Copyright (c) 2012, 201
7
, Intel Corporation.
* Use is subject to license terms.
*
* Author: Johann Lombardi <johann.lombardi@intel.com>
* Use is subject to license terms.
*
* Author: Johann Lombardi <johann.lombardi@intel.com>
@@
-31,6
+31,7
@@
#define DEBUG_SUBSYSTEM S_LQUOTA
#include <linux/kthread.h>
#define DEBUG_SUBSYSTEM S_LQUOTA
#include <linux/kthread.h>
+#include <lustre_swab.h>
#include "qsd_internal.h"
/*
#include "qsd_internal.h"
/*
@@
-57,7
+58,7
@@
static void qsd_reint_completion(const struct lu_env *env,
}
CDEBUG(D_QUOTA, "%s: global quota lock successfully acquired, glb "
}
CDEBUG(D_QUOTA, "%s: global quota lock successfully acquired, glb "
- "fid:"DFID", glb ver:
"LPU64", slv fid:"DFID", slv ver:"LPU64"
\n",
+ "fid:"DFID", glb ver:
%llu, slv fid:"DFID", slv ver:%llu
\n",
qsd->qsd_svname, PFID(&req_qbody->qb_fid),
lvb->lvb_glb_ver, PFID(&rep_qbody->qb_slv_fid),
rep_qbody->qb_slv_ver);
qsd->qsd_svname, PFID(&req_qbody->qb_fid),
lvb->lvb_glb_ver, PFID(&rep_qbody->qb_slv_fid),
rep_qbody->qb_slv_ver);
@@
-88,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:
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);
}
lqe_putref(lqe);
RETURN(rc);
}
@@
-195,14
+204,14
@@
static int qsd_reint_index(const struct lu_env *env, struct qsd_qtype_info *qqi,
/* let's do a 1MB bulk */
npages = min_t(unsigned int, OFD_MAX_BRW_SIZE, 1 << 20);
/* let's do a 1MB bulk */
npages = min_t(unsigned int, OFD_MAX_BRW_SIZE, 1 << 20);
- npages /= PAGE_
CACHE_
SIZE;
+ npages /= PAGE_SIZE;
/* allocate pages for bulk index read */
OBD_ALLOC(pages, npages * sizeof(*pages));
if (pages == NULL)
GOTO(out, rc = -ENOMEM);
for (i = 0; i < npages; i++) {
/* allocate pages for bulk index read */
OBD_ALLOC(pages, npages * sizeof(*pages));
if (pages == NULL)
GOTO(out, rc = -ENOMEM);
for (i = 0; i < npages; i++) {
- pages[i] = alloc_page(GFP_
I
OFS);
+ pages[i] = alloc_page(GFP_
N
OFS);
if (pages[i] == NULL)
GOTO(out, rc = -ENOMEM);
}
if (pages[i] == NULL)
GOTO(out, rc = -ENOMEM);
}
@@
-255,7
+264,7
@@
repeat:
ver = ii->ii_version;
pg_cnt = (ii->ii_count + (LU_PAGE_COUNT) - 1);
ver = ii->ii_version;
pg_cnt = (ii->ii_count + (LU_PAGE_COUNT) - 1);
- pg_cnt >>= PAGE_
CACHE_
SHIFT - LU_PAGE_SHIFT;
+ pg_cnt >>= PAGE_SHIFT - LU_PAGE_SHIFT;
if (pg_cnt > npages) {
CERROR("%s: master returned more pages than expected, %u > %u"
if (pg_cnt > npages) {
CERROR("%s: master returned more pages than expected, %u > %u"
@@
-283,8
+292,8
@@
out:
if (rc == 0) {
rc = qsd_write_version(env, qqi, ver, global);
if (rc)
if (rc == 0) {
rc = qsd_write_version(env, qqi, ver, global);
if (rc)
- CERROR("%s: write version
"LPU64" to "DFID" failed. "
-
"%d\n",
qsd->qsd_svname, ver, PFID(fid), rc);
+ CERROR("%s: write version
%llu to "DFID" failed : rc = %d\n",
+ qsd->qsd_svname, ver, PFID(fid), rc);
}
RETURN(rc);
}
RETURN(rc);
@@
-410,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 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;
int rc;
ENTRY;
@@
-434,8
+442,8
@@
static int qsd_reint_main(void *args)
qti = qsd_info(env);
/* wait for the connection to master established */
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))
/* Step 1: enqueue global index lock */
if (!thread_is_running(thread))
@@
-468,8
+476,8
@@
static int qsd_reint_main(void *args)
if (rc)
GOTO(out_env_init, rc);
if (rc)
GOTO(out_env_init, rc);
- CDEBUG(D_QUOTA, "%s: glb_ver:
"LPU64"/"LPU64",slv_ver:"LPU64"
/"
-
LPU64"
\n", qsd->qsd_svname,
+ CDEBUG(D_QUOTA, "%s: glb_ver:
%llu/%llu,slv_ver:%llu
/"
+
"%llu
\n", qsd->qsd_svname,
qti->qti_lvb.lvb_glb_ver, qqi->qqi_glb_ver,
qti->qti_slv_ver, qqi->qqi_slv_ver);
}
qti->qti_lvb.lvb_glb_ver, qqi->qqi_glb_ver,
qti->qti_slv_ver, qqi->qqi_slv_ver);
}
@@
-507,8
+515,8
@@
static int qsd_reint_main(void *args)
}
/* wait for the qsd instance started (target recovery done) */
}
/* 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);
if (!thread_is_running(thread))
GOTO(out_lock, rc = 0);
@@
-531,25
+539,25
@@
out:
qqi->qqi_reint = 0;
write_unlock(&qsd->qsd_lock);
qqi->qqi_reint = 0;
write_unlock(&qsd->qsd_lock);
- qqi_putref(qqi);
- lu_ref_del(&qqi->qqi_reference, "reint_thread", thread);
-
thread_set_flags(thread, SVC_STOPPED);
wake_up(&thread->t_ctl_waitq);
thread_set_flags(thread, SVC_STOPPED);
wake_up(&thread->t_ctl_waitq);
+
+ lu_ref_del(&qqi->qqi_reference, "reint_thread", thread);
+ qqi_putref(qqi);
+
return rc;
}
void qsd_stop_reint_thread(struct qsd_qtype_info *qqi)
{
struct ptlrpc_thread *thread = &qqi->qqi_reint_thread;
return rc;
}
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);
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)
);
}
}
}
}
@@
-623,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 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;
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);
/* don't bother to do reintegration when quota isn't enabled */
if (!qsd_type_enabled(qsd, qqi->qqi_qtype))
RETURN(0);
- if (q
sd->qsd
_acct_failed)
+ if (q
qi->qqi
_acct_failed)
/* no space accounting support, can't enable enforcement */
RETURN(0);
/* no space accounting support, can't enable enforcement */
RETURN(0);
@@
-678,8
+692,7
@@
int qsd_start_reint_thread(struct qsd_qtype_info *qqi)
RETURN(rc);
}
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);
}
RETURN(0);
}