aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/fuse/dev.c39
-rw-r--r--fs/fuse/fuse_i.h4
2 files changed, 21 insertions, 22 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index ae26f37e53a1..6b5f74cb7b54 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -202,7 +202,7 @@ void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req)
202 202
203/* 203/*
204 * This function is called when a request is finished. Either a reply 204 * This function is called when a request is finished. Either a reply
205 * has arrived or it was interrupted (and not yet sent) or some error 205 * has arrived or it was aborted (and not yet sent) or some error
206 * occurred during communication with userspace, or the device file 206 * occurred during communication with userspace, or the device file
207 * was closed. The requester thread is woken up (if still waiting), 207 * was closed. The requester thread is woken up (if still waiting),
208 * the 'end' callback is called if given, else the reference to the 208 * the 'end' callback is called if given, else the reference to the
@@ -250,12 +250,12 @@ static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req)
250 restore_sigs(&oldset); 250 restore_sigs(&oldset);
251 } 251 }
252 spin_lock(&fc->lock); 252 spin_lock(&fc->lock);
253 if (req->state == FUSE_REQ_FINISHED && !req->interrupted) 253 if (req->state == FUSE_REQ_FINISHED && !req->aborted)
254 return; 254 return;
255 255
256 if (!req->interrupted) { 256 if (!req->aborted) {
257 req->out.h.error = -EINTR; 257 req->out.h.error = -EINTR;
258 req->interrupted = 1; 258 req->aborted = 1;
259 } 259 }
260 if (req->locked) { 260 if (req->locked) {
261 /* This is uninterruptible sleep, because data is 261 /* This is uninterruptible sleep, because data is
@@ -361,14 +361,14 @@ void request_send_background(struct fuse_conn *fc, struct fuse_req *req)
361/* 361/*
362 * Lock the request. Up to the next unlock_request() there mustn't be 362 * Lock the request. Up to the next unlock_request() there mustn't be
363 * anything that could cause a page-fault. If the request was already 363 * anything that could cause a page-fault. If the request was already
364 * interrupted bail out. 364 * aborted bail out.
365 */ 365 */
366static int lock_request(struct fuse_conn *fc, struct fuse_req *req) 366static int lock_request(struct fuse_conn *fc, struct fuse_req *req)
367{ 367{
368 int err = 0; 368 int err = 0;
369 if (req) { 369 if (req) {
370 spin_lock(&fc->lock); 370 spin_lock(&fc->lock);
371 if (req->interrupted) 371 if (req->aborted)
372 err = -ENOENT; 372 err = -ENOENT;
373 else 373 else
374 req->locked = 1; 374 req->locked = 1;
@@ -378,7 +378,7 @@ static int lock_request(struct fuse_conn *fc, struct fuse_req *req)
378} 378}
379 379
380/* 380/*
381 * Unlock request. If it was interrupted during being locked, the 381 * Unlock request. If it was aborted during being locked, the
382 * requester thread is currently waiting for it to be unlocked, so 382 * requester thread is currently waiting for it to be unlocked, so
383 * wake it up. 383 * wake it up.
384 */ 384 */
@@ -387,7 +387,7 @@ static void unlock_request(struct fuse_conn *fc, struct fuse_req *req)
387 if (req) { 387 if (req) {
388 spin_lock(&fc->lock); 388 spin_lock(&fc->lock);
389 req->locked = 0; 389 req->locked = 0;
390 if (req->interrupted) 390 if (req->aborted)
391 wake_up(&req->waitq); 391 wake_up(&req->waitq);
392 spin_unlock(&fc->lock); 392 spin_unlock(&fc->lock);
393 } 393 }
@@ -589,8 +589,8 @@ static void request_wait(struct fuse_conn *fc)
589 * Read a single request into the userspace filesystem's buffer. This 589 * Read a single request into the userspace filesystem's buffer. This
590 * function waits until a request is available, then removes it from 590 * function waits until a request is available, then removes it from
591 * the pending list and copies request data to userspace buffer. If 591 * the pending list and copies request data to userspace buffer. If
592 * no reply is needed (FORGET) or request has been interrupted or 592 * no reply is needed (FORGET) or request has been aborted or there
593 * there was an error during the copying then it's finished by calling 593 * was an error during the copying then it's finished by calling
594 * request_end(). Otherwise add it to the processing list, and set 594 * request_end(). Otherwise add it to the processing list, and set
595 * the 'sent' flag. 595 * the 'sent' flag.
596 */ 596 */
@@ -645,10 +645,10 @@ static ssize_t fuse_dev_readv(struct file *file, const struct iovec *iov,
645 fuse_copy_finish(&cs); 645 fuse_copy_finish(&cs);
646 spin_lock(&fc->lock); 646 spin_lock(&fc->lock);
647 req->locked = 0; 647 req->locked = 0;
648 if (!err && req->interrupted) 648 if (!err && req->aborted)
649 err = -ENOENT; 649 err = -ENOENT;
650 if (err) { 650 if (err) {
651 if (!req->interrupted) 651 if (!req->aborted)
652 req->out.h.error = -EIO; 652 req->out.h.error = -EIO;
653 request_end(fc, req); 653 request_end(fc, req);
654 return err; 654 return err;
@@ -754,7 +754,7 @@ static ssize_t fuse_dev_writev(struct file *file, const struct iovec *iov,
754 if (!req) 754 if (!req)
755 goto err_unlock; 755 goto err_unlock;
756 756
757 if (req->interrupted) { 757 if (req->aborted) {
758 spin_unlock(&fc->lock); 758 spin_unlock(&fc->lock);
759 fuse_copy_finish(&cs); 759 fuse_copy_finish(&cs);
760 spin_lock(&fc->lock); 760 spin_lock(&fc->lock);
@@ -773,9 +773,9 @@ static ssize_t fuse_dev_writev(struct file *file, const struct iovec *iov,
773 spin_lock(&fc->lock); 773 spin_lock(&fc->lock);
774 req->locked = 0; 774 req->locked = 0;
775 if (!err) { 775 if (!err) {
776 if (req->interrupted) 776 if (req->aborted)
777 err = -ENOENT; 777 err = -ENOENT;
778 } else if (!req->interrupted) 778 } else if (!req->aborted)
779 req->out.h.error = -EIO; 779 req->out.h.error = -EIO;
780 request_end(fc, req); 780 request_end(fc, req);
781 781
@@ -835,7 +835,7 @@ static void end_requests(struct fuse_conn *fc, struct list_head *head)
835/* 835/*
836 * Abort requests under I/O 836 * Abort requests under I/O
837 * 837 *
838 * The requests are set to interrupted and finished, and the request 838 * The requests are set to aborted and finished, and the request
839 * waiter is woken up. This will make request_wait_answer() wait 839 * waiter is woken up. This will make request_wait_answer() wait
840 * until the request is unlocked and then return. 840 * until the request is unlocked and then return.
841 * 841 *
@@ -850,7 +850,7 @@ static void end_io_requests(struct fuse_conn *fc)
850 list_entry(fc->io.next, struct fuse_req, list); 850 list_entry(fc->io.next, struct fuse_req, list);
851 void (*end) (struct fuse_conn *, struct fuse_req *) = req->end; 851 void (*end) (struct fuse_conn *, struct fuse_req *) = req->end;
852 852
853 req->interrupted = 1; 853 req->aborted = 1;
854 req->out.h.error = -ECONNABORTED; 854 req->out.h.error = -ECONNABORTED;
855 req->state = FUSE_REQ_FINISHED; 855 req->state = FUSE_REQ_FINISHED;
856 list_del_init(&req->list); 856 list_del_init(&req->list);
@@ -883,9 +883,8 @@ static void end_io_requests(struct fuse_conn *fc)
883 * onto the pending list is prevented by req->connected being false. 883 * onto the pending list is prevented by req->connected being false.
884 * 884 *
885 * Progression of requests under I/O to the processing list is 885 * Progression of requests under I/O to the processing list is
886 * prevented by the req->interrupted flag being true for these 886 * prevented by the req->aborted flag being true for these requests.
887 * requests. For this reason requests on the io list must be aborted 887 * For this reason requests on the io list must be aborted first.
888 * first.
889 */ 888 */
890void fuse_abort_conn(struct fuse_conn *fc) 889void fuse_abort_conn(struct fuse_conn *fc)
891{ 890{
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index f7c74516f3a6..fd65e75e1622 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -159,8 +159,8 @@ struct fuse_req {
159 /** Force sending of the request even if interrupted */ 159 /** Force sending of the request even if interrupted */
160 unsigned force:1; 160 unsigned force:1;
161 161
162 /** The request was interrupted */ 162 /** The request was aborted */
163 unsigned interrupted:1; 163 unsigned aborted:1;
164 164
165 /** Request is sent in the background */ 165 /** Request is sent in the background */
166 unsigned background:1; 166 unsigned background:1;