diff options
Diffstat (limited to 'fs/9p/v9fs.c')
-rw-r--r-- | fs/9p/v9fs.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 6c7f6a251115..f8b86e92cd66 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/sched.h> | 29 | #include <linux/sched.h> |
30 | #include <linux/parser.h> | 30 | #include <linux/parser.h> |
31 | #include <linux/idr.h> | 31 | #include <linux/idr.h> |
32 | #include <linux/slab.h> | ||
32 | #include <net/9p/9p.h> | 33 | #include <net/9p/9p.h> |
33 | #include <net/9p/client.h> | 34 | #include <net/9p/client.h> |
34 | #include <net/9p/transport.h> | 35 | #include <net/9p/transport.h> |
@@ -237,11 +238,18 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, | |||
237 | return ERR_PTR(-ENOMEM); | 238 | return ERR_PTR(-ENOMEM); |
238 | } | 239 | } |
239 | 240 | ||
241 | rc = bdi_setup_and_register(&v9ses->bdi, "9p", BDI_CAP_MAP_COPY); | ||
242 | if (rc) { | ||
243 | __putname(v9ses->aname); | ||
244 | __putname(v9ses->uname); | ||
245 | return ERR_PTR(rc); | ||
246 | } | ||
247 | |||
240 | spin_lock(&v9fs_sessionlist_lock); | 248 | spin_lock(&v9fs_sessionlist_lock); |
241 | list_add(&v9ses->slist, &v9fs_sessionlist); | 249 | list_add(&v9ses->slist, &v9fs_sessionlist); |
242 | spin_unlock(&v9fs_sessionlist_lock); | 250 | spin_unlock(&v9fs_sessionlist_lock); |
243 | 251 | ||
244 | v9ses->flags = V9FS_PROTO_2000U | V9FS_ACCESS_USER; | 252 | v9ses->flags = V9FS_ACCESS_USER; |
245 | strcpy(v9ses->uname, V9FS_DEFUSER); | 253 | strcpy(v9ses->uname, V9FS_DEFUSER); |
246 | strcpy(v9ses->aname, V9FS_DEFANAME); | 254 | strcpy(v9ses->aname, V9FS_DEFANAME); |
247 | v9ses->uid = ~0; | 255 | v9ses->uid = ~0; |
@@ -262,8 +270,10 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, | |||
262 | goto error; | 270 | goto error; |
263 | } | 271 | } |
264 | 272 | ||
265 | if (!p9_is_proto_dotu(v9ses->clnt)) | 273 | if (p9_is_proto_dotl(v9ses->clnt)) |
266 | v9ses->flags &= ~V9FS_PROTO_2000U; | 274 | v9ses->flags |= V9FS_PROTO_2000L; |
275 | else if (p9_is_proto_dotu(v9ses->clnt)) | ||
276 | v9ses->flags |= V9FS_PROTO_2000U; | ||
267 | 277 | ||
268 | v9ses->maxdata = v9ses->clnt->msize - P9_IOHDRSZ; | 278 | v9ses->maxdata = v9ses->clnt->msize - P9_IOHDRSZ; |
269 | 279 | ||
@@ -298,6 +308,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, | |||
298 | return fid; | 308 | return fid; |
299 | 309 | ||
300 | error: | 310 | error: |
311 | bdi_destroy(&v9ses->bdi); | ||
301 | return ERR_PTR(retval); | 312 | return ERR_PTR(retval); |
302 | } | 313 | } |
303 | 314 | ||
@@ -323,6 +334,8 @@ void v9fs_session_close(struct v9fs_session_info *v9ses) | |||
323 | __putname(v9ses->uname); | 334 | __putname(v9ses->uname); |
324 | __putname(v9ses->aname); | 335 | __putname(v9ses->aname); |
325 | 336 | ||
337 | bdi_destroy(&v9ses->bdi); | ||
338 | |||
326 | spin_lock(&v9fs_sessionlist_lock); | 339 | spin_lock(&v9fs_sessionlist_lock); |
327 | list_del(&v9ses->slist); | 340 | list_del(&v9ses->slist); |
328 | spin_unlock(&v9fs_sessionlist_lock); | 341 | spin_unlock(&v9fs_sessionlist_lock); |
@@ -340,6 +353,19 @@ void v9fs_session_cancel(struct v9fs_session_info *v9ses) { | |||
340 | p9_client_disconnect(v9ses->clnt); | 353 | p9_client_disconnect(v9ses->clnt); |
341 | } | 354 | } |
342 | 355 | ||
356 | /** | ||
357 | * v9fs_session_begin_cancel - Begin terminate of a session | ||
358 | * @v9ses: session to terminate | ||
359 | * | ||
360 | * After this call we don't allow any request other than clunk. | ||
361 | */ | ||
362 | |||
363 | void v9fs_session_begin_cancel(struct v9fs_session_info *v9ses) | ||
364 | { | ||
365 | P9_DPRINTK(P9_DEBUG_ERROR, "begin cancel session %p\n", v9ses); | ||
366 | p9_client_begin_disconnect(v9ses->clnt); | ||
367 | } | ||
368 | |||
343 | extern int v9fs_error_init(void); | 369 | extern int v9fs_error_init(void); |
344 | 370 | ||
345 | static struct kobject *v9fs_kobj; | 371 | static struct kobject *v9fs_kobj; |