[Devel] [PATCH vz7 30/46] fuse: move list_del_init() from request_end() into callers

Maxim Patlasov mpatlasov at virtuozzo.com
Fri Mar 24 19:24:27 PDT 2017


Backport from ml:

commit f377cb799e4f667d743886ee025f9987cbb6cd12
Author: Miklos Szeredi <mszeredi at suse.cz>
Date:   Wed Jul 1 16:26:04 2015 +0200

    fuse: move list_del_init() from request_end() into callers

    Signed-off-by: Miklos Szeredi <mszeredi at suse.cz>

Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
 fs/fuse/dev.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 545cd68..9e14b0c 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -368,7 +368,6 @@ __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);
@@ -537,6 +536,7 @@ void fuse_request_send_background(struct fuse_conn *fc, struct fuse_req *req)
 		BUG_ON(req->in.h.opcode != FUSE_READ);
 		req->out.h.error = -EIO;
 		__clear_bit(FR_BACKGROUND, &req->flags);
+		list_del_init(&req->list);
 		request_end(fc, req);
 	} else if (fc->connected) {
 		fuse_request_send_background_locked(fc, req);
@@ -1255,6 +1255,7 @@ static ssize_t fuse_dev_do_read(struct fuse_conn *fc, struct file *file,
 		/* SETXATTR is special, since it may contain too large data */
 		if (in->h.opcode == FUSE_SETXATTR)
 			req->out.h.error = -E2BIG;
+		list_del_init(&req->list);
 		request_end(fc, req);
 		goto restart;
 	}
@@ -1268,15 +1269,18 @@ static ssize_t fuse_dev_do_read(struct fuse_conn *fc, struct file *file,
 	spin_lock(&fc->lock);
 	clear_bit(FR_LOCKED, &req->flags);
 	if (!fpq->connected) {
+		list_del_init(&req->list);
 		request_end(fc, req);
 		return -ENODEV;
 	}
 	if (err) {
 		req->out.h.error = -EIO;
+		list_del_init(&req->list);
 		request_end(fc, req);
 		return err;
 	}
 	if (!test_bit(FR_ISREPLY, &req->flags)) {
+		list_del_init(&req->list);
 		request_end(fc, req);
 	} else {
 		list_move_tail(&req->list, &fpq->processing);
@@ -1928,6 +1932,7 @@ static ssize_t fuse_dev_do_write(struct fuse_conn *fc,
 		err = -ENOENT;
 	else if (err)
 		req->out.h.error = -EIO;
+	list_del_init(&req->list);
 	request_end(fc, req);
 
 	return err ? err : nbytes;
@@ -2066,6 +2071,7 @@ __acquires(fc->lock)
 		req->out.h.error = -ECONNABORTED;
 		clear_bit(FR_PENDING, &req->flags);
 		clear_bit(FR_SENT, &req->flags);
+		list_del_init(&req->list);
 		request_end(fc, req);
 		spin_lock(&fc->lock);
 	}
@@ -2143,6 +2149,7 @@ void fuse_abort_conn(struct fuse_conn *fc)
 		while (!list_empty(&to_end1)) {
 			req = list_first_entry(&to_end1, struct fuse_req, list);
 			__fuse_get_request(req);
+			list_del_init(&req->list);
 			request_end(fc, req);
 			spin_lock(&fc->lock);
 		}



More information about the Devel mailing list