diff options
author | Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com> | 2011-01-25 18:40:54 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2011-03-15 10:57:34 -0400 |
commit | e782ef71097e832f62256370a2fe231b9fba96cf (patch) | |
tree | 6de30a0ac9e6250a5b969ae35655715023724736 /fs/9p/v9fs.c | |
parent | 9332685dffed3b402816c3564342f3e2df0c83ef (diff) |
[fs/9P] Add posixacl mount option
The mount option access=client is overloaded as it assumes acl too.
Adding posixacl option to enable POSIX ACLs makes it explicit and clear.
Also it is convenient in the future to add other types of acls like richacls.
Ideally, the access mode 'client' should be just like V9FS_ACCESS_USER
except it underscores the location of access check.
Traditional 9P protocol lets the server perform access checks but with
this mode, all the access checks will be performed on the client itself.
Server just follows the client's directive.
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p/v9fs.c')
-rw-r--r-- | fs/9p/v9fs.c | 27 |
1 files changed, 20 insertions, 7 deletions
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); |