From a314f2748e76c866222a18e639c640d584d277fb Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Wed, 1 Feb 2012 12:48:53 -0800 Subject: net/9p: don't allow Tflush to be interrupted When a signal is received while sending a Tflush, the client, which has recursed into p9_client_rpc() while sending another request, should wait for Rflush as long as the transport is still up. Signed-off-by: Jim Garlick Signed-off-by: Eric Van Hensbergen --- net/9p/client.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/9p/client.c b/net/9p/client.c index 776618cd2be5..6efbb334c3ad 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -740,10 +740,18 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...) c->status = Disconnected; goto reterr; } +again: /* Wait for the response */ err = wait_event_interruptible(*req->wq, req->status >= REQ_STATUS_RCVD); + if ((err == -ERESTARTSYS) && (c->status == Connected) + && (type == P9_TFLUSH)) { + sigpending = 1; + clear_thread_flag(TIF_SIGPENDING); + goto again; + } + if (req->status == REQ_STATUS_ERROR) { p9_debug(P9_DEBUG_ERROR, "req_status error %d\n", req->t_err); err = req->t_err; -- cgit v1.2.3 From 208f3c28aab706fca2bc1bae7091da8a99c5e322 Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Sun, 26 Feb 2012 14:49:57 -0600 Subject: net/9p: handle flushed Tclunk/Tremove When a Tclunk or Tremove request is flushed, the fid is not freed on the server. p9_client_clunk() should retry once on interrupt, then if interrupted again, leak the fid for the duration of the connection. p9_client_remove() should call p9_client_clunk() on interrupt instead of unconditionally destroying the fid. Signed-off-by: Jim Garlick Signed-off-by: Eric Van Hensbergen --- net/9p/client.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/net/9p/client.c b/net/9p/client.c index 6efbb334c3ad..b23a17c431c8 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -1428,6 +1428,7 @@ int p9_client_clunk(struct p9_fid *fid) int err; struct p9_client *clnt; struct p9_req_t *req; + int retries = 0; if (!fid) { pr_warn("%s (%d): Trying to clunk with NULL fid\n", @@ -1436,7 +1437,9 @@ int p9_client_clunk(struct p9_fid *fid) return 0; } - p9_debug(P9_DEBUG_9P, ">>> TCLUNK fid %d\n", fid->fid); +again: + p9_debug(P9_DEBUG_9P, ">>> TCLUNK fid %d (try %d)\n", fid->fid, + retries); err = 0; clnt = fid->clnt; @@ -1452,8 +1455,14 @@ int p9_client_clunk(struct p9_fid *fid) error: /* * Fid is not valid even after a failed clunk + * If interrupted, retry once then give up and + * leak fid until umount. */ - p9_fid_destroy(fid); + if (err == -ERESTARTSYS) { + if (retries++ == 0) + goto again; + } else + p9_fid_destroy(fid); return err; } EXPORT_SYMBOL(p9_client_clunk); @@ -1478,7 +1487,10 @@ int p9_client_remove(struct p9_fid *fid) p9_free_req(clnt, req); error: - p9_fid_destroy(fid); + if (err == -ERESTARTSYS) + p9_client_clunk(fid); + else + p9_fid_destroy(fid); return err; } EXPORT_SYMBOL(p9_client_remove); -- cgit v1.2.3 From 5bdad93387c64f0095df7ae9a252ff44234a8b3f Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Thu, 30 Jun 2011 09:03:38 -0700 Subject: 9p: statfs should not override server f_type Allow a 9p2000.L server to supply the statfs f_type value rather than hardwiring V9FS_MAGIC. It is desirable to give the server this option in some applications, e.g. I/O forwarding. Signed-off-by: Jim Garlick Signed-off-by: Eric Van Hensbergen --- fs/9p/vfs_super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 7b0cd87b07c2..e55d8f7b2887 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c @@ -260,7 +260,7 @@ static int v9fs_statfs(struct dentry *dentry, struct kstatfs *buf) if (v9fs_proto_dotl(v9ses)) { res = p9_client_statfs(fid, &rs); if (res == 0) { - buf->f_type = V9FS_MAGIC; + buf->f_type = rs.type; buf->f_bsize = rs.bsize; buf->f_blocks = rs.blocks; buf->f_bfree = rs.bfree; -- cgit v1.2.3