From: Eric Whitney <enwlinux@gmail.com>
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu
Subject: [PATCH] tune2fs: fix quota enablement regression
Date: Fri, 3 Feb 2017 22:23:34 -0500 [thread overview]
Message-ID: <20170204032334.GA6952@localhost.localdomain> (raw)
Commit 5c2a665afa (Avoid dereferencing beyond allocated memory in quota
handling) induced a quota enablement regression in tune2fs. Attempts
to enable a particular quota type (tune2fs -O project <dev>, for
example) set the appropriate feature flag in the superblock but the
quota file for the type is not initialized.
The regression prevents the current version of xfstests from running
generic/383, 384, 385, and 386 (all project quota tests) with e2fsprogs
1.43.4. These tests exit with the message "Installed kernel does not
support project quotas", but the actual problem is that the project
quota file is not present.
Signed-off-by: Eric Whitney <enwlinux@gmail.com>
---
misc/tune2fs.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 6239577..f1bad60 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -1483,7 +1483,7 @@ static void handle_quota_options(ext2_filsys fs)
quota_ctx_t qctx;
ext2_ino_t qf_ino;
enum quota_type qtype;
- int enable = 0;
+ unsigned int qtype_bits = 0;
for (qtype = 0 ; qtype < MAXQUOTAS; qtype++)
if (quota_enable[qtype] != 0)
@@ -1492,19 +1492,19 @@ static void handle_quota_options(ext2_filsys fs)
/* Nothing to do. */
return;
- retval = quota_init_context(&qctx, fs, 0);
+ for (qtype = 0; qtype < MAXQUOTAS; qtype++) {
+ if (quota_enable[qtype] == QOPT_ENABLE)
+ qtype_bits |= 1 << qtype;
+ }
+
+ retval = quota_init_context(&qctx, fs, qtype_bits);
if (retval) {
com_err(program_name, retval,
_("while initializing quota context in support library"));
exit(1);
}
- for (qtype = 0 ; qtype < MAXQUOTAS; qtype++) {
- if (quota_enable[qtype] == QOPT_ENABLE) {
- enable = 1;
- break;
- }
- }
- if (enable)
+
+ if (qtype_bits)
quota_compute_usage(qctx);
for (qtype = 0 ; qtype < MAXQUOTAS; qtype++) {
@@ -1540,7 +1540,7 @@ static void handle_quota_options(ext2_filsys fs)
quota_release_context(&qctx);
- if (enable) {
+ if (qtype_bits) {
ext2fs_set_feature_quota(fs->super);
ext2fs_mark_super_dirty(fs);
} else {
--
2.1.4
next reply other threads:[~2017-02-04 3:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-04 3:23 Eric Whitney [this message]
2017-02-06 2:01 ` [PATCH] tune2fs: fix quota enablement regression Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170204032334.GA6952@localhost.localdomain \
--to=enwlinux@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox