Re: [PATCH] ext4: compare inode's i_projid with EXT4_DEF_PROJID rather than check EXT4_INODE_PROJINHERIT flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 10, 2021 at 10:55:10PM +0300, Roman Anufriev wrote:
> 
> On Tue, 7 Dec 2021, Theodore Y. Ts'o wrote:
> 
> > On Tue, Dec 07, 2021 at 05:05:19PM +0300, Roman Anufriev wrote:
> > > > Commit 7ddf79a10395 ("ext4: only set project inherit bit for directory")
> > > > removes EXT4_INODE_PROJINHERIT flag from regular files. This makes
> > > > ext4_statfs() output incorrect (function does not apply quota limits
> > > > on used/available space, etc) when called on dentry of regular file
> > > > with project quota enabled.
> > 
> > Under what circumstance is userspace trying to call statfs on a file
> > descriptor?
> > 
> > Removing the test for EXT4_INODE_PROJINHERIT will cause
> > incorrect/misleading results being returned in the case where we have
> > a directory where a directory hierarchy is using project id's, but
> > which is *not* using PROJINHERIT.
> 
> I'm not sure I quite understood what will be wrong in that case, because
> as Dave mentioned:
> 
> > PROJINHERIT just indicates the default projid that an inode is
> > created with; ...

Directory inodes can have a project ID set without PROJINHERIT, it
just means they are accounted to that specific project and have no
special behaviour w.r.t. newly created children in the directory.
i.e. without PROJINHERIT, all children will be created with a
proj ID of zero rather than the projid of the parent directory.

i.e. I can do `xfs_io -c "chproj -R 42" /mnt/test` and it will set
all filesystem and directories to have a projid = 42, but
PROJINHERIT is not set on any directory. The tree gets accounted to
project 42, but it isn't a directory tree quota - it's just a user
controlled aggregation of random files associated with the same
project ID.

Hence the statfs behaviour of "report project quota limits for
directory tree" should only be triggered if PROJINHERIT is set on
the directory, because that's the only viable indicator that
directory tree quotas *may* be in use on the filesystem.

Cheers,

Dave.

-- 
Dave Chinner
david@xxxxxxxxxxxxx



[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux