summaryrefslogtreecommitdiffstats
path: root/fs/fuse/dev.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2015-07-01 16:26:01 +0200
committerMiklos Szeredi <mszeredi@suse.cz>2015-07-01 16:26:01 +0200
commite16714d8756dc1237a66994e139b61feebcf707a (patch)
tree149f1106ae65abfb03e892a295f15d3a17477672 /fs/fuse/dev.c
parentf88996a93324483ff3ec027312bbacacf97a555b (diff)
downloadop-kernel-dev-e16714d8756dc1237a66994e139b61feebcf707a.zip
op-kernel-dev-e16714d8756dc1237a66994e139b61feebcf707a.tar.gz
fuse: duplicate ->connected in iqueue
This will allow checking ->connected just with the input queue lock. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Reviewed-by: Ashish Samant <ashish.samant@oracle.com>
Diffstat (limited to 'fs/fuse/dev.c')
-rw-r--r--fs/fuse/dev.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 24407e2..a24ead9 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -341,7 +341,7 @@ void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget,
forget->forget_one.nlookup = nlookup;
spin_lock(&fc->lock);
- if (fc->connected) {
+ if (fiq->connected) {
fiq->forget_list_tail->next = forget;
fiq->forget_list_tail = forget;
wake_up(&fiq->waitq);
@@ -471,14 +471,14 @@ static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req)
static void __fuse_request_send(struct fuse_conn *fc, struct fuse_req *req)
{
+ struct fuse_iqueue *fiq = &fc->iq;
+
BUG_ON(test_bit(FR_BACKGROUND, &req->flags));
spin_lock(&fc->lock);
- if (!fc->connected) {
+ if (!fiq->connected) {
spin_unlock(&fc->lock);
req->out.h.error = -ENOTCONN;
} else {
- struct fuse_iqueue *fiq = &fc->iq;
-
req->in.h.unique = fuse_get_unique(fiq);
queue_request(fiq, req);
/* acquire extra reference, since request is still needed
@@ -619,7 +619,7 @@ static int fuse_request_send_notify_reply(struct fuse_conn *fc,
__clear_bit(FR_ISREPLY, &req->flags);
req->in.h.unique = unique;
spin_lock(&fc->lock);
- if (fc->connected) {
+ if (fiq->connected) {
queue_request(fiq, req);
err = 0;
}
@@ -1071,7 +1071,7 @@ __acquires(fc->lock)
DECLARE_WAITQUEUE(wait, current);
add_wait_queue_exclusive(&fiq->waitq, &wait);
- while (fc->connected && !request_pending(fiq)) {
+ while (fiq->connected && !request_pending(fiq)) {
set_current_state(TASK_INTERRUPTIBLE);
if (signal_pending(current))
break;
@@ -1261,13 +1261,13 @@ static ssize_t fuse_dev_do_read(struct fuse_conn *fc, struct file *file,
restart:
spin_lock(&fc->lock);
err = -EAGAIN;
- if ((file->f_flags & O_NONBLOCK) && fc->connected &&
+ if ((file->f_flags & O_NONBLOCK) && fiq->connected &&
!request_pending(fiq))
goto err_unlock;
request_wait(fc);
err = -ENODEV;
- if (!fc->connected)
+ if (!fiq->connected)
goto err_unlock;
err = -ERESTARTSYS;
if (!request_pending(fiq))
@@ -2054,7 +2054,7 @@ static unsigned fuse_dev_poll(struct file *file, poll_table *wait)
poll_wait(file, &fiq->waitq, wait);
spin_lock(&fc->lock);
- if (!fc->connected)
+ if (!fiq->connected)
mask = POLLERR;
else if (request_pending(fiq))
mask |= POLLIN | POLLRDNORM;
@@ -2127,6 +2127,7 @@ void fuse_abort_conn(struct fuse_conn *fc)
LIST_HEAD(to_end2);
fc->connected = 0;
+ fiq->connected = 0;
fc->blocked = 0;
fuse_set_initialized(fc);
list_for_each_entry_safe(req, next, &fc->io, list) {
OpenPOWER on IntegriCloud