Commit 21158ca8 authored by Guozhonghua's avatar Guozhonghua Committed by Linus Torvalds

ocfs2: without quota support, avoid calling quota recovery

During one dead node's recovery by other node, quota recovery work will
be queued.  We should avoid calling quota when it is not supported, so
check the quota flags.

Link: http://lkml.kernel.org/r/71604351584F6A4EBAE558C676F37CA401071AC9FB@H3CMLB12-EX.srv.huawei-3com.comSigned-off-by: default avatarguozhonghua <guozhonghua@h3c.com>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Joseph Qi <jiangqi903@gmail.com>
Cc: Changwei Ge <ge.changwei@h3c.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a6346447
...@@ -1378,16 +1378,24 @@ static int __ocfs2_recovery_thread(void *arg) ...@@ -1378,16 +1378,24 @@ static int __ocfs2_recovery_thread(void *arg)
int rm_quota_used = 0, i; int rm_quota_used = 0, i;
struct ocfs2_quota_recovery *qrec; struct ocfs2_quota_recovery *qrec;
/* Whether the quota supported. */
int quota_enabled = OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb,
OCFS2_FEATURE_RO_COMPAT_USRQUOTA)
|| OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb,
OCFS2_FEATURE_RO_COMPAT_GRPQUOTA);
status = ocfs2_wait_on_mount(osb); status = ocfs2_wait_on_mount(osb);
if (status < 0) { if (status < 0) {
goto bail; goto bail;
} }
if (quota_enabled) {
rm_quota = kcalloc(osb->max_slots, sizeof(int), GFP_NOFS); rm_quota = kcalloc(osb->max_slots, sizeof(int), GFP_NOFS);
if (!rm_quota) { if (!rm_quota) {
status = -ENOMEM; status = -ENOMEM;
goto bail; goto bail;
} }
}
restart: restart:
status = ocfs2_super_lock(osb, 1); status = ocfs2_super_lock(osb, 1);
if (status < 0) { if (status < 0) {
...@@ -1422,9 +1430,14 @@ static int __ocfs2_recovery_thread(void *arg) ...@@ -1422,9 +1430,14 @@ static int __ocfs2_recovery_thread(void *arg)
* then quota usage would be out of sync until some node takes * then quota usage would be out of sync until some node takes
* the slot. So we remember which nodes need quota recovery * the slot. So we remember which nodes need quota recovery
* and when everything else is done, we recover quotas. */ * and when everything else is done, we recover quotas. */
for (i = 0; i < rm_quota_used && rm_quota[i] != slot_num; i++); if (quota_enabled) {
for (i = 0; i < rm_quota_used
&& rm_quota[i] != slot_num; i++)
;
if (i == rm_quota_used) if (i == rm_quota_used)
rm_quota[rm_quota_used++] = slot_num; rm_quota[rm_quota_used++] = slot_num;
}
status = ocfs2_recover_node(osb, node_num, slot_num); status = ocfs2_recover_node(osb, node_num, slot_num);
skip_recovery: skip_recovery:
...@@ -1452,6 +1465,7 @@ static int __ocfs2_recovery_thread(void *arg) ...@@ -1452,6 +1465,7 @@ static int __ocfs2_recovery_thread(void *arg)
/* Now it is right time to recover quotas... We have to do this under /* Now it is right time to recover quotas... We have to do this under
* superblock lock so that no one can start using the slot (and crash) * superblock lock so that no one can start using the slot (and crash)
* before we recover it */ * before we recover it */
if (quota_enabled) {
for (i = 0; i < rm_quota_used; i++) { for (i = 0; i < rm_quota_used; i++) {
qrec = ocfs2_begin_quota_recovery(osb, rm_quota[i]); qrec = ocfs2_begin_quota_recovery(osb, rm_quota[i]);
if (IS_ERR(qrec)) { if (IS_ERR(qrec)) {
...@@ -1459,10 +1473,12 @@ static int __ocfs2_recovery_thread(void *arg) ...@@ -1459,10 +1473,12 @@ static int __ocfs2_recovery_thread(void *arg)
mlog_errno(status); mlog_errno(status);
continue; continue;
} }
ocfs2_queue_recovery_completion(osb->journal, rm_quota[i], ocfs2_queue_recovery_completion(osb->journal,
rm_quota[i],
NULL, NULL, qrec, NULL, NULL, qrec,
ORPHAN_NEED_TRUNCATE); ORPHAN_NEED_TRUNCATE);
} }
}
ocfs2_super_unlock(osb, 1); ocfs2_super_unlock(osb, 1);
...@@ -1483,6 +1499,7 @@ static int __ocfs2_recovery_thread(void *arg) ...@@ -1483,6 +1499,7 @@ static int __ocfs2_recovery_thread(void *arg)
mutex_unlock(&osb->recovery_lock); mutex_unlock(&osb->recovery_lock);
if (quota_enabled)
kfree(rm_quota); kfree(rm_quota);
/* no one is callint kthread_stop() for us so the kthread() api /* no one is callint kthread_stop() for us so the kthread() api
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment