summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryangerkun <yangerkun@huawei.com>2019-02-17 20:07:02 -0500
committerJan Kara <jack@suse.cz>2019-02-18 09:14:43 -0500
commit93bc420ed41df63a18ae794101f7cbf45226a6ef (patch)
tree861e65e4751600ab8393460e6eb3c26412947b06
parent4f5edd82eb375f0e949192ac5a0b42858356e05d (diff)
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>
-rw-r--r--fs/ext2/ext2.h1
-rw-r--r--fs/ext2/file.c1
-rw-r--r--fs/ext2/inode.c26
-rw-r--r--fs/ext2/namei.c2
-rw-r--r--fs/ext2/symlink.c2
5 files changed, 32 insertions, 0 deletions
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index e770cd100a6a..ae0cd9e81e48 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -774,6 +774,7 @@ extern int ext2_write_inode (struct inode *, struct writeback_control *);
774extern void ext2_evict_inode(struct inode *); 774extern void ext2_evict_inode(struct inode *);
775extern int ext2_get_block(struct inode *, sector_t, struct buffer_head *, int); 775extern int ext2_get_block(struct inode *, sector_t, struct buffer_head *, int);
776extern int ext2_setattr (struct dentry *, struct iattr *); 776extern int ext2_setattr (struct dentry *, struct iattr *);
777extern int ext2_getattr (const struct path *, struct kstat *, u32, unsigned int);
777extern void ext2_set_inode_flags(struct inode *inode); 778extern void ext2_set_inode_flags(struct inode *inode);
778extern int ext2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, 779extern int ext2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
779 u64 start, u64 len); 780 u64 start, u64 len);
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index 28b2609f25c1..39c4772e96c9 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -199,6 +199,7 @@ const struct inode_operations ext2_file_inode_operations = {
199#ifdef CONFIG_EXT2_FS_XATTR 199#ifdef CONFIG_EXT2_FS_XATTR
200 .listxattr = ext2_listxattr, 200 .listxattr = ext2_listxattr,
201#endif 201#endif
202 .getattr = ext2_getattr,
202 .setattr = ext2_setattr, 203 .setattr = ext2_setattr,
203 .get_acl = ext2_get_acl, 204 .get_acl = ext2_get_acl,
204 .set_acl = ext2_set_acl, 205 .set_acl = ext2_set_acl,
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 17cdefdc62a8..c27c27300d95 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -1637,6 +1637,32 @@ int ext2_write_inode(struct inode *inode, struct writeback_control *wbc)
1637 return __ext2_write_inode(inode, wbc->sync_mode == WB_SYNC_ALL); 1637 return __ext2_write_inode(inode, wbc->sync_mode == WB_SYNC_ALL);
1638} 1638}
1639 1639
1640int ext2_getattr(const struct path *path, struct kstat *stat,
1641 u32 request_mask, unsigned int query_falgs)
1642{
1643 struct inode *inode = d_inode(path->dentry);
1644 struct ext2_inode_info *ei = EXT2_I(inode);
1645 unsigned int flags;
1646
1647 flags = ei->i_flags & EXT2_FL_USER_VISIBLE;
1648 if (flags & EXT2_APPEND_FL)
1649 stat->attributes |= STATX_ATTR_APPEND;
1650 if (flags & EXT2_COMPR_FL)
1651 stat->attributes |= STATX_ATTR_COMPRESSED;
1652 if (flags & EXT2_IMMUTABLE_FL)
1653 stat->attributes |= STATX_ATTR_IMMUTABLE;
1654 if (flags & EXT2_NODUMP_FL)
1655 stat->attributes |= STATX_ATTR_NODUMP;
1656 stat->attributes_mask |= (STATX_ATTR_APPEND |
1657 STATX_ATTR_COMPRESSED |
1658 STATX_ATTR_ENCRYPTED |
1659 STATX_ATTR_IMMUTABLE |
1660 STATX_ATTR_NODUMP);
1661
1662 generic_fillattr(inode, stat);
1663 return 0;
1664}
1665
1640int ext2_setattr(struct dentry *dentry, struct iattr *iattr) 1666int ext2_setattr(struct dentry *dentry, struct iattr *iattr)
1641{ 1667{
1642 struct inode *inode = d_inode(dentry); 1668 struct inode *inode = d_inode(dentry);
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index 0c26dcc5d850..ccfbbf59e2fc 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -416,6 +416,7 @@ const struct inode_operations ext2_dir_inode_operations = {
416#ifdef CONFIG_EXT2_FS_XATTR 416#ifdef CONFIG_EXT2_FS_XATTR
417 .listxattr = ext2_listxattr, 417 .listxattr = ext2_listxattr,
418#endif 418#endif
419 .getattr = ext2_getattr,
419 .setattr = ext2_setattr, 420 .setattr = ext2_setattr,
420 .get_acl = ext2_get_acl, 421 .get_acl = ext2_get_acl,
421 .set_acl = ext2_set_acl, 422 .set_acl = ext2_set_acl,
@@ -426,6 +427,7 @@ const struct inode_operations ext2_special_inode_operations = {
426#ifdef CONFIG_EXT2_FS_XATTR 427#ifdef CONFIG_EXT2_FS_XATTR
427 .listxattr = ext2_listxattr, 428 .listxattr = ext2_listxattr,
428#endif 429#endif
430 .getattr = ext2_getattr,
429 .setattr = ext2_setattr, 431 .setattr = ext2_setattr,
430 .get_acl = ext2_get_acl, 432 .get_acl = ext2_get_acl,
431 .set_acl = ext2_set_acl, 433 .set_acl = ext2_set_acl,
diff --git a/fs/ext2/symlink.c b/fs/ext2/symlink.c
index d5589ddcc281..00cdb8679486 100644
--- a/fs/ext2/symlink.c
+++ b/fs/ext2/symlink.c
@@ -23,6 +23,7 @@
23 23
24const struct inode_operations ext2_symlink_inode_operations = { 24const struct inode_operations ext2_symlink_inode_operations = {
25 .get_link = page_get_link, 25 .get_link = page_get_link,
26 .getattr = ext2_getattr,
26 .setattr = ext2_setattr, 27 .setattr = ext2_setattr,
27#ifdef CONFIG_EXT2_FS_XATTR 28#ifdef CONFIG_EXT2_FS_XATTR
28 .listxattr = ext2_listxattr, 29 .listxattr = ext2_listxattr,
@@ -31,6 +32,7 @@ const struct inode_operations ext2_symlink_inode_operations = {
31 32
32const struct inode_operations ext2_fast_symlink_inode_operations = { 33const struct inode_operations ext2_fast_symlink_inode_operations = {
33 .get_link = simple_get_link, 34 .get_link = simple_get_link,
35 .getattr = ext2_getattr,
34 .setattr = ext2_setattr, 36 .setattr = ext2_setattr,
35#ifdef CONFIG_EXT2_FS_XATTR 37#ifdef CONFIG_EXT2_FS_XATTR
36 .listxattr = ext2_listxattr, 38 .listxattr = ext2_listxattr,