Commit e96edd94 authored by Miklos Szeredi's avatar Miklos Szeredi

fuse: duplicate ->connected in pqueue

This will allow checking ->connected just with the processing queue lock.
Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
Reviewed-by: default avatarAshish Samant <ashish.samant@oracle.com>
parent 3a2b5b9c
...@@ -1303,7 +1303,7 @@ static ssize_t fuse_dev_do_read(struct fuse_conn *fc, struct file *file, ...@@ -1303,7 +1303,7 @@ static ssize_t fuse_dev_do_read(struct fuse_conn *fc, struct file *file,
fuse_copy_finish(cs); fuse_copy_finish(cs);
spin_lock(&fc->lock); spin_lock(&fc->lock);
clear_bit(FR_LOCKED, &req->flags); clear_bit(FR_LOCKED, &req->flags);
if (!fc->connected) { if (!fpq->connected) {
request_end(fc, req); request_end(fc, req);
return -ENODEV; return -ENODEV;
} }
...@@ -1891,7 +1891,7 @@ static ssize_t fuse_dev_do_write(struct fuse_conn *fc, ...@@ -1891,7 +1891,7 @@ static ssize_t fuse_dev_do_write(struct fuse_conn *fc,
spin_lock(&fc->lock); spin_lock(&fc->lock);
err = -ENOENT; err = -ENOENT;
if (!fc->connected) if (!fpq->connected)
goto err_unlock; goto err_unlock;
req = request_find(fpq, oh.unique); req = request_find(fpq, oh.unique);
...@@ -1928,7 +1928,7 @@ static ssize_t fuse_dev_do_write(struct fuse_conn *fc, ...@@ -1928,7 +1928,7 @@ static ssize_t fuse_dev_do_write(struct fuse_conn *fc,
spin_lock(&fc->lock); spin_lock(&fc->lock);
clear_bit(FR_LOCKED, &req->flags); clear_bit(FR_LOCKED, &req->flags);
if (!fc->connected) if (!fpq->connected)
err = -ENOENT; err = -ENOENT;
else if (err) else if (err)
req->out.h.error = -EIO; req->out.h.error = -EIO;
...@@ -2125,6 +2125,7 @@ void fuse_abort_conn(struct fuse_conn *fc) ...@@ -2125,6 +2125,7 @@ void fuse_abort_conn(struct fuse_conn *fc)
fc->connected = 0; fc->connected = 0;
fc->blocked = 0; fc->blocked = 0;
fuse_set_initialized(fc); fuse_set_initialized(fc);
fpq->connected = 0;
list_for_each_entry_safe(req, next, &fpq->io, list) { list_for_each_entry_safe(req, next, &fpq->io, list) {
req->out.h.error = -ECONNABORTED; req->out.h.error = -ECONNABORTED;
spin_lock(&req->waitq.lock); spin_lock(&req->waitq.lock);
......
...@@ -402,6 +402,9 @@ struct fuse_iqueue { ...@@ -402,6 +402,9 @@ struct fuse_iqueue {
}; };
struct fuse_pqueue { struct fuse_pqueue {
/** Connection established */
unsigned connected;
/** The list of requests being processed */ /** The list of requests being processed */
struct list_head processing; struct list_head processing;
......
...@@ -582,6 +582,7 @@ static void fuse_pqueue_init(struct fuse_pqueue *fpq) ...@@ -582,6 +582,7 @@ static void fuse_pqueue_init(struct fuse_pqueue *fpq)
memset(fpq, 0, sizeof(struct fuse_pqueue)); memset(fpq, 0, sizeof(struct fuse_pqueue));
INIT_LIST_HEAD(&fpq->processing); INIT_LIST_HEAD(&fpq->processing);
INIT_LIST_HEAD(&fpq->io); INIT_LIST_HEAD(&fpq->io);
fpq->connected = 1;
} }
void fuse_conn_init(struct fuse_conn *fc) void fuse_conn_init(struct fuse_conn *fc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment