diff options
-rw-r--r-- | fs/9p/9p.c | 10 | ||||
-rw-r--r-- | fs/9p/9p.h | 3 | ||||
-rw-r--r-- | fs/9p/conv.c | 45 | ||||
-rw-r--r-- | fs/9p/error.h | 1 | ||||
-rw-r--r-- | fs/9p/mux.c | 38 | ||||
-rw-r--r-- | fs/9p/mux.h | 3 | ||||
-rw-r--r-- | fs/9p/v9fs.c | 19 | ||||
-rw-r--r-- | fs/9p/vfs_inode.c | 7 | ||||
-rw-r--r-- | fs/9p/vfs_super.c | 3 |
9 files changed, 58 insertions, 71 deletions
diff --git a/fs/9p/9p.c b/fs/9p/9p.c index dc3ce44ec836..1a6d08761f39 100644 --- a/fs/9p/9p.c +++ b/fs/9p/9p.c | |||
@@ -86,7 +86,6 @@ v9fs_t_attach(struct v9fs_session_info *v9ses, char *uname, char *aname, | |||
86 | dprintk(DEBUG_9P, "uname '%s' aname '%s' fid %d afid %d\n", uname, | 86 | dprintk(DEBUG_9P, "uname '%s' aname '%s' fid %d afid %d\n", uname, |
87 | aname, fid, afid); | 87 | aname, fid, afid); |
88 | 88 | ||
89 | ret = -ENOMEM; | ||
90 | tc = v9fs_create_tattach(fid, afid, uname, aname); | 89 | tc = v9fs_create_tattach(fid, afid, uname, aname); |
91 | if (!IS_ERR(tc)) { | 90 | if (!IS_ERR(tc)) { |
92 | ret = v9fs_mux_rpc(v9ses->mux, tc, rcp); | 91 | ret = v9fs_mux_rpc(v9ses->mux, tc, rcp); |
@@ -136,7 +135,6 @@ v9fs_t_clunk(struct v9fs_session_info *v9ses, u32 fid) | |||
136 | 135 | ||
137 | dprintk(DEBUG_9P, "fid %d\n", fid); | 136 | dprintk(DEBUG_9P, "fid %d\n", fid); |
138 | 137 | ||
139 | ret = -ENOMEM; | ||
140 | rc = NULL; | 138 | rc = NULL; |
141 | tc = v9fs_create_tclunk(fid); | 139 | tc = v9fs_create_tclunk(fid); |
142 | if (!IS_ERR(tc)) | 140 | if (!IS_ERR(tc)) |
@@ -165,7 +163,6 @@ int v9fs_t_flush(struct v9fs_session_info *v9ses, u16 oldtag) | |||
165 | 163 | ||
166 | dprintk(DEBUG_9P, "oldtag %d\n", oldtag); | 164 | dprintk(DEBUG_9P, "oldtag %d\n", oldtag); |
167 | 165 | ||
168 | ret = -ENOMEM; | ||
169 | tc = v9fs_create_tflush(oldtag); | 166 | tc = v9fs_create_tflush(oldtag); |
170 | if (!IS_ERR(tc)) { | 167 | if (!IS_ERR(tc)) { |
171 | ret = v9fs_mux_rpc(v9ses->mux, tc, NULL); | 168 | ret = v9fs_mux_rpc(v9ses->mux, tc, NULL); |
@@ -221,7 +218,6 @@ v9fs_t_wstat(struct v9fs_session_info *v9ses, u32 fid, | |||
221 | 218 | ||
222 | dprintk(DEBUG_9P, "fid %d\n", fid); | 219 | dprintk(DEBUG_9P, "fid %d\n", fid); |
223 | 220 | ||
224 | ret = -ENOMEM; | ||
225 | tc = v9fs_create_twstat(fid, wstat, v9ses->extended); | 221 | tc = v9fs_create_twstat(fid, wstat, v9ses->extended); |
226 | if (!IS_ERR(tc)) { | 222 | if (!IS_ERR(tc)) { |
227 | ret = v9fs_mux_rpc(v9ses->mux, tc, rcp); | 223 | ret = v9fs_mux_rpc(v9ses->mux, tc, rcp); |
@@ -259,7 +255,6 @@ v9fs_t_walk(struct v9fs_session_info *v9ses, u32 fid, u32 newfid, | |||
259 | else | 255 | else |
260 | nwname = 0; | 256 | nwname = 0; |
261 | 257 | ||
262 | ret = -ENOMEM; | ||
263 | tc = v9fs_create_twalk(fid, newfid, nwname, &name); | 258 | tc = v9fs_create_twalk(fid, newfid, nwname, &name); |
264 | if (!IS_ERR(tc)) { | 259 | if (!IS_ERR(tc)) { |
265 | ret = v9fs_mux_rpc(v9ses->mux, tc, rcp); | 260 | ret = v9fs_mux_rpc(v9ses->mux, tc, rcp); |
@@ -289,7 +284,6 @@ v9fs_t_open(struct v9fs_session_info *v9ses, u32 fid, u8 mode, | |||
289 | 284 | ||
290 | dprintk(DEBUG_9P, "fid %d mode %d\n", fid, mode); | 285 | dprintk(DEBUG_9P, "fid %d mode %d\n", fid, mode); |
291 | 286 | ||
292 | ret = -ENOMEM; | ||
293 | tc = v9fs_create_topen(fid, mode); | 287 | tc = v9fs_create_topen(fid, mode); |
294 | if (!IS_ERR(tc)) { | 288 | if (!IS_ERR(tc)) { |
295 | ret = v9fs_mux_rpc(v9ses->mux, tc, rcp); | 289 | ret = v9fs_mux_rpc(v9ses->mux, tc, rcp); |
@@ -317,7 +311,6 @@ v9fs_t_remove(struct v9fs_session_info *v9ses, u32 fid, | |||
317 | 311 | ||
318 | dprintk(DEBUG_9P, "fid %d\n", fid); | 312 | dprintk(DEBUG_9P, "fid %d\n", fid); |
319 | 313 | ||
320 | ret = -ENOMEM; | ||
321 | tc = v9fs_create_tremove(fid); | 314 | tc = v9fs_create_tremove(fid); |
322 | if (!IS_ERR(tc)) { | 315 | if (!IS_ERR(tc)) { |
323 | ret = v9fs_mux_rpc(v9ses->mux, tc, rcp); | 316 | ret = v9fs_mux_rpc(v9ses->mux, tc, rcp); |
@@ -349,7 +342,6 @@ v9fs_t_create(struct v9fs_session_info *v9ses, u32 fid, char *name, | |||
349 | dprintk(DEBUG_9P, "fid %d name '%s' perm %x mode %d\n", | 342 | dprintk(DEBUG_9P, "fid %d name '%s' perm %x mode %d\n", |
350 | fid, name, perm, mode); | 343 | fid, name, perm, mode); |
351 | 344 | ||
352 | ret = -ENOMEM; | ||
353 | tc = v9fs_create_tcreate(fid, name, perm, mode); | 345 | tc = v9fs_create_tcreate(fid, name, perm, mode); |
354 | if (!IS_ERR(tc)) { | 346 | if (!IS_ERR(tc)) { |
355 | ret = v9fs_mux_rpc(v9ses->mux, tc, rcp); | 347 | ret = v9fs_mux_rpc(v9ses->mux, tc, rcp); |
@@ -380,7 +372,6 @@ v9fs_t_read(struct v9fs_session_info *v9ses, u32 fid, u64 offset, | |||
380 | dprintk(DEBUG_9P, "fid %d offset 0x%llux count 0x%x\n", fid, | 372 | dprintk(DEBUG_9P, "fid %d offset 0x%llux count 0x%x\n", fid, |
381 | (long long unsigned) offset, count); | 373 | (long long unsigned) offset, count); |
382 | 374 | ||
383 | ret = -ENOMEM; | ||
384 | tc = v9fs_create_tread(fid, offset, count); | 375 | tc = v9fs_create_tread(fid, offset, count); |
385 | if (!IS_ERR(tc)) { | 376 | if (!IS_ERR(tc)) { |
386 | ret = v9fs_mux_rpc(v9ses->mux, tc, &rc); | 377 | ret = v9fs_mux_rpc(v9ses->mux, tc, &rc); |
@@ -418,7 +409,6 @@ v9fs_t_write(struct v9fs_session_info *v9ses, u32 fid, u64 offset, u32 count, | |||
418 | dprintk(DEBUG_9P, "fid %d offset 0x%llux count 0x%x\n", fid, | 409 | dprintk(DEBUG_9P, "fid %d offset 0x%llux count 0x%x\n", fid, |
419 | (long long unsigned) offset, count); | 410 | (long long unsigned) offset, count); |
420 | 411 | ||
421 | ret = -ENOMEM; | ||
422 | tc = v9fs_create_twrite(fid, offset, count, data); | 412 | tc = v9fs_create_twrite(fid, offset, count, data); |
423 | if (!IS_ERR(tc)) { | 413 | if (!IS_ERR(tc)) { |
424 | ret = v9fs_mux_rpc(v9ses->mux, tc, &rc); | 414 | ret = v9fs_mux_rpc(v9ses->mux, tc, &rc); |
diff --git a/fs/9p/9p.h b/fs/9p/9p.h index 007ff639777d..0cd374d94717 100644 --- a/fs/9p/9p.h +++ b/fs/9p/9p.h | |||
@@ -340,9 +340,6 @@ struct v9fs_fcall { | |||
340 | fcall?fcall->params.rerror.error.len:0, \ | 340 | fcall?fcall->params.rerror.error.len:0, \ |
341 | fcall?fcall->params.rerror.error.str:""); | 341 | fcall?fcall->params.rerror.error.str:""); |
342 | 342 | ||
343 | char *v9fs_str_copy(char *buf, int buflen, struct v9fs_str *str); | ||
344 | int v9fs_str_compare(char *buf, struct v9fs_str *str); | ||
345 | |||
346 | int v9fs_t_version(struct v9fs_session_info *v9ses, u32 msize, | 343 | int v9fs_t_version(struct v9fs_session_info *v9ses, u32 msize, |
347 | char *version, struct v9fs_fcall **rcall); | 344 | char *version, struct v9fs_fcall **rcall); |
348 | 345 | ||
diff --git a/fs/9p/conv.c b/fs/9p/conv.c index f62434d435b3..55ccfa10ee9e 100644 --- a/fs/9p/conv.c +++ b/fs/9p/conv.c | |||
@@ -45,37 +45,6 @@ struct cbuf { | |||
45 | unsigned char *ep; | 45 | unsigned char *ep; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | char *v9fs_str_copy(char *buf, int buflen, struct v9fs_str *str) | ||
49 | { | ||
50 | int n; | ||
51 | |||
52 | if (buflen < str->len) | ||
53 | n = buflen; | ||
54 | else | ||
55 | n = str->len; | ||
56 | |||
57 | memmove(buf, str->str, n - 1); | ||
58 | |||
59 | return buf; | ||
60 | } | ||
61 | |||
62 | int v9fs_str_compare(char *buf, struct v9fs_str *str) | ||
63 | { | ||
64 | int n, ret; | ||
65 | |||
66 | ret = strncmp(buf, str->str, str->len); | ||
67 | |||
68 | if (!ret) { | ||
69 | n = strlen(buf); | ||
70 | if (n < str->len) | ||
71 | ret = -1; | ||
72 | else if (n > str->len) | ||
73 | ret = 1; | ||
74 | } | ||
75 | |||
76 | return ret; | ||
77 | } | ||
78 | |||
79 | static inline void buf_init(struct cbuf *buf, void *data, int datalen) | 48 | static inline void buf_init(struct cbuf *buf, void *data, int datalen) |
80 | { | 49 | { |
81 | buf->sp = buf->p = data; | 50 | buf->sp = buf->p = data; |
@@ -89,11 +58,14 @@ static inline int buf_check_overflow(struct cbuf *buf) | |||
89 | 58 | ||
90 | static inline int buf_check_size(struct cbuf *buf, int len) | 59 | static inline int buf_check_size(struct cbuf *buf, int len) |
91 | { | 60 | { |
92 | if (buf->p + len > buf->ep && buf->p < buf->ep) { | 61 | if (buf->p + len > buf->ep) { |
93 | eprintk(KERN_ERR, "buffer overflow: want %d has %d\n", | 62 | if (buf->p < buf->ep) { |
94 | len, (int)(buf->ep - buf->p)); | 63 | eprintk(KERN_ERR, "buffer overflow: want %d has %d\n", |
95 | dump_stack(); | 64 | len, (int)(buf->ep - buf->p)); |
96 | buf->p = buf->ep + 1; | 65 | dump_stack(); |
66 | buf->p = buf->ep + 1; | ||
67 | } | ||
68 | |||
97 | return 0; | 69 | return 0; |
98 | } | 70 | } |
99 | 71 | ||
@@ -527,6 +499,7 @@ v9fs_create_common(struct cbuf *bufp, u32 size, u8 id) | |||
527 | 499 | ||
528 | void v9fs_set_tag(struct v9fs_fcall *fc, u16 tag) | 500 | void v9fs_set_tag(struct v9fs_fcall *fc, u16 tag) |
529 | { | 501 | { |
502 | fc->tag = tag; | ||
530 | *(__le16 *) (fc->sdata + 5) = cpu_to_le16(tag); | 503 | *(__le16 *) (fc->sdata + 5) = cpu_to_le16(tag); |
531 | } | 504 | } |
532 | 505 | ||
diff --git a/fs/9p/error.h b/fs/9p/error.h index 8b3176b3f658..a9794e85fe51 100644 --- a/fs/9p/error.h +++ b/fs/9p/error.h | |||
@@ -176,4 +176,3 @@ static struct errormap errmap[] = { | |||
176 | }; | 176 | }; |
177 | 177 | ||
178 | extern int v9fs_error_init(void); | 178 | extern int v9fs_error_init(void); |
179 | extern int v9fs_errstr2errno(char *errstr, int len); | ||
diff --git a/fs/9p/mux.c b/fs/9p/mux.c index f21cf5083973..945cb368d451 100644 --- a/fs/9p/mux.c +++ b/fs/9p/mux.c | |||
@@ -102,8 +102,6 @@ struct v9fs_mux_rpc { | |||
102 | wait_queue_head_t wqueue; | 102 | wait_queue_head_t wqueue; |
103 | }; | 103 | }; |
104 | 104 | ||
105 | extern int v9fs_errstr2errno(char *str, int len); | ||
106 | |||
107 | static int v9fs_poll_proc(void *); | 105 | static int v9fs_poll_proc(void *); |
108 | static void v9fs_read_work(void *); | 106 | static void v9fs_read_work(void *); |
109 | static void v9fs_write_work(void *); | 107 | static void v9fs_write_work(void *); |
@@ -119,7 +117,7 @@ static int v9fs_mux_num; | |||
119 | static int v9fs_mux_poll_task_num; | 117 | static int v9fs_mux_poll_task_num; |
120 | static struct v9fs_mux_poll_task v9fs_mux_poll_tasks[100]; | 118 | static struct v9fs_mux_poll_task v9fs_mux_poll_tasks[100]; |
121 | 119 | ||
122 | void v9fs_mux_global_init(void) | 120 | int v9fs_mux_global_init(void) |
123 | { | 121 | { |
124 | int i; | 122 | int i; |
125 | 123 | ||
@@ -127,6 +125,10 @@ void v9fs_mux_global_init(void) | |||
127 | v9fs_mux_poll_tasks[i].task = NULL; | 125 | v9fs_mux_poll_tasks[i].task = NULL; |
128 | 126 | ||
129 | v9fs_mux_wq = create_workqueue("v9fs"); | 127 | v9fs_mux_wq = create_workqueue("v9fs"); |
128 | if (!v9fs_mux_wq) | ||
129 | return -ENOMEM; | ||
130 | |||
131 | return 0; | ||
130 | } | 132 | } |
131 | 133 | ||
132 | void v9fs_mux_global_exit(void) | 134 | void v9fs_mux_global_exit(void) |
@@ -156,10 +158,11 @@ inline int v9fs_mux_calc_poll_procs(int muxnum) | |||
156 | return n; | 158 | return n; |
157 | } | 159 | } |
158 | 160 | ||
159 | static void v9fs_mux_poll_start(struct v9fs_mux_data *m) | 161 | static int v9fs_mux_poll_start(struct v9fs_mux_data *m) |
160 | { | 162 | { |
161 | int i, n; | 163 | int i, n; |
162 | struct v9fs_mux_poll_task *vpt, *vptlast; | 164 | struct v9fs_mux_poll_task *vpt, *vptlast; |
165 | struct task_struct *pproc; | ||
163 | 166 | ||
164 | dprintk(DEBUG_MUX, "mux %p muxnum %d procnum %d\n", m, v9fs_mux_num, | 167 | dprintk(DEBUG_MUX, "mux %p muxnum %d procnum %d\n", m, v9fs_mux_num, |
165 | v9fs_mux_poll_task_num); | 168 | v9fs_mux_poll_task_num); |
@@ -171,13 +174,16 @@ static void v9fs_mux_poll_start(struct v9fs_mux_data *m) | |||
171 | if (v9fs_mux_poll_tasks[i].task == NULL) { | 174 | if (v9fs_mux_poll_tasks[i].task == NULL) { |
172 | vpt = &v9fs_mux_poll_tasks[i]; | 175 | vpt = &v9fs_mux_poll_tasks[i]; |
173 | dprintk(DEBUG_MUX, "create proc %p\n", vpt); | 176 | dprintk(DEBUG_MUX, "create proc %p\n", vpt); |
174 | vpt->task = | 177 | pproc = kthread_create(v9fs_poll_proc, vpt, |
175 | kthread_create(v9fs_poll_proc, vpt, | ||
176 | "v9fs-poll"); | 178 | "v9fs-poll"); |
177 | INIT_LIST_HEAD(&vpt->mux_list); | 179 | |
178 | vpt->muxnum = 0; | 180 | if (!IS_ERR(pproc)) { |
179 | v9fs_mux_poll_task_num++; | 181 | vpt->task = pproc; |
180 | wake_up_process(vpt->task); | 182 | INIT_LIST_HEAD(&vpt->mux_list); |
183 | vpt->muxnum = 0; | ||
184 | v9fs_mux_poll_task_num++; | ||
185 | wake_up_process(vpt->task); | ||
186 | } | ||
181 | break; | 187 | break; |
182 | } | 188 | } |
183 | } | 189 | } |
@@ -207,16 +213,21 @@ static void v9fs_mux_poll_start(struct v9fs_mux_data *m) | |||
207 | } | 213 | } |
208 | 214 | ||
209 | if (i >= ARRAY_SIZE(v9fs_mux_poll_tasks)) { | 215 | if (i >= ARRAY_SIZE(v9fs_mux_poll_tasks)) { |
216 | if (vptlast == NULL) | ||
217 | return -ENOMEM; | ||
218 | |||
210 | dprintk(DEBUG_MUX, "put in proc %d\n", i); | 219 | dprintk(DEBUG_MUX, "put in proc %d\n", i); |
211 | list_add(&m->mux_list, &vptlast->mux_list); | 220 | list_add(&m->mux_list, &vptlast->mux_list); |
212 | vptlast->muxnum++; | 221 | vptlast->muxnum++; |
213 | m->poll_task = vpt; | 222 | m->poll_task = vptlast; |
214 | memset(&m->poll_waddr, 0, sizeof(m->poll_waddr)); | 223 | memset(&m->poll_waddr, 0, sizeof(m->poll_waddr)); |
215 | init_poll_funcptr(&m->pt, v9fs_pollwait); | 224 | init_poll_funcptr(&m->pt, v9fs_pollwait); |
216 | } | 225 | } |
217 | 226 | ||
218 | v9fs_mux_num++; | 227 | v9fs_mux_num++; |
219 | down(&v9fs_mux_task_lock); | 228 | down(&v9fs_mux_task_lock); |
229 | |||
230 | return 0; | ||
220 | } | 231 | } |
221 | 232 | ||
222 | static void v9fs_mux_poll_stop(struct v9fs_mux_data *m) | 233 | static void v9fs_mux_poll_stop(struct v9fs_mux_data *m) |
@@ -283,7 +294,10 @@ struct v9fs_mux_data *v9fs_mux_init(struct v9fs_transport *trans, int msize, | |||
283 | INIT_WORK(&m->wq, v9fs_write_work, m); | 294 | INIT_WORK(&m->wq, v9fs_write_work, m); |
284 | m->wsched = 0; | 295 | m->wsched = 0; |
285 | memset(&m->poll_waddr, 0, sizeof(m->poll_waddr)); | 296 | memset(&m->poll_waddr, 0, sizeof(m->poll_waddr)); |
286 | v9fs_mux_poll_start(m); | 297 | m->poll_task = NULL; |
298 | n = v9fs_mux_poll_start(m); | ||
299 | if (n) | ||
300 | return ERR_PTR(n); | ||
287 | 301 | ||
288 | n = trans->poll(trans, &m->pt); | 302 | n = trans->poll(trans, &m->pt); |
289 | if (n & POLLIN) { | 303 | if (n & POLLIN) { |
diff --git a/fs/9p/mux.h b/fs/9p/mux.h index 02b13b14b05b..9473b84f24b2 100644 --- a/fs/9p/mux.h +++ b/fs/9p/mux.h | |||
@@ -40,7 +40,7 @@ struct v9fs_mux_data; | |||
40 | typedef void (*v9fs_mux_req_callback)(void *a, struct v9fs_fcall *tc, | 40 | typedef void (*v9fs_mux_req_callback)(void *a, struct v9fs_fcall *tc, |
41 | struct v9fs_fcall *rc, int err); | 41 | struct v9fs_fcall *rc, int err); |
42 | 42 | ||
43 | void v9fs_mux_global_init(void); | 43 | int v9fs_mux_global_init(void); |
44 | void v9fs_mux_global_exit(void); | 44 | void v9fs_mux_global_exit(void); |
45 | 45 | ||
46 | struct v9fs_mux_data *v9fs_mux_init(struct v9fs_transport *trans, int msize, | 46 | struct v9fs_mux_data *v9fs_mux_init(struct v9fs_transport *trans, int msize, |
@@ -55,3 +55,4 @@ int v9fs_mux_rpcnb(struct v9fs_mux_data *m, struct v9fs_fcall *tc, | |||
55 | 55 | ||
56 | void v9fs_mux_flush(struct v9fs_mux_data *m, int sendflush); | 56 | void v9fs_mux_flush(struct v9fs_mux_data *m, int sendflush); |
57 | void v9fs_mux_cancel(struct v9fs_mux_data *m, int err); | 57 | void v9fs_mux_cancel(struct v9fs_mux_data *m, int err); |
58 | int v9fs_errstr2errno(char *errstr, int len); | ||
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 519b21d8b15b..5250c428fc1f 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c | |||
@@ -269,6 +269,7 @@ v9fs_session_init(struct v9fs_session_info *v9ses, | |||
269 | int n = 0; | 269 | int n = 0; |
270 | int newfid = -1; | 270 | int newfid = -1; |
271 | int retval = -EINVAL; | 271 | int retval = -EINVAL; |
272 | struct v9fs_str *version; | ||
272 | 273 | ||
273 | v9ses->name = __getname(); | 274 | v9ses->name = __getname(); |
274 | if (!v9ses->name) | 275 | if (!v9ses->name) |
@@ -351,13 +352,16 @@ v9fs_session_init(struct v9fs_session_info *v9ses, | |||
351 | goto FreeFcall; | 352 | goto FreeFcall; |
352 | } | 353 | } |
353 | 354 | ||
354 | /* Really should check for 9P1 and report error */ | 355 | version = &fcall->params.rversion.version; |
355 | if (!v9fs_str_compare("9P2000.u", &fcall->params.rversion.version)) { | 356 | if (version->len==8 && !memcmp(version->str, "9P2000.u", 8)) { |
356 | dprintk(DEBUG_9P, "9P2000 UNIX extensions enabled\n"); | 357 | dprintk(DEBUG_9P, "9P2000 UNIX extensions enabled\n"); |
357 | v9ses->extended = 1; | 358 | v9ses->extended = 1; |
358 | } else { | 359 | } else if (version->len==6 && !memcmp(version->str, "9P2000", 6)) { |
359 | dprintk(DEBUG_9P, "9P2000 legacy mode enabled\n"); | 360 | dprintk(DEBUG_9P, "9P2000 legacy mode enabled\n"); |
360 | v9ses->extended = 0; | 361 | v9ses->extended = 0; |
362 | } else { | ||
363 | retval = -EREMOTEIO; | ||
364 | goto FreeFcall; | ||
361 | } | 365 | } |
362 | 366 | ||
363 | n = fcall->params.rversion.msize; | 367 | n = fcall->params.rversion.msize; |
@@ -449,12 +453,17 @@ extern int v9fs_error_init(void); | |||
449 | 453 | ||
450 | static int __init init_v9fs(void) | 454 | static int __init init_v9fs(void) |
451 | { | 455 | { |
456 | int ret; | ||
457 | |||
452 | v9fs_error_init(); | 458 | v9fs_error_init(); |
453 | 459 | ||
454 | printk(KERN_INFO "Installing v9fs 9P2000 file system support\n"); | 460 | printk(KERN_INFO "Installing v9fs 9P2000 file system support\n"); |
455 | 461 | ||
456 | v9fs_mux_global_init(); | 462 | ret = v9fs_mux_global_init(); |
457 | return register_filesystem(&v9fs_fs_type); | 463 | if (!ret) |
464 | ret = register_filesystem(&v9fs_fs_type); | ||
465 | |||
466 | return ret; | ||
458 | } | 467 | } |
459 | 468 | ||
460 | /** | 469 | /** |
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 742bcd0dc4a7..d933ef1fbd8a 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -768,6 +768,7 @@ void | |||
768 | v9fs_stat2inode(struct v9fs_stat *stat, struct inode *inode, | 768 | v9fs_stat2inode(struct v9fs_stat *stat, struct inode *inode, |
769 | struct super_block *sb) | 769 | struct super_block *sb) |
770 | { | 770 | { |
771 | int n; | ||
771 | char ext[32]; | 772 | char ext[32]; |
772 | struct v9fs_session_info *v9ses = sb->s_fs_info; | 773 | struct v9fs_session_info *v9ses = sb->s_fs_info; |
773 | 774 | ||
@@ -791,7 +792,11 @@ v9fs_stat2inode(struct v9fs_stat *stat, struct inode *inode, | |||
791 | int major = -1; | 792 | int major = -1; |
792 | int minor = -1; | 793 | int minor = -1; |
793 | 794 | ||
794 | v9fs_str_copy(ext, sizeof(ext), &stat->extension); | 795 | n = stat->extension.len; |
796 | if (n > sizeof(ext)-1) | ||
797 | n = sizeof(ext)-1; | ||
798 | memmove(ext, stat->extension.str, n); | ||
799 | ext[n] = 0; | ||
795 | sscanf(ext, "%c %u %u", &type, &major, &minor); | 800 | sscanf(ext, "%c %u %u", &type, &major, &minor); |
796 | switch (type) { | 801 | switch (type) { |
797 | case 'c': | 802 | case 'c': |
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index d4d71a9ca573..ae0f06b3c11a 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -122,11 +122,10 @@ static struct super_block *v9fs_get_sb(struct file_system_type | |||
122 | 122 | ||
123 | dprintk(DEBUG_VFS, " \n"); | 123 | dprintk(DEBUG_VFS, " \n"); |
124 | 124 | ||
125 | v9ses = kmalloc(sizeof(struct v9fs_session_info), GFP_KERNEL); | 125 | v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL); |
126 | if (!v9ses) | 126 | if (!v9ses) |
127 | return ERR_PTR(-ENOMEM); | 127 | return ERR_PTR(-ENOMEM); |
128 | 128 | ||
129 | memset(v9ses, 0, sizeof(struct v9fs_session_info)); | ||
130 | if ((newfid = v9fs_session_init(v9ses, dev_name, data)) < 0) { | 129 | if ((newfid = v9fs_session_init(v9ses, dev_name, data)) < 0) { |
131 | dprintk(DEBUG_ERROR, "problem initiating session\n"); | 130 | dprintk(DEBUG_ERROR, "problem initiating session\n"); |
132 | kfree(v9ses); | 131 | kfree(v9ses); |