Commit 2a651c7f8d377cf88271374315cbb5fe82eac784
Exists in
master
and in
20 other branches
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs: 9p: update Documentation pointers net/9p: enable 9p to work in non-default network namespace net/9p: p9_idpool_get return -1 on error fs/9p: Don't clunk dentry fid when we fail to get a writeback inode 9p: Small cleanup in <net/9p/9p.h> 9p: remove experimental tag from tested configurations 9p: typo fixes and minor cleanups net/9p: Change linuxdoc names to match functions.
Showing 11 changed files Side-by-side Diff
Documentation/filesystems/9p.txt
... | ... | @@ -25,6 +25,8 @@ |
25 | 25 | http://xcpu.org/papers/cellfs-talk.pdf |
26 | 26 | * PROSE I/O: Using 9p to enable Application Partitions |
27 | 27 | http://plan9.escet.urjc.es/iwp9/cready/PROSE_iwp9_2006.pdf |
28 | + * VirtFS: A Virtualization Aware File System pass-through | |
29 | + http://goo.gl/3WPDg | |
28 | 30 | |
29 | 31 | USAGE |
30 | 32 | ===== |
31 | 33 | |
32 | 34 | |
33 | 35 | |
... | ... | @@ -130,31 +132,20 @@ |
130 | 132 | RESOURCES |
131 | 133 | ========= |
132 | 134 | |
133 | -Our current recommendation is to use Inferno (http://www.vitanuova.com/nferno/index.html) | |
134 | -as the 9p server. You can start a 9p server under Inferno by issuing the | |
135 | -following command: | |
136 | - ; styxlisten -A tcp!*!564 export '#U*' | |
135 | +Protocol specifications are maintained on github: | |
136 | +http://ericvh.github.com/9p-rfc/ | |
137 | 137 | |
138 | -The -A specifies an unauthenticated export. The 564 is the port # (you may | |
139 | -have to choose a higher port number if running as a normal user). The '#U*' | |
140 | -specifies exporting the root of the Linux name space. You may specify a | |
141 | -subset of the namespace by extending the path: '#U*'/tmp would just export | |
142 | -/tmp. For more information, see the Inferno manual pages covering styxlisten | |
143 | -and export. | |
138 | +9p client and server implementations are listed on | |
139 | +http://9p.cat-v.org/implementations | |
144 | 140 | |
145 | -A Linux version of the 9p server is now maintained under the npfs project | |
146 | -on sourceforge (http://sourceforge.net/projects/npfs). The currently | |
147 | -maintained version is the single-threaded version of the server (named spfs) | |
148 | -available from the same SVN repository. | |
141 | +A 9p2000.L server is being developed by LLNL and can be found | |
142 | +at http://code.google.com/p/diod/ | |
149 | 143 | |
150 | 144 | There are user and developer mailing lists available through the v9fs project |
151 | 145 | on sourceforge (http://sourceforge.net/projects/v9fs). |
152 | 146 | |
153 | -A stand-alone version of the module (which should build for any 2.6 kernel) | |
154 | -is available via (http://github.com/ericvh/9p-sac/tree/master) | |
155 | - | |
156 | -News and other information is maintained on SWiK (http://swik.net/v9fs) | |
157 | -and the Wiki (http://sf.net/apps/mediawiki/v9fs/index.php). | |
147 | +News and other information is maintained on a Wiki. | |
148 | +(http://sf.net/apps/mediawiki/v9fs/index.php). | |
158 | 149 | |
159 | 150 | Bug reports may be issued through the kernel.org bugzilla |
160 | 151 | (http://bugzilla.kernel.org) |
fs/9p/Kconfig
1 | 1 | config 9P_FS |
2 | - tristate "Plan 9 Resource Sharing Support (9P2000) (Experimental)" | |
3 | - depends on INET && NET_9P && EXPERIMENTAL | |
2 | + tristate "Plan 9 Resource Sharing Support (9P2000)" | |
3 | + depends on INET && NET_9P | |
4 | 4 | help |
5 | 5 | If you say Y here, you will get experimental support for |
6 | 6 | Plan 9 resource sharing via the 9P2000 protocol. |
... | ... | @@ -10,7 +10,6 @@ |
10 | 10 | If unsure, say N. |
11 | 11 | |
12 | 12 | if 9P_FS |
13 | - | |
14 | 13 | config 9P_FSCACHE |
15 | 14 | bool "Enable 9P client caching support (EXPERIMENTAL)" |
16 | 15 | depends on EXPERIMENTAL |
fs/9p/vfs_inode_dotl.c
... | ... | @@ -259,7 +259,7 @@ |
259 | 259 | if (IS_ERR(inode_fid)) { |
260 | 260 | err = PTR_ERR(inode_fid); |
261 | 261 | mutex_unlock(&v9inode->v_mutex); |
262 | - goto error; | |
262 | + goto err_clunk_old_fid; | |
263 | 263 | } |
264 | 264 | v9inode->writeback_fid = (void *) inode_fid; |
265 | 265 | } |
... | ... | @@ -267,8 +267,8 @@ |
267 | 267 | /* Since we are opening a file, assign the open fid to the file */ |
268 | 268 | filp = lookup_instantiate_filp(nd, dentry, generic_file_open); |
269 | 269 | if (IS_ERR(filp)) { |
270 | - p9_client_clunk(ofid); | |
271 | - return PTR_ERR(filp); | |
270 | + err = PTR_ERR(filp); | |
271 | + goto err_clunk_old_fid; | |
272 | 272 | } |
273 | 273 | filp->private_data = ofid; |
274 | 274 | #ifdef CONFIG_9P_FSCACHE |
275 | 275 | |
... | ... | @@ -278,10 +278,11 @@ |
278 | 278 | return 0; |
279 | 279 | |
280 | 280 | error: |
281 | - if (ofid) | |
282 | - p9_client_clunk(ofid); | |
283 | 281 | if (fid) |
284 | 282 | p9_client_clunk(fid); |
283 | +err_clunk_old_fid: | |
284 | + if (ofid) | |
285 | + p9_client_clunk(ofid); | |
285 | 286 | return err; |
286 | 287 | } |
287 | 288 |
include/net/9p/9p.h
... | ... | @@ -241,10 +241,10 @@ |
241 | 241 | |
242 | 242 | /** |
243 | 243 | * enum p9_perm_t - 9P permissions |
244 | - * @P9_DMDIR: mode bite for directories | |
244 | + * @P9_DMDIR: mode bit for directories | |
245 | 245 | * @P9_DMAPPEND: mode bit for is append-only |
246 | 246 | * @P9_DMEXCL: mode bit for excluse use (only one open handle allowed) |
247 | - * @P9_DMMOUNT: mode bite for mount points | |
247 | + * @P9_DMMOUNT: mode bit for mount points | |
248 | 248 | * @P9_DMAUTH: mode bit for authentication file |
249 | 249 | * @P9_DMTMP: mode bit for non-backed-up files |
250 | 250 | * @P9_DMSYMLINK: mode bit for symbolic links (9P2000.u) |
... | ... | @@ -362,7 +362,7 @@ |
362 | 362 | }; |
363 | 363 | |
364 | 364 | /** |
365 | - * struct p9_stat - file system metadata information | |
365 | + * struct p9_wstat - file system metadata information | |
366 | 366 | * @size: length prefix for this stat structure instance |
367 | 367 | * @type: the type of the server (equivalent to a major number) |
368 | 368 | * @dev: the sub-type of the server (equivalent to a minor number) |
369 | 369 | |
... | ... | @@ -687,10 +687,10 @@ |
687 | 687 | * @size: prefixed length of the structure |
688 | 688 | * @id: protocol operating identifier of type &p9_msg_t |
689 | 689 | * @tag: transaction id of the request |
690 | - * @offset: used by marshalling routines to track currentposition in buffer | |
690 | + * @offset: used by marshalling routines to track current position in buffer | |
691 | 691 | * @capacity: used by marshalling routines to track total malloc'd capacity |
692 | 692 | * @pubuf: Payload user buffer given by the caller |
693 | - * @pubuf: Payload kernel buffer given by the caller | |
693 | + * @pkbuf: Payload kernel buffer given by the caller | |
694 | 694 | * @pbuf_size: pubuf/pkbuf(only one will be !NULL) size to be read/write. |
695 | 695 | * @private: For transport layer's use. |
696 | 696 | * @sdata: payload |
... | ... | @@ -714,7 +714,7 @@ |
714 | 714 | size_t pbuf_size; |
715 | 715 | void *private; |
716 | 716 | |
717 | - uint8_t *sdata; | |
717 | + u8 *sdata; | |
718 | 718 | }; |
719 | 719 | |
720 | 720 | struct p9_idpool; |
... | ... | @@ -728,7 +728,6 @@ |
728 | 728 | int p9_idpool_check(int id, struct p9_idpool *p); |
729 | 729 | |
730 | 730 | int p9_error_init(void); |
731 | -int p9_errstr2errno(char *, int); | |
732 | 731 | int p9_trans_fd_init(void); |
733 | 732 | void p9_trans_fd_exit(void); |
734 | 733 | #endif /* NET_9P_H */ |
include/net/9p/client.h
... | ... | @@ -60,7 +60,7 @@ |
60 | 60 | }; |
61 | 61 | |
62 | 62 | /** |
63 | - * enum p9_req_status_t - virtio request status | |
63 | + * enum p9_req_status_t - status of a request | |
64 | 64 | * @REQ_STATUS_IDLE: request slot unused |
65 | 65 | * @REQ_STATUS_ALLOC: request has been allocated but not sent |
66 | 66 | * @REQ_STATUS_UNSENT: request waiting to be sent |
include/net/9p/transport.h
... | ... | @@ -41,6 +41,7 @@ |
41 | 41 | * @pref: Preferences of this transport |
42 | 42 | * @def: set if this transport should be considered the default |
43 | 43 | * @create: member function to create a new connection on this transport |
44 | + * @close: member function to discard a connection on this transport | |
44 | 45 | * @request: member function to issue a request to the transport |
45 | 46 | * @cancel: member function to cancel a request (if it hasn't been sent) |
46 | 47 | * |
... | ... | @@ -48,7 +49,7 @@ |
48 | 49 | * transport module with the 9P core network module and used by the client |
49 | 50 | * to instantiate a new connection on a transport. |
50 | 51 | * |
51 | - * BUGS: the transport module list isn't protected. | |
52 | + * The transport module list is protected by v9fs_trans_lock. | |
52 | 53 | */ |
53 | 54 | |
54 | 55 | struct p9_trans_module { |
net/9p/Kconfig
... | ... | @@ -3,8 +3,8 @@ |
3 | 3 | # |
4 | 4 | |
5 | 5 | menuconfig NET_9P |
6 | - depends on NET && EXPERIMENTAL | |
7 | - tristate "Plan 9 Resource Sharing Support (9P2000) (Experimental)" | |
6 | + depends on NET | |
7 | + tristate "Plan 9 Resource Sharing Support (9P2000)" | |
8 | 8 | help |
9 | 9 | If you say Y here, you will get experimental support for |
10 | 10 | Plan 9 resource sharing via the 9P2000 protocol. |
... | ... | @@ -16,8 +16,8 @@ |
16 | 16 | if NET_9P |
17 | 17 | |
18 | 18 | config NET_9P_VIRTIO |
19 | - depends on EXPERIMENTAL && VIRTIO | |
20 | - tristate "9P Virtio Transport (Experimental)" | |
19 | + depends on VIRTIO | |
20 | + tristate "9P Virtio Transport" | |
21 | 21 | help |
22 | 22 | This builds support for a transports between |
23 | 23 | guest partitions and a host partition. |
net/9p/client.c
... | ... | @@ -92,9 +92,6 @@ |
92 | 92 | return version; |
93 | 93 | } |
94 | 94 | |
95 | -static struct p9_req_t * | |
96 | -p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...); | |
97 | - | |
98 | 95 | /** |
99 | 96 | * parse_options - parse mount options into client structure |
100 | 97 | * @opts: options string passed from mount |
101 | 98 | |
... | ... | @@ -307,12 +304,13 @@ |
307 | 304 | c->tagpool = p9_idpool_create(); |
308 | 305 | if (IS_ERR(c->tagpool)) { |
309 | 306 | err = PTR_ERR(c->tagpool); |
310 | - c->tagpool = NULL; | |
311 | 307 | goto error; |
312 | 308 | } |
313 | - | |
314 | - p9_idpool_get(c->tagpool); /* reserve tag 0 */ | |
315 | - | |
309 | + err = p9_idpool_get(c->tagpool); /* reserve tag 0 */ | |
310 | + if (err < 0) { | |
311 | + p9_idpool_destroy(c->tagpool); | |
312 | + goto error; | |
313 | + } | |
316 | 314 | c->max_tag = 0; |
317 | 315 | error: |
318 | 316 | return err; |
319 | 317 | |
... | ... | @@ -518,12 +516,15 @@ |
518 | 516 | return err; |
519 | 517 | } |
520 | 518 | |
519 | +static struct p9_req_t * | |
520 | +p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...); | |
521 | + | |
521 | 522 | /** |
522 | 523 | * p9_client_flush - flush (cancel) a request |
523 | 524 | * @c: client state |
524 | 525 | * @oldreq: request to cancel |
525 | 526 | * |
526 | - * This sents a flush for a particular requests and links | |
527 | + * This sents a flush for a particular request and links | |
527 | 528 | * the flush request to the original request. The current |
528 | 529 | * code only supports a single flush request although the protocol |
529 | 530 | * allows for multiple flush requests to be sent for a single request. |
530 | 531 | |
... | ... | @@ -789,11 +790,13 @@ |
789 | 790 | spin_lock_init(&clnt->lock); |
790 | 791 | INIT_LIST_HEAD(&clnt->fidlist); |
791 | 792 | |
792 | - p9_tag_init(clnt); | |
793 | + err = p9_tag_init(clnt); | |
794 | + if (err < 0) | |
795 | + goto free_client; | |
793 | 796 | |
794 | 797 | err = parse_opts(options, clnt); |
795 | 798 | if (err < 0) |
796 | - goto free_client; | |
799 | + goto destroy_tagpool; | |
797 | 800 | |
798 | 801 | if (!clnt->trans_mod) |
799 | 802 | clnt->trans_mod = v9fs_get_default_trans(); |
800 | 803 | |
... | ... | @@ -802,13 +805,12 @@ |
802 | 805 | err = -EPROTONOSUPPORT; |
803 | 806 | P9_DPRINTK(P9_DEBUG_ERROR, |
804 | 807 | "No transport defined or default transport\n"); |
805 | - goto free_client; | |
808 | + goto destroy_tagpool; | |
806 | 809 | } |
807 | 810 | |
808 | 811 | clnt->fidpool = p9_idpool_create(); |
809 | 812 | if (IS_ERR(clnt->fidpool)) { |
810 | 813 | err = PTR_ERR(clnt->fidpool); |
811 | - clnt->fidpool = NULL; | |
812 | 814 | goto put_trans; |
813 | 815 | } |
814 | 816 | |
... | ... | @@ -834,6 +836,8 @@ |
834 | 836 | p9_idpool_destroy(clnt->fidpool); |
835 | 837 | put_trans: |
836 | 838 | v9fs_put_trans(clnt->trans_mod); |
839 | +destroy_tagpool: | |
840 | + p9_idpool_destroy(clnt->tagpool); | |
837 | 841 | free_client: |
838 | 842 | kfree(clnt); |
839 | 843 | return ERR_PTR(err); |
... | ... | @@ -1298,7 +1302,7 @@ |
1298 | 1302 | if (count < rsize) |
1299 | 1303 | rsize = count; |
1300 | 1304 | |
1301 | - /* Don't bother zerocopy form small IO (< 1024) */ | |
1305 | + /* Don't bother zerocopy for small IO (< 1024) */ | |
1302 | 1306 | if (((clnt->trans_mod->pref & P9_TRANS_PREF_PAYLOAD_MASK) == |
1303 | 1307 | P9_TRANS_PREF_PAYLOAD_SEP) && (rsize > 1024)) { |
1304 | 1308 | req = p9_client_rpc(clnt, P9_TREAD, "dqE", fid->fid, offset, |
net/9p/mod.c
... | ... | @@ -139,7 +139,7 @@ |
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
142 | - * v9fs_init - Initialize module | |
142 | + * init_p9 - Initialize module | |
143 | 143 | * |
144 | 144 | */ |
145 | 145 | static int __init init_p9(void) |
... | ... | @@ -154,7 +154,7 @@ |
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
157 | - * v9fs_init - shutdown module | |
157 | + * exit_p9 - shutdown module | |
158 | 158 | * |
159 | 159 | */ |
160 | 160 |
net/9p/trans_fd.c
... | ... | @@ -916,8 +916,8 @@ |
916 | 916 | sin_server.sin_family = AF_INET; |
917 | 917 | sin_server.sin_addr.s_addr = in_aton(addr); |
918 | 918 | sin_server.sin_port = htons(opts.port); |
919 | - err = sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, &csocket); | |
920 | - | |
919 | + err = __sock_create(read_pnet(¤t->nsproxy->net_ns), PF_INET, | |
920 | + SOCK_STREAM, IPPROTO_TCP, &csocket, 1); | |
921 | 921 | if (err) { |
922 | 922 | P9_EPRINTK(KERN_ERR, "p9_trans_tcp: problem creating socket\n"); |
923 | 923 | return err; |
... | ... | @@ -954,7 +954,8 @@ |
954 | 954 | |
955 | 955 | sun_server.sun_family = PF_UNIX; |
956 | 956 | strcpy(sun_server.sun_path, addr); |
957 | - err = sock_create_kern(PF_UNIX, SOCK_STREAM, 0, &csocket); | |
957 | + err = __sock_create(read_pnet(¤t->nsproxy->net_ns), PF_UNIX, | |
958 | + SOCK_STREAM, 0, &csocket, 1); | |
958 | 959 | if (err < 0) { |
959 | 960 | P9_EPRINTK(KERN_ERR, "p9_trans_unix: problem creating socket\n"); |
960 | 961 | return err; |