ext2: support statx syscall

Since statx, every filesystem should fill the attributes/attributes_mask
in routine getattr. But the generic_fillattr has not fill that, so add
ext2_getattr to do this. This can fix generic/424 while testing ext2.

Reviewed-by: zhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: yangerkun <yangerkun@huawei.com>
Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
yangerkun
2019-02-18 09:07:02 +08:00
committed by Jan Kara
parent 4f5edd82eb
commit 93bc420ed4
5 changed files with 32 additions and 0 deletions

View File

@@ -1637,6 +1637,32 @@ int ext2_write_inode(struct inode *inode, struct writeback_control *wbc)
return __ext2_write_inode(inode, wbc->sync_mode == WB_SYNC_ALL);
}
int ext2_getattr(const struct path *path, struct kstat *stat,
u32 request_mask, unsigned int query_falgs)
{
struct inode *inode = d_inode(path->dentry);
struct ext2_inode_info *ei = EXT2_I(inode);
unsigned int flags;
flags = ei->i_flags & EXT2_FL_USER_VISIBLE;
if (flags & EXT2_APPEND_FL)
stat->attributes |= STATX_ATTR_APPEND;
if (flags & EXT2_COMPR_FL)
stat->attributes |= STATX_ATTR_COMPRESSED;
if (flags & EXT2_IMMUTABLE_FL)
stat->attributes |= STATX_ATTR_IMMUTABLE;
if (flags & EXT2_NODUMP_FL)
stat->attributes |= STATX_ATTR_NODUMP;
stat->attributes_mask |= (STATX_ATTR_APPEND |
STATX_ATTR_COMPRESSED |
STATX_ATTR_ENCRYPTED |
STATX_ATTR_IMMUTABLE |
STATX_ATTR_NODUMP);
generic_fillattr(inode, stat);
return 0;
}
int ext2_setattr(struct dentry *dentry, struct iattr *iattr)
{
struct inode *inode = d_inode(dentry);