diff options
-rw-r--r-- | fs/9p/acl.c | 8 | ||||
-rw-r--r-- | fs/9p/v9fs.c | 27 | ||||
-rw-r--r-- | fs/9p/v9fs.h | 6 | ||||
-rw-r--r-- | fs/9p/vfs_super.c | 2 |
4 files changed, 31 insertions, 12 deletions
diff --git a/fs/9p/acl.c b/fs/9p/acl.c index 0a2e480477a5..1ee3434239c8 100644 --- a/fs/9p/acl.c +++ b/fs/9p/acl.c | |||
@@ -59,7 +59,8 @@ int v9fs_get_acl(struct inode *inode, struct p9_fid *fid) | |||
59 | struct v9fs_session_info *v9ses; | 59 | struct v9fs_session_info *v9ses; |
60 | 60 | ||
61 | v9ses = v9fs_inode2v9ses(inode); | 61 | v9ses = v9fs_inode2v9ses(inode); |
62 | if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) { | 62 | if (((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) || |
63 | ((v9ses->flags & V9FS_ACL_MASK) != V9FS_POSIX_ACL)) { | ||
63 | set_cached_acl(inode, ACL_TYPE_DEFAULT, NULL); | 64 | set_cached_acl(inode, ACL_TYPE_DEFAULT, NULL); |
64 | set_cached_acl(inode, ACL_TYPE_ACCESS, NULL); | 65 | set_cached_acl(inode, ACL_TYPE_ACCESS, NULL); |
65 | return 0; | 66 | return 0; |
@@ -104,9 +105,10 @@ int v9fs_check_acl(struct inode *inode, int mask, unsigned int flags) | |||
104 | return -ECHILD; | 105 | return -ECHILD; |
105 | 106 | ||
106 | v9ses = v9fs_inode2v9ses(inode); | 107 | v9ses = v9fs_inode2v9ses(inode); |
107 | if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) { | 108 | if (((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) || |
109 | ((v9ses->flags & V9FS_ACL_MASK) != V9FS_POSIX_ACL)) { | ||
108 | /* | 110 | /* |
109 | * On access = client mode get the acl | 111 | * On access = client and acl = on mode get the acl |
110 | * values from the server | 112 | * values from the server |
111 | */ | 113 | */ |
112 | return 0; | 114 | return 0; |
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index d34f2937df66..f5a3200877d6 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c | |||
@@ -55,7 +55,7 @@ enum { | |||
55 | /* Cache options */ | 55 | /* Cache options */ |
56 | Opt_cache_loose, Opt_fscache, | 56 | Opt_cache_loose, Opt_fscache, |
57 | /* Access options */ | 57 | /* Access options */ |
58 | Opt_access, | 58 | Opt_access, Opt_posixacl, |
59 | /* Error token */ | 59 | /* Error token */ |
60 | Opt_err | 60 | Opt_err |
61 | }; | 61 | }; |
@@ -73,6 +73,7 @@ static const match_table_t tokens = { | |||
73 | {Opt_fscache, "fscache"}, | 73 | {Opt_fscache, "fscache"}, |
74 | {Opt_cachetag, "cachetag=%s"}, | 74 | {Opt_cachetag, "cachetag=%s"}, |
75 | {Opt_access, "access=%s"}, | 75 | {Opt_access, "access=%s"}, |
76 | {Opt_posixacl, "posixacl"}, | ||
76 | {Opt_err, NULL} | 77 | {Opt_err, NULL} |
77 | }; | 78 | }; |
78 | 79 | ||
@@ -194,13 +195,7 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) | |||
194 | else if (strcmp(s, "any") == 0) | 195 | else if (strcmp(s, "any") == 0) |
195 | v9ses->flags |= V9FS_ACCESS_ANY; | 196 | v9ses->flags |= V9FS_ACCESS_ANY; |
196 | else if (strcmp(s, "client") == 0) { | 197 | else if (strcmp(s, "client") == 0) { |
197 | #ifdef CONFIG_9P_FS_POSIX_ACL | ||
198 | v9ses->flags |= V9FS_ACCESS_CLIENT; | 198 | v9ses->flags |= V9FS_ACCESS_CLIENT; |
199 | #else | ||
200 | P9_DPRINTK(P9_DEBUG_ERROR, | ||
201 | "Not defined CONFIG_9P_FS_POSIX_ACL. " | ||
202 | "Ignoring access=client option\n"); | ||
203 | #endif | ||
204 | } else { | 199 | } else { |
205 | v9ses->flags |= V9FS_ACCESS_SINGLE; | 200 | v9ses->flags |= V9FS_ACCESS_SINGLE; |
206 | v9ses->uid = simple_strtoul(s, &e, 10); | 201 | v9ses->uid = simple_strtoul(s, &e, 10); |
@@ -210,6 +205,16 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) | |||
210 | kfree(s); | 205 | kfree(s); |
211 | break; | 206 | break; |
212 | 207 | ||
208 | case Opt_posixacl: | ||
209 | #ifdef CONFIG_9P_FS_POSIX_ACL | ||
210 | v9ses->flags |= V9FS_POSIX_ACL; | ||
211 | #else | ||
212 | P9_DPRINTK(P9_DEBUG_ERROR, | ||
213 | "Not defined CONFIG_9P_FS_POSIX_ACL. " | ||
214 | "Ignoring posixacl option\n"); | ||
215 | #endif | ||
216 | break; | ||
217 | |||
213 | default: | 218 | default: |
214 | continue; | 219 | continue; |
215 | } | 220 | } |
@@ -304,6 +309,14 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, | |||
304 | v9ses->flags |= V9FS_ACCESS_ANY; | 309 | v9ses->flags |= V9FS_ACCESS_ANY; |
305 | v9ses->uid = ~0; | 310 | v9ses->uid = ~0; |
306 | } | 311 | } |
312 | if (!v9fs_proto_dotl(v9ses) || | ||
313 | !((v9ses->flags & V9FS_ACCESS_MASK) == V9FS_ACCESS_CLIENT)) { | ||
314 | /* | ||
315 | * We support ACL checks on clinet only if the protocol is | ||
316 | * 9P2000.L and access is V9FS_ACCESS_CLIENT. | ||
317 | */ | ||
318 | v9ses->flags &= ~V9FS_ACL_MASK; | ||
319 | } | ||
307 | 320 | ||
308 | fid = p9_client_attach(v9ses->clnt, NULL, v9ses->uname, ~0, | 321 | fid = p9_client_attach(v9ses->clnt, NULL, v9ses->uname, ~0, |
309 | v9ses->aname); | 322 | v9ses->aname); |
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h index c4b5d8864f0d..6fa3cf5547d5 100644 --- a/fs/9p/v9fs.h +++ b/fs/9p/v9fs.h | |||
@@ -28,8 +28,10 @@ | |||
28 | * @V9FS_PROTO_2000L: whether or not to use 9P2000.l extensions | 28 | * @V9FS_PROTO_2000L: whether or not to use 9P2000.l extensions |
29 | * @V9FS_ACCESS_SINGLE: only the mounting user can access the hierarchy | 29 | * @V9FS_ACCESS_SINGLE: only the mounting user can access the hierarchy |
30 | * @V9FS_ACCESS_USER: a new attach will be issued for every user (default) | 30 | * @V9FS_ACCESS_USER: a new attach will be issued for every user (default) |
31 | * @V9FS_ACCESS_CLIENT: Just like user, but access check is performed on client. | ||
31 | * @V9FS_ACCESS_ANY: use a single attach for all users | 32 | * @V9FS_ACCESS_ANY: use a single attach for all users |
32 | * @V9FS_ACCESS_MASK: bit mask of different ACCESS options | 33 | * @V9FS_ACCESS_MASK: bit mask of different ACCESS options |
34 | * @V9FS_POSIX_ACL: POSIX ACLs are enforced | ||
33 | * | 35 | * |
34 | * Session flags reflect options selected by users at mount time | 36 | * Session flags reflect options selected by users at mount time |
35 | */ | 37 | */ |
@@ -37,13 +39,15 @@ | |||
37 | V9FS_ACCESS_USER | \ | 39 | V9FS_ACCESS_USER | \ |
38 | V9FS_ACCESS_CLIENT) | 40 | V9FS_ACCESS_CLIENT) |
39 | #define V9FS_ACCESS_MASK V9FS_ACCESS_ANY | 41 | #define V9FS_ACCESS_MASK V9FS_ACCESS_ANY |
42 | #define V9FS_ACL_MASK V9FS_POSIX_ACL | ||
40 | 43 | ||
41 | enum p9_session_flags { | 44 | enum p9_session_flags { |
42 | V9FS_PROTO_2000U = 0x01, | 45 | V9FS_PROTO_2000U = 0x01, |
43 | V9FS_PROTO_2000L = 0x02, | 46 | V9FS_PROTO_2000L = 0x02, |
44 | V9FS_ACCESS_SINGLE = 0x04, | 47 | V9FS_ACCESS_SINGLE = 0x04, |
45 | V9FS_ACCESS_USER = 0x08, | 48 | V9FS_ACCESS_USER = 0x08, |
46 | V9FS_ACCESS_CLIENT = 0x10 | 49 | V9FS_ACCESS_CLIENT = 0x10, |
50 | V9FS_POSIX_ACL = 0x20 | ||
47 | }; | 51 | }; |
48 | 52 | ||
49 | /* possible values of ->cache */ | 53 | /* possible values of ->cache */ |
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index dbaabe3b8131..4f14be585d6c 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -91,7 +91,7 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses, | |||
91 | MS_NOATIME; | 91 | MS_NOATIME; |
92 | 92 | ||
93 | #ifdef CONFIG_9P_FS_POSIX_ACL | 93 | #ifdef CONFIG_9P_FS_POSIX_ACL |
94 | if ((v9ses->flags & V9FS_ACCESS_MASK) == V9FS_ACCESS_CLIENT) | 94 | if ((v9ses->flags & V9FS_ACL_MASK) == V9FS_POSIX_ACL) |
95 | sb->s_flags |= MS_POSIXACL; | 95 | sb->s_flags |= MS_POSIXACL; |
96 | #endif | 96 | #endif |
97 | 97 | ||