* Support for ext4 hidden quota inodes in quota-tools
@ 2011-11-22 20:12 Jan Kara
2011-11-22 23:51 ` Ted Ts'o
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2011-11-22 20:12 UTC (permalink / raw)
To: Aditya Kali; +Cc: adilger, tytso, dmonakhov, linux-ext4
Hello,
this is just a heads up that I've modified quota tools to handle
quota files in hidden inodes for ext4. Current source code can be pulled
from git repository at sf.net: linuxquota.git.sourceforge.net
For quota tools to recognize whether hidden inodes are used for quota or
not a patch below is needed. I plan to merge it in the next merge window.
When Aditya sends new version of the patch, I'll test whether everything
works together as expected...
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
---
>From e99ea5683c1c5604369ef8b01e2bcaaee532691e Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Wed, 16 Nov 2011 15:03:59 +0100
Subject: [PATCH] quota: Pass information that quota is stored in system file to userspace
Quota tools need to know whether quota is stored in a system file or in
classical aquota.{user|group} files. So pass this information as a flag
in GETINFO quotactl.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/quota/dquot.c | 8 +++++---
include/linux/quota.h | 6 +++++-
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 5b572c8..3f70d70 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2126,6 +2126,8 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
mutex_unlock(&dqopt->dqio_mutex);
goto out_file_init;
}
+ if (dqopt->flags & DQUOT_QUOTA_SYS_FILE)
+ dqopt->info[type].dqi_flags |= DQF_SYS_FILE;
mutex_unlock(&dqopt->dqio_mutex);
spin_lock(&dq_state_lock);
dqopt->flags |= dquot_state_flag(flags, type);
@@ -2465,7 +2467,7 @@ int dquot_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii)
spin_lock(&dq_data_lock);
ii->dqi_bgrace = mi->dqi_bgrace;
ii->dqi_igrace = mi->dqi_igrace;
- ii->dqi_flags = mi->dqi_flags & DQF_MASK;
+ ii->dqi_flags = mi->dqi_flags & DQF_GETINFO_MASK;
ii->dqi_valid = IIF_ALL;
spin_unlock(&dq_data_lock);
mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
@@ -2491,8 +2493,8 @@ int dquot_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii)
if (ii->dqi_valid & IIF_IGRACE)
mi->dqi_igrace = ii->dqi_igrace;
if (ii->dqi_valid & IIF_FLAGS)
- mi->dqi_flags = (mi->dqi_flags & ~DQF_MASK) |
- (ii->dqi_flags & DQF_MASK);
+ mi->dqi_flags = (mi->dqi_flags & ~DQF_SETINFO_MASK) |
+ (ii->dqi_flags & DQF_SETINFO_MASK);
spin_unlock(&dq_data_lock);
mark_info_dirty(sb, type);
/* Force write to disk */
diff --git a/include/linux/quota.h b/include/linux/quota.h
index cb78556..c09fa04 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -230,7 +230,11 @@ struct mem_dqinfo {
struct super_block;
#define DQF_MASK 0xffff /* Mask for format specific flags */
-#define DQF_INFO_DIRTY_B 16
+#define DQF_GETINFO_MASK 0x1ffff /* Mask for flags passed to userspace */
+#define DQF_SETINFO_MASK 0xffff /* Mask for flags modifiable from userspace */
+#define DQF_SYS_FILE_B 16
+#define DQF_SYS_FILE (1 << DQF_SYS_FILE_B) /* Quota file stored as system file */
+#define DQF_INFO_DIRTY_B 31
#define DQF_INFO_DIRTY (1 << DQF_INFO_DIRTY_B) /* Is info dirty? */
extern void mark_info_dirty(struct super_block *sb, int type);
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: Support for ext4 hidden quota inodes in quota-tools
2011-11-22 20:12 Support for ext4 hidden quota inodes in quota-tools Jan Kara
@ 2011-11-22 23:51 ` Ted Ts'o
2011-11-23 11:32 ` Jan Kara
0 siblings, 1 reply; 3+ messages in thread
From: Ted Ts'o @ 2011-11-22 23:51 UTC (permalink / raw)
To: Jan Kara; +Cc: Aditya Kali, adilger, dmonakhov, linux-ext4
On Tue, Nov 22, 2011 at 09:12:06PM +0100, Jan Kara wrote:
>
> this is just a heads up that I've modified quota tools to handle
> quota files in hidden inodes for ext4. Current source code can be pulled
> from git repository at sf.net: linuxquota.git.sourceforge.net
Could you give a quick summary of what the functionality the quota
tools will have vis-a-vis the hidden inodes? I assume things like
repquota will work. But will quotacheck work? Quite frankly I'd much
rather it didn't since then it might get confusing since some people
might try to do the evil thing of running quota check on a live file
system, with all of the races that might imply, versus using e2fsck to
check and update the quota files as part of the fsck process.
Also, I had hoped to have the model where quota tracking would be
enabled automatically when the file system was mounted, and there
would not be a way of disabling quota tracking except when the file
system was unmounted, so at least in theory the only way the quota
files could get stale is if the file system was corrupted or modified
directly via tools like e2tools or debugfs. Presumably we'll be able
to enforce this by having the kernel refuse the quotaoff quotactl
request, but I just want to make sure the overall user experience
between the kernel support, the e2fsprogs support, and the quota tools
all come together in a way that's optimal for the sysadmin who will
need to use all of this stuff.
Cheers,
- Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Support for ext4 hidden quota inodes in quota-tools
2011-11-22 23:51 ` Ted Ts'o
@ 2011-11-23 11:32 ` Jan Kara
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kara @ 2011-11-23 11:32 UTC (permalink / raw)
To: Ted Ts'o; +Cc: Jan Kara, Aditya Kali, adilger, dmonakhov, linux-ext4
On Tue 22-11-11 18:51:53, Ted Tso wrote:
> On Tue, Nov 22, 2011 at 09:12:06PM +0100, Jan Kara wrote:
> >
> > this is just a heads up that I've modified quota tools to handle
> > quota files in hidden inodes for ext4. Current source code can be pulled
> > from git repository at sf.net: linuxquota.git.sourceforge.net
>
> Could you give a quick summary of what the functionality the quota
> tools will have vis-a-vis the hidden inodes? I assume things like
> repquota will work. But will quotacheck work? Quite frankly I'd much
> rather it didn't since then it might get confusing since some people
> might try to do the evil thing of running quota check on a live file
> system, with all of the races that might imply, versus using e2fsck to
> check and update the quota files as part of the fsck process.
>
> Also, I had hoped to have the model where quota tracking would be
> enabled automatically when the file system was mounted, and there
> would not be a way of disabling quota tracking except when the file
> system was unmounted, so at least in theory the only way the quota
> files could get stale is if the file system was corrupted or modified
> directly via tools like e2tools or debugfs. Presumably we'll be able
> to enforce this by having the kernel refuse the quotaoff quotactl
> request, but I just want to make sure the overall user experience
> between the kernel support, the e2fsprogs support, and the quota tools
> all come together in a way that's optimal for the sysadmin who will
> need to use all of this stuff.
Sure. So quota-tools will provide functions like repquota(8), quota(1),
warnquota(1), setquota(8), and edquota(8) - i.e. editting of quota limits
and viewing of quota usage. Also quota_nld(8) will provide translation of
quota warnings coming via netlink into user visible messages on console (or
dbus messages).
quotacheck(8) will just refuse to do anything when it detects a
filesystem with hidden quota files so that should be OK. Behavior of
quotaon(8) pretty much depends on the kernel patch to ext4 since ext4
provides it's ->quotaon callback. In the last iteration of the patch quota
accounting was turned on during mount and quotaon(8) only influenced
whether we actually enforce set quota limits or not. So quota accounting
cannot be turned off and is precise all the time.
So I believe we are having the same target in mind.
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-11-23 11:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-22 20:12 Support for ext4 hidden quota inodes in quota-tools Jan Kara
2011-11-22 23:51 ` Ted Ts'o
2011-11-23 11:32 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox