aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2010-12-09 06:35:14 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-01-04 13:10:40 -0500
commita8a5da996df7d2d91b5aef2752da9adcefea4bc6 (patch)
tree605be5f4af59d5cc324ae11c18a8b34db7ab3c6a /fs/nfs
parentbf0c84f1614bffc59565d04f09b9ac6b1aa269a9 (diff)
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>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/dir.c3
-rw-r--r--fs/nfs/nfs4proc.c5
-rw-r--r--fs/nfs/super.c10
3 files changed, 16 insertions, 2 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 831d61c4449b..6ceedc7b98da 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1352,8 +1352,7 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry
1352 if (nd->flags & LOOKUP_CREATE) { 1352 if (nd->flags & LOOKUP_CREATE) {
1353 attr.ia_mode = nd->intent.open.create_mode; 1353 attr.ia_mode = nd->intent.open.create_mode;
1354 attr.ia_valid = ATTR_MODE; 1354 attr.ia_valid = ATTR_MODE;
1355 if (!IS_POSIXACL(dir)) 1355 attr.ia_mode &= ~current_umask();
1356 attr.ia_mode &= ~current_umask();
1357 } else { 1356 } else {
1358 open_flags &= ~(O_EXCL | O_CREAT); 1357 open_flags &= ~(O_EXCL | O_CREAT);
1359 attr.ia_valid = 0; 1358 attr.ia_valid = 0;
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 78b08993a38b..ca88f294f0af 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2486,6 +2486,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
2486 path = &ctx->path; 2486 path = &ctx->path;
2487 fmode = ctx->mode; 2487 fmode = ctx->mode;
2488 } 2488 }
2489 sattr->ia_mode &= ~current_umask();
2489 state = nfs4_do_open(dir, path, fmode, flags, sattr, cred); 2490 state = nfs4_do_open(dir, path, fmode, flags, sattr, cred);
2490 d_drop(dentry); 2491 d_drop(dentry);
2491 if (IS_ERR(state)) { 2492 if (IS_ERR(state)) {
@@ -2816,6 +2817,8 @@ static int nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry,
2816{ 2817{
2817 struct nfs4_exception exception = { }; 2818 struct nfs4_exception exception = { };
2818 int err; 2819 int err;
2820
2821 sattr->ia_mode &= ~current_umask();
2819 do { 2822 do {
2820 err = nfs4_handle_exception(NFS_SERVER(dir), 2823 err = nfs4_handle_exception(NFS_SERVER(dir),
2821 _nfs4_proc_mkdir(dir, dentry, sattr), 2824 _nfs4_proc_mkdir(dir, dentry, sattr),
@@ -2916,6 +2919,8 @@ static int nfs4_proc_mknod(struct inode *dir, struct dentry *dentry,
2916{ 2919{
2917 struct nfs4_exception exception = { }; 2920 struct nfs4_exception exception = { };
2918 int err; 2921 int err;
2922
2923 sattr->ia_mode &= ~current_umask();
2919 do { 2924 do {
2920 err = nfs4_handle_exception(NFS_SERVER(dir), 2925 err = nfs4_handle_exception(NFS_SERVER(dir),
2921 _nfs4_proc_mknod(dir, dentry, sattr, rdev), 2926 _nfs4_proc_mknod(dir, dentry, sattr, rdev),
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index dd56eec16eac..001f9cb2804b 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2496,6 +2496,11 @@ static void nfs4_clone_super(struct super_block *sb,
2496 sb->s_maxbytes = old_sb->s_maxbytes; 2496 sb->s_maxbytes = old_sb->s_maxbytes;
2497 sb->s_time_gran = 1; 2497 sb->s_time_gran = 1;
2498 sb->s_op = old_sb->s_op; 2498 sb->s_op = old_sb->s_op;
2499 /*
2500 * The VFS shouldn't apply the umask to mode bits. We will do
2501 * so ourselves when necessary.
2502 */
2503 sb->s_flags |= MS_POSIXACL;
2499 nfs_initialise_sb(sb); 2504 nfs_initialise_sb(sb);
2500} 2505}
2501 2506
@@ -2506,6 +2511,11 @@ static void nfs4_fill_super(struct super_block *sb)
2506{ 2511{
2507 sb->s_time_gran = 1; 2512 sb->s_time_gran = 1;
2508 sb->s_op = &nfs4_sops; 2513 sb->s_op = &nfs4_sops;
2514 /*
2515 * The VFS shouldn't apply the umask to mode bits. We will do
2516 * so ourselves when necessary.
2517 */
2518 sb->s_flags |= MS_POSIXACL;
2509 nfs_initialise_sb(sb); 2519 nfs_initialise_sb(sb);
2510} 2520}
2511 2521