From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dmitry Monakhov Subject: [PATCH 2/3] ext4: check quota error state on quota_off Date: Wed, 31 Mar 2010 13:00:36 +0400 Message-ID: <1270026037-22187-2-git-send-email-dmonakhov@openvz.org> References: <1270026037-22187-1-git-send-email-dmonakhov@openvz.org> Cc: jack@suse.cz, Dmitry Monakhov To: linux-fsdevel@vger.kernel.org Return-path: Received: from mail-bw0-f209.google.com ([209.85.218.209]:48331 "EHLO mail-bw0-f209.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932711Ab0CaJAs (ORCPT ); Wed, 31 Mar 2010 05:00:48 -0400 Received: by bwz1 with SMTP id 1so5013184bwz.21 for ; Wed, 31 Mar 2010 02:00:46 -0700 (PDT) In-Reply-To: <1270026037-22187-1-git-send-email-dmonakhov@openvz.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: quota is another type of metadata and quota inconsistency must being handled properly. Signed-off-by: Dmitry Monakhov --- fs/ext4/super.c | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index edcf3b0..45df193 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1006,6 +1006,7 @@ static int ext4_mark_dquot_dirty(struct dquot *dquot); static int ext4_write_info(struct super_block *sb, int type); static int ext4_quota_on(struct super_block *sb, int type, int format_id, char *path, int remount); +static int ext4_quota_off(struct super_block *sb, int type, int remount); static int ext4_quota_on_mount(struct super_block *sb, int type); static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data, size_t len, loff_t off); @@ -1027,7 +1028,7 @@ static const struct dquot_operations ext4_quota_operations = { static const struct quotactl_ops ext4_qctl_operations = { .quota_on = ext4_quota_on, - .quota_off = vfs_quota_off, + .quota_off = ext4_quota_off, .quota_sync = vfs_quota_sync, .get_info = vfs_get_dqinfo, .set_info = vfs_set_dqinfo, @@ -1962,7 +1963,7 @@ static void ext4_orphan_cleanup(struct super_block *sb, /* Turn quotas off */ for (i = 0; i < MAXQUOTAS; i++) { if (sb_dqopt(sb)->files[i]) - vfs_quota_off(sb, i, 0); + ext4_quota_off(sb, i, 0); } #endif sb->s_flags = s_flags; /* Restore MS_RDONLY status */ @@ -3859,6 +3860,17 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, return err; } +int ext4_quota_off(struct super_block *sb, int type, int remount) +{ + int ret; + ret = vfs_quota_disable(sb, type, remount ? DQUOT_SUSPENDED : + (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED)); + if (test_and_clear_bit(_DQUOT_ERROR, &sb_dqopt(sb)->flags)) + ext4_error(sb, __func__, + "Disk quota is probably inconsistent."); + return ret; +} + /* Read data from quotafile - avoid pagecache and such because we cannot afford * acquiring the locks... As quota files are never truncated and quota code * itself serializes the operations (and noone else should touch the files) -- 1.6.6.1