[Devel] [PATCH vz7 34/46] fuse: add req flag for private list
Maxim Patlasov
mpatlasov at virtuozzo.com
Fri Mar 24 19:25:54 PDT 2017
Backport from ml:
commit 77cd9d488b32d19be852ad4d310ef13701557d61
Author: Miklos Szeredi <mszeredi at suse.cz>
Date: Wed Jul 1 16:26:06 2015 +0200
fuse: add req flag for private list
When an unlocked request is aborted, it is moved from fpq->io to a private
list. Then, after unlocking fpq->lock, the private list is processed and
the requests are finished off.
To protect the private list, we need to mark the request with a flag, so if
in the meantime the request is unlocked the list is not corrupted.
Signed-off-by: Miklos Szeredi <mszeredi at suse.cz>
Reviewed-by: Ashish Samant <ashish.samant at oracle.com>
Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
fs/fuse/dev.c | 10 +++++++---
fs/fuse/fuse_i.h | 2 ++
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 4b69221..50812a0 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1293,7 +1293,8 @@ static ssize_t fuse_dev_do_read(struct fuse_conn *fc, struct file *file,
return reqsize;
out_end:
- list_del_init(&req->list);
+ if (!test_bit(FR_PRIVATE, &req->flags))
+ list_del_init(&req->list);
spin_unlock(&fpq->lock);
request_end(fc, req);
return err;
@@ -1942,7 +1943,8 @@ 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);
+ if (!test_bit(FR_PRIVATE, &req->flags))
+ list_del_init(&req->list);
spin_unlock(&fpq->lock);
request_end(fc, req);
@@ -2143,8 +2145,10 @@ void fuse_abort_conn(struct fuse_conn *fc)
req->out.h.error = -ECONNABORTED;
spin_lock(&req->waitq.lock);
set_bit(FR_ABORTED, &req->flags);
- if (!test_bit(FR_LOCKED, &req->flags))
+ if (!test_bit(FR_LOCKED, &req->flags)) {
+ set_bit(FR_PRIVATE, &req->flags);
list_move(&req->list, &to_end1);
+ }
spin_unlock(&req->waitq.lock);
}
list_splice_init(&fpq->processing, &to_end2);
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 98bdb56..ab3c1d3 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -286,6 +286,7 @@ struct fuse_io_priv {
* FR_PENDING: request is not yet in userspace
* FR_SENT: request is in userspace, waiting for an answer
* FR_FINISHED: request is finished
+ * FR_PRIVATE: request is on private list
*/
enum fuse_req_flag {
FR_ISREPLY,
@@ -298,6 +299,7 @@ enum fuse_req_flag {
FR_PENDING,
FR_SENT,
FR_FINISHED,
+ FR_PRIVATE,
};
/**
More information about the Devel
mailing list