ceph: don't set st_dev to 0 for stat(2)
PATCH 1/1 ceph: don't set st_dev to 0 for stat(2)
Zero st_dev confuses ls(1) code. it make 'ls -l' not print '+' sign for file/directory with ACL.
--- fs/ceph/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/inode.c +1 -1
@@ -2244,7 +2244,7 @@ int ceph_getattr(const struct path *path, struct kstat *stat,if (ceph_snap (inode) !=CEPH_NOSNAP ) stat->dev =ceph_snap (inode);else - stat->dev =0 ; + stat->dev =1 ;/* the smallest snapid is 2 */ if (S_ISDIR (inode->i_mode)) {if (ceph_test_mount_opt (ceph_sb_to_client (inode->i_sb),RBYTES ))
Signature · 1 line
2.13.6
Quoted 13 lines · Zheng
Zero
st_devconfuses ls(1) code. it make 'ls -l' not print '+' sign for file/directory with ACL.Signed-off-by "Yan, Zheng" <[email protected]>--- fs/ceph/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/ceph/inode.c +0
-0
fs/ceph/inode.c int ceph_getattr(const struct path *path, struct kstat *stat, · line 2250
Quoted 8 lines
fs/ceph/inode.c +1
-1@@ -2244,7 +2244,7 @@ int ceph_getattr(const struct path *path, struct kstat *stat,if (ceph_snap (inode) !=CEPH_NOSNAP ) stat->dev =ceph_snap (inode);else - stat->dev =0 ; + stat->dev =1 ;/* the smallest snapid is 2 */ if (S_ISDIR (inode->i_mode)) {if (ceph_test_mount_opt (ceph_sb_to_client (inode->i_sb),RBYTES ))
This looks wrong to me.
This should be getting filled out with the value of the sb->s_dev field in generic_fillattr. The right fix would be to ensure that that field ends up with something valid in it, and that should be happening when we call set_anon_super.
I think we need to understand why that isn't happening here.
Signature · 1 line
Jeff Layton <[email protected]>
Quoted 29 lines · Jeff Layton
Quoted 13 lines · Zheng
Zero
st_devconfuses ls(1) code. it make 'ls -l' not print '+' sign for file/directory with ACL.Signed-off-by "Yan, Zheng" <[email protected]>---
fs/ceph/inode.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)fs/ceph/inode.c +0
-0fs/ceph/inode.c int ceph_getattr(const struct path *path, struct kstat *stat, · line 2250
Quoted 8 lines
fs/ceph/inode.c +1
-1@@ -2244,7 +2244,7 @@ int ceph_getattr(const struct path *path, struct kstat *stat,if (ceph_snap (inode) !=CEPH_NOSNAP ) stat->dev =ceph_snap (inode);else - stat->dev =0 ; + stat->dev =1 ;/* the smallest snapid is 2 */ if (S_ISDIR (inode->i_mode)) {if (ceph_test_mount_opt (ceph_sb_to_client (inode->i_sb),RBYTES ))This looks wrong to me.
Quoted 6 lines
This should be getting filled out with the value of the
sb->s_devfield ingeneric_fillattr. The right fix would be to ensure that that field ends up with something valid in it, and that should be happening when we callset_anon_super.I think we need to understand why that isn't happening here.
I think the reason we set st_dev to snapid is to distinguish head inode from snapped inode. It avoids user programs (eg backup program) from recognizing snapped inode as the same as head inode. (We probably can allocate an anon super for each snapid we encountered)
Regards
Yan, Zheng
Quoted 3 lines
Signature · 2 lines
-- Jeff Layton <[email protected]>
Quoted 27 lines · Zheng
Quoted 27 lines · Jeff Layton
Quoted 13 lines · Zheng
Zero
st_devconfuses ls(1) code. it make 'ls -l' not print '+' sign for file/directory with ACL.Signed-off-by "Yan, Zheng" <[email protected]>---
fs/ceph/inode.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)fs/ceph/inode.c +0
-0fs/ceph/inode.c int ceph_getattr(const struct path *path, struct kstat *stat, · line 2250
Quoted 8 lines
fs/ceph/inode.c +1
-1@@ -2244,7 +2244,7 @@ int ceph_getattr(const struct path *path, struct kstat *stat,if (ceph_snap (inode) !=CEPH_NOSNAP ) stat->dev =ceph_snap (inode);else - stat->dev =0 ; + stat->dev =1 ;/* the smallest snapid is 2 */ if (S_ISDIR (inode->i_mode)) {if (ceph_test_mount_opt (ceph_sb_to_client (inode->i_sb),RBYTES ))This looks wrong to me.
Quoted 9 lines
Quoted 6 lines
This should be getting filled out with the value of the
sb->s_devfield ingeneric_fillattr. The right fix would be to ensure that that field ends up with something valid in it, and that should be happening when we callset_anon_super.I think we need to understand why that isn't happening here.
I think the reason we set
st_devto snapid is to distinguish head inode from snapped inode. It avoids user programs (eg backup program) from recognizing snapped inode as the same as head inode. (We probably can allocate an anon super for each snapid we encountered)
Yes, that would make more sense.
I'm not sure you need a separate sb for each one (though it would make a lot of sense to do what NFS does here and create a shrinkable mount when the fsid changes).
It may be sufficient to just call get_anon_bdev / free_anon_bdev to get a unique device number, and then track them somehow.
Signature · 1 line
Jeff Layton <[email protected]>