req->in.h.len = sizeof(struct fuse_in_header) +
len_args(req->in.numargs, (struct fuse_arg *) req->in.args);
list_add_tail(&req->list, &fiq->pending);
- wake_up(&fiq->waitq);
+ wake_up_locked(&fiq->waitq);
kill_fasync(&fiq->fasync, SIGIO, POLL_IN);
}
forget->forget_one.nlookup = nlookup;
spin_lock(&fc->lock);
+ spin_lock(&fiq->waitq.lock);
if (fiq->connected) {
fiq->forget_list_tail->next = forget;
fiq->forget_list_tail = forget;
- wake_up(&fiq->waitq);
+ wake_up_locked(&fiq->waitq);
kill_fasync(&fiq->fasync, SIGIO, POLL_IN);
} else {
kfree(forget);
}
+ spin_unlock(&fiq->waitq.lock);
spin_unlock(&fc->lock);
}
req = list_entry(fc->bg_queue.next, struct fuse_req, list);
list_del(&req->list);
fc->active_background++;
+ spin_lock(&fiq->waitq.lock);
req->in.h.unique = fuse_get_unique(fiq);
queue_request(fiq, req);
+ spin_unlock(&fiq->waitq.lock);
}
}
static void request_end(struct fuse_conn *fc, struct fuse_req *req)
__releases(fc->lock)
{
+ struct fuse_iqueue *fiq = &fc->iq;
void (*end) (struct fuse_conn *, struct fuse_req *) = req->end;
req->end = NULL;
list_del_init(&req->list);
+ spin_lock(&fiq->waitq.lock);
list_del_init(&req->intr_entry);
+ spin_unlock(&fiq->waitq.lock);
WARN_ON(test_bit(FR_PENDING, &req->flags));
WARN_ON(test_bit(FR_SENT, &req->flags));
smp_wmb();
static void queue_interrupt(struct fuse_iqueue *fiq, struct fuse_req *req)
{
+ spin_lock(&fiq->waitq.lock);
list_add_tail(&req->intr_entry, &fiq->interrupts);
- wake_up(&fiq->waitq);
+ wake_up_locked(&fiq->waitq);
+ spin_unlock(&fiq->waitq.lock);
kill_fasync(&fiq->fasync, SIGIO, POLL_IN);
}
static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req)
{
+ struct fuse_iqueue *fiq = &fc->iq;
int err;
if (!fc->no_interrupt) {
spin_lock(&fc->lock);
set_bit(FR_INTERRUPTED, &req->flags);
if (test_bit(FR_SENT, &req->flags))
- queue_interrupt(&fc->iq, req);
+ queue_interrupt(fiq, req);
spin_unlock(&fc->lock);
}
return;
spin_lock(&fc->lock);
+ spin_lock(&fiq->waitq.lock);
/* Request is not yet in userspace, bail out */
if (test_bit(FR_PENDING, &req->flags)) {
list_del(&req->list);
+ spin_unlock(&fiq->waitq.lock);
spin_unlock(&fc->lock);
__fuse_put_request(req);
req->out.h.error = -EINTR;
return;
}
+ spin_unlock(&fiq->waitq.lock);
spin_unlock(&fc->lock);
}
BUG_ON(test_bit(FR_BACKGROUND, &req->flags));
spin_lock(&fc->lock);
+ spin_lock(&fiq->waitq.lock);
if (!fiq->connected) {
spin_unlock(&fc->lock);
+ spin_unlock(&fiq->waitq.lock);
req->out.h.error = -ENOTCONN;
} else {
req->in.h.unique = fuse_get_unique(fiq);
/* acquire extra reference, since request is still needed
after request_end() */
__fuse_get_request(req);
+ spin_unlock(&fiq->waitq.lock);
spin_unlock(&fc->lock);
request_wait_answer(fc, req);
__clear_bit(FR_ISREPLY, &req->flags);
req->in.h.unique = unique;
spin_lock(&fc->lock);
+ spin_lock(&fiq->waitq.lock);
if (fiq->connected) {
queue_request(fiq, req);
err = 0;
}
+ spin_unlock(&fiq->waitq.lock);
spin_unlock(&fc->lock);
return err;
/* Wait until a request is available on the pending list */
static void request_wait(struct fuse_conn *fc)
+__releases(fc->iq.waitq.lock)
__releases(fc->lock)
__acquires(fc->lock)
+__acquires(fc->iq.waitq.lock)
{
struct fuse_iqueue *fiq = &fc->iq;
DECLARE_WAITQUEUE(wait, current);
if (signal_pending(current))
break;
+ spin_unlock(&fiq->waitq.lock);
spin_unlock(&fc->lock);
schedule();
spin_lock(&fc->lock);
+ spin_lock(&fiq->waitq.lock);
}
set_current_state(TASK_RUNNING);
remove_wait_queue(&fiq->waitq, &wait);
*/
static int fuse_read_interrupt(struct fuse_conn *fc, struct fuse_copy_state *cs,
size_t nbytes, struct fuse_req *req)
+__releases(fc->iq.waitq.lock)
__releases(fc->lock)
{
+ struct fuse_iqueue *fiq = &fc->iq;
struct fuse_in_header ih;
struct fuse_interrupt_in arg;
unsigned reqsize = sizeof(ih) + sizeof(arg);
int err;
list_del_init(&req->intr_entry);
- req->intr_unique = fuse_get_unique(&fc->iq);
+ req->intr_unique = fuse_get_unique(fiq);
memset(&ih, 0, sizeof(ih));
memset(&arg, 0, sizeof(arg));
ih.len = reqsize;
ih.unique = req->intr_unique;
arg.unique = req->in.h.unique;
+ spin_unlock(&fiq->waitq.lock);
spin_unlock(&fc->lock);
if (nbytes < reqsize)
return -EINVAL;
static int fuse_read_single_forget(struct fuse_conn *fc,
struct fuse_copy_state *cs,
size_t nbytes)
+__releases(fc->iq.waitq.lock)
__releases(fc->lock)
{
int err;
.len = sizeof(ih) + sizeof(arg),
};
+ spin_unlock(&fiq->waitq.lock);
spin_unlock(&fc->lock);
kfree(forget);
if (nbytes < ih.len)
static int fuse_read_batch_forget(struct fuse_conn *fc,
struct fuse_copy_state *cs, size_t nbytes)
+__releases(fc->iq.waitq.lock)
__releases(fc->lock)
{
int err;
};
if (nbytes < ih.len) {
+ spin_unlock(&fiq->waitq.lock);
spin_unlock(&fc->lock);
return -EINVAL;
}
max_forgets = (nbytes - ih.len) / sizeof(struct fuse_forget_one);
head = dequeue_forget(fiq, max_forgets, &count);
+ spin_unlock(&fiq->waitq.lock);
spin_unlock(&fc->lock);
arg.count = count;
static int fuse_read_forget(struct fuse_conn *fc, struct fuse_copy_state *cs,
size_t nbytes)
+__releases(fc->iq.waitq.lock)
__releases(fc->lock)
{
struct fuse_iqueue *fiq = &fc->iq;
restart:
spin_lock(&fc->lock);
+ spin_lock(&fiq->waitq.lock);
err = -EAGAIN;
if ((file->f_flags & O_NONBLOCK) && fiq->connected &&
!request_pending(fiq))
req = list_entry(fiq->pending.next, struct fuse_req, list);
clear_bit(FR_PENDING, &req->flags);
list_del_init(&req->list);
+ spin_unlock(&fiq->waitq.lock);
+
list_add(&req->list, &fc->io);
in = &req->in;
return reqsize;
err_unlock:
+ spin_unlock(&fiq->waitq.lock);
spin_unlock(&fc->lock);
return err;
}
poll_wait(file, &fiq->waitq, wait);
spin_lock(&fc->lock);
+ spin_lock(&fiq->waitq.lock);
if (!fiq->connected)
mask = POLLERR;
else if (request_pending(fiq))
mask |= POLLIN | POLLRDNORM;
+ spin_unlock(&fiq->waitq.lock);
spin_unlock(&fc->lock);
return mask;
fc->max_background = UINT_MAX;
flush_bg_queue(fc);
+ spin_lock(&fiq->waitq.lock);
fiq->connected = 0;
list_splice_init(&fiq->pending, &to_end2);
while (forget_pending(fiq))
kfree(dequeue_forget(fiq, 1, NULL));
- wake_up_all(&fiq->waitq);
+ wake_up_all_locked(&fiq->waitq);
+ spin_unlock(&fiq->waitq.lock);
kill_fasync(&fiq->fasync, SIGIO, POLL_IN);
list_splice_init(&fc->processing, &to_end2);