From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dmitry Monakhov Subject: [PATCH 3/3] ext3: check quota error state on quota_off Date: Wed, 31 Mar 2010 13:00:37 +0400 Message-ID: <1270026037-22187-3-git-send-email-dmonakhov@openvz.org> References: <1270026037-22187-1-git-send-email-dmonakhov@openvz.org> <1270026037-22187-2-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]:56326 "EHLO mail-bw0-f209.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932944Ab0CaJAu (ORCPT ); Wed, 31 Mar 2010 05:00:50 -0400 Received: by bwz1 with SMTP id 1so5013203bwz.21 for ; Wed, 31 Mar 2010 02:00:48 -0700 (PDT) In-Reply-To: <1270026037-22187-2-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/ext3/super.c | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git a/fs/ext3/super.c b/fs/ext3/super.c index e844acc..e703766 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c @@ -745,6 +745,7 @@ static int ext3_mark_dquot_dirty(struct dquot *dquot); static int ext3_write_info(struct super_block *sb, int type); static int ext3_quota_on(struct super_block *sb, int type, int format_id, char *path, int remount); +static int ext3_quota_off(struct super_block *sb, int type, int remount); static int ext3_quota_on_mount(struct super_block *sb, int type); static ssize_t ext3_quota_read(struct super_block *sb, int type, char *data, size_t len, loff_t off); @@ -763,7 +764,7 @@ static const struct dquot_operations ext3_quota_operations = { static const struct quotactl_ops ext3_qctl_operations = { .quota_on = ext3_quota_on, - .quota_off = vfs_quota_off, + .quota_off = ext3_quota_off, .quota_sync = vfs_quota_sync, .get_info = vfs_get_dqinfo, .set_info = vfs_set_dqinfo, @@ -1511,7 +1512,7 @@ static void ext3_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); + ext3_quota_off(sb, i, 0); } #endif sb->s_flags = s_flags; /* Restore MS_RDONLY status */ @@ -2894,6 +2895,17 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id, return err; } +int ext3_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)) + ext3_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