linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>
To: Li Xi <pkuelelixi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>,
	"linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Ext4 Developers List
	<linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Theodore Ts'o <tytso-3s7WtUTddSA@public.gmane.org>,
	Andreas Dilger <adilger-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org>,
	"viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org"
	<viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org>,
	"hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org"
	<hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	Dmitry Monakhov
	<dmonakhov-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH 3/4] Adds project quota support for ext4
Date: Thu, 25 Sep 2014 13:55:31 +0200	[thread overview]
Message-ID: <20140925115531.GA15352@quack.suse.cz> (raw)
In-Reply-To: <CAPTn0cB8X3DYprX-oKCu8aV5OLLfJJ2rh9YvMY7re69gi1s-LA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Thu 25-09-14 09:28:24, Li Xi wrote:
> On Thu, Sep 25, 2014 at 1:31 AM, Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org> wrote:
> > On Wed 24-09-14 22:04:29, Li Xi wrote:
> >> This patch adds mount options for enabling/disabling project quota
> >> accounting and enforcement. A new specific inode is also used for
> >> project quota accounting.
> >   The patch looks mostly fine. A few smaller things below.
> >
> > ...
> >> @@ -1433,6 +1437,8 @@ static const struct mount_opts {
> >>                                                       MOPT_SET | MOPT_Q},
> >>       {Opt_grpquota, EXT4_MOUNT_QUOTA | EXT4_MOUNT_GRPQUOTA,
> >>                                                       MOPT_SET | MOPT_Q},
> >> +     {Opt_prjquota, EXT4_MOUNT_QUOTA | EXT4_MOUNT_PRJQUOTA,
> >> +                                                     MOPT_SET | MOPT_Q},
> >>       {Opt_noquota, (EXT4_MOUNT_QUOTA | EXT4_MOUNT_USRQUOTA |
> >>                      EXT4_MOUNT_GRPQUOTA), MOPT_CLEAR | MOPT_Q},
> >   I think you missed to add EXT4_MOUNT_PRJQUOTA to Opt_noquota...
> >
> > ...
> >> @@ -2833,6 +2855,13 @@ static int ext4_feature_set_ok(struct super_block *sb, int readonly)
> >>                        "without CONFIG_QUOTA");
> >>               return 0;
> >>       }
> >> +     if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_PROJECT) &&
> >> +         !readonly) {
> >> +             ext4_msg(sb, KERN_ERR,
> >> +                      "Filesystem with project quota feature cannot be"
> >> +                      "mounted RDWR without CONFIG_QUOTA");
> >> +             return 0;
> >> +     }
> >   Hum, I don't think this is right. EXT4_FEATURE_RO_COMPAT_PROJECT is about
> > maintaining project IDs not about quota. So it seems perfectly OK to have
> > EXT4_FEATURE_RO_COMPAT_PROJECT without CONFIG_QUOTA.
> Ah, I see. This might be my main misunderstanding. I thought it is
> about maintaining
> both project IDs and quota. And I misunderstood so that I removed all
> EXT4_FEATURE_RO_COMPAT_PROJECT checking when set/get project ID.
> If we only use EXT4_FEATURE_RO_COMPAT_PROJECT to protect imcompatibility
> of project ID, what about the change of struct ext4_super_block? I am
> still confused.
  So my vision is following:
EXT4_FEATURE_RO_COMPAT_PROJECT feature controls whether project IDs can be
stored in inode. So you don't allow project ID to be set for a superblock
without this feature. This is absolutely necessary since otherwise old
kernel could happily mount filesystem with project IDs set and would just
overwrite them. The same applies to PROJINHERIT flag.

Getting of project ID could be easily done without
EXT4_FEATURE_RO_COMPAT_PROJECT feature (just return 0) but I think
returning EOPNOTSUPP would be better for userspace programs - they
can immediatedy distinguish filesystems without project IDs and filesystems
where just the file doesn't have any project ID set.

Whether project quota is accounted and enforced is a different matter.
Without EXT4_FEATURE_RO_COMPAT_QUOTA feature it is userspace which is
responsible for properly setting up quotas so you can just use
sb_has_quota_loaded() and similar functions. With
EXT4_FEATURE_RO_COMPAT_QUOTA, kernel is responsible for setting up quotas
and we decide whether we should setup project quotas depending on whether
s_prj_quota_inum is set (tools should then make sure s_prj_quota_inum is
set only if EXT4_FEATURE_RO_COMPAT_QUOTA and EXT4_FEATURE_RO_COMPAT_PROJECT
are set but we can assert that in the kernel just to make sure).

Hope this makes things clearer.

								Honza
-- 
Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>
SUSE Labs, CR

  parent reply	other threads:[~2014-09-25 11:55 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-24 14:04 [PATCH 0/4] quota: add project quota support Li Xi
2014-09-24 14:04 ` [PATCH 1/4] Adds general codes to enforces project quota limits Li Xi
2014-09-24 16:08   ` Jan Kara
     [not found]   ` <1411567470-31799-2-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
2014-09-24 16:14     ` Christoph Hellwig
     [not found]       ` <20140924161417.GA1978-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2014-09-24 17:10         ` Jan Kara
     [not found]           ` <20140924171020.GF27000-+0h/O2h83AeN3ZZ/Hiejyg@public.gmane.org>
2014-09-24 17:13             ` Christoph Hellwig
     [not found]               ` <20140924171306.GA23874-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2014-09-24 17:37                 ` Jan Kara
2014-09-30 20:07     ` Jan Kara
2014-09-24 14:04 ` [PATCH 2/4] Adds project ID support for ext4 Li Xi
2014-09-24 17:11   ` Jan Kara
2014-09-25  1:09     ` Li Xi
2014-09-24 14:04 ` [PATCH 3/4] Adds project quota " Li Xi
     [not found]   ` <1411567470-31799-4-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
2014-09-24 17:31     ` Jan Kara
     [not found]       ` <20140924173123.GH27000-+0h/O2h83AeN3ZZ/Hiejyg@public.gmane.org>
2014-09-25  1:28         ` Li Xi
     [not found]           ` <CAPTn0cB8X3DYprX-oKCu8aV5OLLfJJ2rh9YvMY7re69gi1s-LA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-25 11:55             ` Jan Kara [this message]
2014-09-24 14:04 ` [PATCH 4/4] Adds ioctl interface support for ext4 project Li Xi
2014-09-24 16:25   ` Jan Kara
2014-09-24 16:26     ` Christoph Hellwig
2014-09-24 17:01       ` Jan Kara
2014-09-25  7:59         ` Dave Chinner
2014-09-25 11:34           ` lixi
     [not found]             ` <C31A739F-4502-4B40-9AE3-F2FE49291657-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-26  0:10               ` Dave Chinner
2014-09-26  2:45                 ` Li Xi
2014-09-25 13:41           ` Theodore Ts'o
     [not found]             ` <20140925134136.GE4592-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
2014-09-25 22:22               ` Dave Chinner
2014-09-25 13:52           ` Jan Kara
2014-09-25 22:42             ` Dave Chinner
2014-09-26 12:01               ` Theodore Ts'o
2014-09-29 15:55               ` Jan Kara
2014-09-25  7:26     ` Dave Chinner
     [not found]   ` <1411567470-31799-5-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
2014-09-24 16:43     ` Jan Kara

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=20140925115531.GA15352@quack.suse.cz \
    --to=jack-alswssmvlrq@public.gmane.org \
    --cc=adilger-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org \
    --cc=dmonakhov-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org \
    --cc=hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=pkuelelixi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=tytso-3s7WtUTddSA@public.gmane.org \
    --cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).