aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/9p/mux.c20
-rw-r--r--fs/9p/mux.h1
-rw-r--r--fs/9p/v9fs.c9
-rw-r--r--fs/9p/v9fs.h4
-rw-r--r--fs/9p/vfs_super.c9
5 files changed, 40 insertions, 3 deletions
diff --git a/fs/9p/mux.c b/fs/9p/mux.c
index 8ebc1af2c245..0854bef58c16 100644
--- a/fs/9p/mux.c
+++ b/fs/9p/mux.c
@@ -324,6 +324,26 @@ v9fs_mux_rpc(struct v9fs_session_info *v9ses, struct v9fs_fcall *tcall,
324} 324}
325 325
326/** 326/**
327 * v9fs_mux_cancel_requests - cancels all pending requests
328 *
329 * @v9ses: session info structure
330 * @err: error code to return to the requests
331 */
332void v9fs_mux_cancel_requests(struct v9fs_session_info *v9ses, int err)
333{
334 struct v9fs_rpcreq *rptr;
335 struct v9fs_rpcreq *rreq;
336
337 dprintk(DEBUG_MUX, " %d\n", err);
338 spin_lock(&v9ses->muxlock);
339 list_for_each_entry_safe(rreq, rptr, &v9ses->mux_fcalls, next) {
340 rreq->err = err;
341 }
342 spin_unlock(&v9ses->muxlock);
343 wake_up_all(&v9ses->read_wait);
344}
345
346/**
327 * v9fs_recvproc - kproc to handle demultiplexing responses 347 * v9fs_recvproc - kproc to handle demultiplexing responses
328 * @data: session info structure 348 * @data: session info structure
329 * 349 *
diff --git a/fs/9p/mux.h b/fs/9p/mux.h
index d7d8fa1c1529..82ce793af1b5 100644
--- a/fs/9p/mux.h
+++ b/fs/9p/mux.h
@@ -37,3 +37,4 @@ struct v9fs_rpcreq {
37int v9fs_mux_init(struct v9fs_session_info *v9ses, const char *dev_name); 37int v9fs_mux_init(struct v9fs_session_info *v9ses, const char *dev_name);
38long v9fs_mux_rpc(struct v9fs_session_info *v9ses, 38long v9fs_mux_rpc(struct v9fs_session_info *v9ses,
39 struct v9fs_fcall *tcall, struct v9fs_fcall **rcall); 39 struct v9fs_fcall *tcall, struct v9fs_fcall **rcall);
40void v9fs_mux_cancel_requests(struct v9fs_session_info *v9ses, int err);
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index a573b751dd9a..13bdbbab4387 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -409,6 +409,15 @@ void v9fs_session_close(struct v9fs_session_info *v9ses)
409 putname(v9ses->remotename); 409 putname(v9ses->remotename);
410} 410}
411 411
412/**
413 * v9fs_session_cancel - mark transport as disconnected
414 * and cancel all pending requests.
415 */
416void v9fs_session_cancel(struct v9fs_session_info *v9ses) {
417 v9ses->transport->status = Disconnected;
418 v9fs_mux_cancel_requests(v9ses, -EIO);
419}
420
412extern int v9fs_error_init(void); 421extern int v9fs_error_init(void);
413 422
414/** 423/**
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h
index 52203027b158..45dcef42bdd6 100644
--- a/fs/9p/v9fs.h
+++ b/fs/9p/v9fs.h
@@ -89,9 +89,7 @@ struct v9fs_session_info *v9fs_inode2v9ses(struct inode *);
89void v9fs_session_close(struct v9fs_session_info *v9ses); 89void v9fs_session_close(struct v9fs_session_info *v9ses);
90int v9fs_get_idpool(struct v9fs_idpool *p); 90int v9fs_get_idpool(struct v9fs_idpool *p);
91void v9fs_put_idpool(int id, struct v9fs_idpool *p); 91void v9fs_put_idpool(int id, struct v9fs_idpool *p);
92int v9fs_get_option(char *opts, char *name, char *buf, int buflen); 92void v9fs_session_cancel(struct v9fs_session_info *v9ses);
93long long v9fs_get_int_option(char *opts, char *name, long long dflt);
94int v9fs_parse_tcp_devname(const char *devname, char **addr, char **remotename);
95 93
96#define V9FS_MAGIC 0x01021997 94#define V9FS_MAGIC 0x01021997
97 95
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index ce0778acc90a..868f350b2c5f 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -257,10 +257,19 @@ static int v9fs_show_options(struct seq_file *m, struct vfsmount *mnt)
257 return 0; 257 return 0;
258} 258}
259 259
260static void
261v9fs_umount_begin(struct super_block *sb)
262{
263 struct v9fs_session_info *v9ses = sb->s_fs_info;
264
265 v9fs_session_cancel(v9ses);
266}
267
260static struct super_operations v9fs_super_ops = { 268static struct super_operations v9fs_super_ops = {
261 .statfs = simple_statfs, 269 .statfs = simple_statfs,
262 .clear_inode = v9fs_clear_inode, 270 .clear_inode = v9fs_clear_inode,
263 .show_options = v9fs_show_options, 271 .show_options = v9fs_show_options,
272 .umount_begin = v9fs_umount_begin,
264}; 273};
265 274
266struct file_system_type v9fs_fs_type = { 275struct file_system_type v9fs_fs_type = {