Skip to content

Commit

Permalink
fuse: check conn_error earlier
Browse files Browse the repository at this point in the history
fc->conn_error is set once in FUSE_INIT reply and never cleared.  Check it
in request allocation, there's no sense in doing all the preparation if
sending will surely fail.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Reviewed-by: Ashish Samant <ashish.samant@oracle.com>
  • Loading branch information
Miklos Szeredi committed Jul 1, 2015
1 parent 5437f24 commit de15522
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/fuse/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ static struct fuse_req *__fuse_get_req(struct fuse_conn *fc, unsigned npages,
if (!fc->connected)
goto out;

err = -ECONNREFUSED;
if (fc->conn_error)
goto out;

req = fuse_request_alloc(npages);
err = -ENOMEM;
if (!req) {
Expand Down Expand Up @@ -498,8 +502,6 @@ static void __fuse_request_send(struct fuse_conn *fc, struct fuse_req *req)
spin_lock(&fc->lock);
if (!fc->connected)
req->out.h.error = -ENOTCONN;
else if (fc->conn_error)
req->out.h.error = -ECONNREFUSED;
else {
req->in.h.unique = fuse_get_unique(fc);
queue_request(fc, req);
Expand Down

0 comments on commit de15522

Please sign in to comment.