nfs: Set MS_POSIXACL always
Subsystems (2)
PATCH 1/1 nfs: Set MS_POSIXACL always
We want to skip VFS applying mode for NFS. So set MS_POSIXACL always and selectively use umask. Ideally we would want to use umask only when we don't have inheritable ACEs set. But NFS currently don't allow to send umask to the server. So this is best what we can do and this is consistent with NFSv3
--- fs/nfs/dir.c | 3 +-- fs/nfs/nfs4proc.c | 5 +++++ fs/nfs/super.c | 10 ++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-)
fs/nfs/dir.c +1 -2
@@ -1361,8 +1361,7 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentryif (nd->flags &LOOKUP_CREATE ) { attr.ia_mode = nd->intent.open.create_mode; attr.ia_valid =ATTR_MODE ; -if (!IS_POSIXACL (dir)) - attr.ia_mode &= ~current_umask (); + attr.ia_mode &= ~current_umask (); }else { open_flags &= ~(O_EXCL |O_CREAT ); attr.ia_valid =0 ;
fs/nfs/nfs4proc.c +5 -0
@@ -2486,6 +2486,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, path = &ctx->path; fmode = ctx->mode; } + sattr->ia_mode &= ~current_umask (); state =nfs4_do_open (dir, path, fmode, flags, sattr, cred);d_drop (dentry);if (IS_ERR (state)) {
@@ -2816,6 +2817,8 @@ static int nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry, { struct nfs4_exception exception = { }; int err; + + sattr->ia_mode &= ~current_umask(); do { err = nfs4_handle_exception(NFS_SERVER(dir), _nfs4_proc_mkdir(dir, dentry, sattr),
@@ -2916,6 +2919,8 @@ static int nfs4_proc_mknod(struct inode *dir, struct dentry *dentry, { struct nfs4_exception exception = { }; int err; + + sattr->ia_mode &= ~current_umask(); do { err = nfs4_handle_exception(NFS_SERVER(dir), _nfs4_proc_mknod(dir, dentry, sattr, rdev),
fs/nfs/super.c +10 -0
@@ -2498,6 +2498,11 @@ static void nfs4_clone_super(struct super_block *sb, sb->s_maxbytes = old_sb->s_maxbytes; sb->s_time_gran =1 ; sb->s_op = old_sb->s_op; +/* +* The VFS shouldn't apply the umask to mode bits. We will do +* so ourselves when necessary. +*/ + sb->s_flags |=MS_POSIXACL ;nfs_initialise_sb (sb); }
@@ -2508,6 +2513,11 @@ static void nfs4_fill_super(struct super_block *sb) { sb->s_time_gran =1 ; sb->s_op = &nfs4_sops; +/* +* The VFS shouldn't apply the umask to mode bits. We will do +* so ourselves when necessary. +*/ + sb->s_flags |=MS_POSIXACL ;nfs_initialise_sb (sb); }
Signature · 1 line
1.7.1
Any update on this ?
-aneesh
Quoted 88 lines · Aneesh Kumar K.V
We want to skip VFS applying mode for NFS. So set
MS_POSIXACLalways and selectively use umask. Ideally we would want to use umask only when we don't have inheritable ACEs set. But NFS currently don't allow to send umask to the server. So this is best what we can do and this is consistent with NFSv3Signed-off-by Aneesh Kumar K.V <[email protected]>--- fs/nfs/dir.c | 3 +-- fs/nfs/nfs4proc.c | 5 +++++ fs/nfs/super.c | 10 ++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-)fs/nfs/dir.c +1
-2@@ -1361,8 +1361,7 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentryif (nd->flags &LOOKUP_CREATE ) { attr.ia_mode = nd->intent.open.create_mode; attr.ia_valid =ATTR_MODE ; -if (!IS_POSIXACL (dir)) - attr.ia_mode &= ~current_umask (); + attr.ia_mode &= ~current_umask (); }else { open_flags &= ~(O_EXCL |O_CREAT ); attr.ia_valid =0 ;fs/nfs/nfs4proc.c +5
-0@@ -2486,6 +2486,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, path = &ctx->path; fmode = ctx->mode; } + sattr->ia_mode &= ~current_umask (); state =nfs4_do_open (dir, path, fmode, flags, sattr, cred);d_drop (dentry);if (IS_ERR (state)) {@@ -2816,6 +2817,8 @@ static int nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry, { struct nfs4_exception exception = { }; int err; + + sattr->ia_mode &= ~current_umask(); do { err = nfs4_handle_exception(NFS_SERVER(dir), _nfs4_proc_mkdir(dir, dentry, sattr),@@ -2916,6 +2919,8 @@ static int nfs4_proc_mknod(struct inode *dir, struct dentry *dentry, { struct nfs4_exception exception = { }; int err; + + sattr->ia_mode &= ~current_umask(); do { err = nfs4_handle_exception(NFS_SERVER(dir), _nfs4_proc_mknod(dir, dentry, sattr, rdev),fs/nfs/super.c +10
-0@@ -2498,6 +2498,11 @@ static void nfs4_clone_super(struct super_block *sb, sb->s_maxbytes = old_sb->s_maxbytes; sb->s_time_gran =1 ; sb->s_op = old_sb->s_op; +/* +* The VFS shouldn't apply the umask to mode bits. We will do +* so ourselves when necessary. +*/ + sb->s_flags |=MS_POSIXACL ;nfs_initialise_sb (sb); }@@ -2508,6 +2513,11 @@ static void nfs4_fill_super(struct super_block *sb) { sb->s_time_gran =1 ; sb->s_op = &nfs4_sops; +/* +* The VFS shouldn't apply the umask to mode bits. We will do +* so ourselves when necessary. +*/ + sb->s_flags |=MS_POSIXACL ;nfs_initialise_sb (sb); }Signature · 1 line
1.7.1
Quoted 18 lines · Aneesh Kumar K. V
Any update on this ?
-aneesh
Quoted 13 lines · Aneesh Kumar K.V
We want to skip VFS applying mode for NFS. So set
MS_POSIXACLalways and selectively use umask. Ideally we would want to use umask only when we don't have inheritable ACEs set. But NFS currently don't allow to send umask to the server. So this is best what we can do and this is consistent with NFSv3Signed-off-by Aneesh Kumar K.V <[email protected]>--- fs/nfs/dir.c | 3 +-- fs/nfs/nfs4proc.c | 5 +++++ fs/nfs/super.c | 10 ++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-)
Quoted 15 lines
Quoted 5 lines
fs/nfs/super.c +0
-0fs/nfs/super.c static void nfs4_fill_super(struct super_block *sb) · line 2522
Quoted 10 lines
fs/nfs/super.c +5
-0@@ -2508,6 +2513,11 @@ static void nfs4_fill_super(struct super_block *sb) { sb->s_time_gran =1 ; sb->s_op = &nfs4_sops; +/* +* The VFS shouldn't apply the umask to mode bits. We will do +* so ourselves when necessary. +*/ + sb->s_flags |=MS_POSIXACL ;nfs_initialise_sb (sb); }
Won't this end up possibly turning on ACL checking in acl_permission_check()?
Cheers
Trond
Signature · 6 lines
Trond Myklebust Linux NFS client maintainer NetApp [email protected] www.netapp.com
Quoted 29 lines · Trond Myklebust
Quoted 28 lines · Aneesh Kumar K. V
Any update on this ?
-aneesh
Quoted 23 lines · Aneesh Kumar K.V
We want to skip VFS applying mode for NFS. So set
MS_POSIXACLalways and selectively use umask. Ideally we would want to use umask only when we don't have inheritable ACEs set. But NFS currently don't allow to send umask to the server. So this is best what we can do and this is consistent with NFSv3Signed-off-by Aneesh Kumar K.V <[email protected]>--- fs/nfs/dir.c | 3 +-- fs/nfs/nfs4proc.c | 5 +++++ fs/nfs/super.c | 10 ++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-)fs/nfs/super.c +2
-0@@ -2508,6 +2513,11 @@ static void nfs4_fill_super(struct super_block *sb) { sb->s_time_gran =1 ; sb->s_op = &nfs4_sops; +/* +* The VFS shouldn't apply the umask to mode bits. We will do
Quoted 8 lines
Quoted 5 lines
fs/nfs/super.c static void nfs4_clone_super(struct super_block *sb, · line 2507
Quoted 5 lines
fs/nfs/super.c +3
-0+* so ourselves when necessary. +*/ + sb->s_flags |=MS_POSIXACL ;nfs_initialise_sb (sb); }Won't this end up possibly turning on ACL checking in
acl_permission_check()?
acl_permission_check get called only when we don't define an inode->permission callback. In case of nfs client we do define nfs_permission callback. In case we don't define a access NFS proto callback we are still ok because in that case we want mode based validation and we do pass check_acl as NULL
-aneesh
Quoted 39 lines · Aneesh Kumar K. V
Quoted 29 lines · Trond Myklebust
Quoted 28 lines · Aneesh Kumar K. V
Any update on this ?
-aneesh
Quoted 23 lines · Aneesh Kumar K.V
We want to skip VFS applying mode for NFS. So set
MS_POSIXACLalways and selectively use umask. Ideally we would want to use umask only when we don't have inheritable ACEs set. But NFS currently don't allow to send umask to the server. So this is best what we can do and this is consistent with NFSv3Signed-off-by Aneesh Kumar K.V <[email protected]>--- fs/nfs/dir.c | 3 +-- fs/nfs/nfs4proc.c | 5 +++++ fs/nfs/super.c | 10 ++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-)fs/nfs/super.c +2
-0@@ -2508,6 +2513,11 @@ static void nfs4_fill_super(struct super_block *sb) { sb->s_time_gran =1 ; sb->s_op = &nfs4_sops; +/* +* The VFS shouldn't apply the umask to mode bits. We will do Quoted 8 lines
Quoted 5 lines
fs/nfs/super.c static void nfs4_clone_super(struct super_block *sb, · line 2507
Quoted 5 lines
fs/nfs/super.c +3
-0+* so ourselves when necessary. +*/ + sb->s_flags |=MS_POSIXACL ;nfs_initialise_sb (sb); }Won't this end up possibly turning on ACL checking in
acl_permission_check()?
Quoted 6 lines
acl_permission_checkget called only when we don't define aninode->permissioncallback. In case of nfs client we do definenfs_permissioncallback. In case we don't define a access NFS proto callback we are still ok because in that case we want mode based validation and we do passcheck_aclas NULL
Can we get this upstream ?
-aneesh