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 Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
bf0c84f161
commit
a8a5da996d
@ -1352,7 +1352,6 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry
|
|||||||
if (nd->flags & LOOKUP_CREATE) {
|
if (nd->flags & LOOKUP_CREATE) {
|
||||||
attr.ia_mode = nd->intent.open.create_mode;
|
attr.ia_mode = nd->intent.open.create_mode;
|
||||||
attr.ia_valid = ATTR_MODE;
|
attr.ia_valid = ATTR_MODE;
|
||||||
if (!IS_POSIXACL(dir))
|
|
||||||
attr.ia_mode &= ~current_umask();
|
attr.ia_mode &= ~current_umask();
|
||||||
} else {
|
} else {
|
||||||
open_flags &= ~(O_EXCL | O_CREAT);
|
open_flags &= ~(O_EXCL | O_CREAT);
|
||||||
|
@ -2486,6 +2486,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
|
|||||||
path = &ctx->path;
|
path = &ctx->path;
|
||||||
fmode = ctx->mode;
|
fmode = ctx->mode;
|
||||||
}
|
}
|
||||||
|
sattr->ia_mode &= ~current_umask();
|
||||||
state = nfs4_do_open(dir, path, fmode, flags, sattr, cred);
|
state = nfs4_do_open(dir, path, fmode, flags, sattr, cred);
|
||||||
d_drop(dentry);
|
d_drop(dentry);
|
||||||
if (IS_ERR(state)) {
|
if (IS_ERR(state)) {
|
||||||
@ -2816,6 +2817,8 @@ static int nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry,
|
|||||||
{
|
{
|
||||||
struct nfs4_exception exception = { };
|
struct nfs4_exception exception = { };
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
sattr->ia_mode &= ~current_umask();
|
||||||
do {
|
do {
|
||||||
err = nfs4_handle_exception(NFS_SERVER(dir),
|
err = nfs4_handle_exception(NFS_SERVER(dir),
|
||||||
_nfs4_proc_mkdir(dir, dentry, sattr),
|
_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 = { };
|
struct nfs4_exception exception = { };
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
sattr->ia_mode &= ~current_umask();
|
||||||
do {
|
do {
|
||||||
err = nfs4_handle_exception(NFS_SERVER(dir),
|
err = nfs4_handle_exception(NFS_SERVER(dir),
|
||||||
_nfs4_proc_mknod(dir, dentry, sattr, rdev),
|
_nfs4_proc_mknod(dir, dentry, sattr, rdev),
|
||||||
|
@ -2496,6 +2496,11 @@ static void nfs4_clone_super(struct super_block *sb,
|
|||||||
sb->s_maxbytes = old_sb->s_maxbytes;
|
sb->s_maxbytes = old_sb->s_maxbytes;
|
||||||
sb->s_time_gran = 1;
|
sb->s_time_gran = 1;
|
||||||
sb->s_op = old_sb->s_op;
|
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);
|
nfs_initialise_sb(sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2506,6 +2511,11 @@ static void nfs4_fill_super(struct super_block *sb)
|
|||||||
{
|
{
|
||||||
sb->s_time_gran = 1;
|
sb->s_time_gran = 1;
|
||||||
sb->s_op = &nfs4_sops;
|
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);
|
nfs_initialise_sb(sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user