ext4, project: expand inode extra size if possible

When upgrading from old format, try to set project id
to old file first time, it will return EOVERFLOW, but if
that file is dirtied(touch etc), changing project id will
be allowed, this might be confusing for users, we could
try to expand @i_extra_isize here too.

Reported-by: Zhang Yi <yi.zhang@huawei.com>
Signed-off-by: Miao Xie <miaoxie@huawei.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
Miao Xie 2017-08-06 01:00:49 -04:00 committed by Theodore Ts'o
parent b640b2c51b
commit c03b45b853
3 changed files with 90 additions and 29 deletions

View file

@ -349,11 +349,14 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
raw_inode = ext4_raw_inode(&iloc);
if (!EXT4_FITS_IN_INODE(raw_inode, ei, i_projid)) {
err = -EOVERFLOW;
err = ext4_expand_extra_isize(inode,
EXT4_SB(sb)->s_want_extra_isize,
&iloc);
if (err)
goto out_unlock;
} else {
brelse(iloc.bh);
goto out_unlock;
}
brelse(iloc.bh);
dquot_initialize(inode);