[Devel] [PATCH 9/8] fuse:Backport of ms locking patches part 2 - fixup
Kirill Tkhai
ktkhai at virtuozzo.com
Tue Apr 23 14:37:26 MSK 2019
fuse: do not take fc->lock in fuse_request_send_background() - fixup
This goes on top of the series and fixes up immediate logic for [3/8].
It goes separate to simplify [3/8] review and for easier rebase in future
(I hope).
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
fs/fuse/dev.c | 23 +++++------------------
fs/fuse/file.c | 3 ---
2 files changed, 5 insertions(+), 21 deletions(-)
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index d10e7edd8711..1958c6e33d79 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -612,7 +612,9 @@ bool fuse_request_queue_background(struct fuse_conn *fc, struct fuse_req *req)
}
__set_bit(FR_ISREPLY, &req->flags);
spin_lock(&fc->bg_lock);
- if (likely(fc->connected)) {
+ if (unlikely(test_bit(FUSE_S_FAIL_IMMEDIATELY, &req->ff->ff_state)))
+ req->out.h.error = -EIO;
+ else if (likely(fc->connected)) {
fc->num_background++;
if (fc->num_background == fc->max_background)
fc->blocked = 1;
@@ -642,29 +644,14 @@ bool fuse_request_queue_background(struct fuse_conn *fc, struct fuse_req *req)
void fuse_request_send_background(struct fuse_conn *fc, struct fuse_req *req)
{
- bool fail;
WARN_ON(!req->end);
if (fc->kio.op && !fc->kio.op->req_send(fc, req, true, false))
return;
- spin_lock(&fc->lock);
- fail = (req->page_cache && req->ff &&
- test_bit(FUSE_S_FAIL_IMMEDIATELY, &req->ff->ff_state));
- spin_unlock(&fc->lock);
-
- if (fail) {
- /* FIXME */
- BUG_ON(req->in.h.opcode != FUSE_READ);
- req->out.h.error = -EIO;
- __clear_bit(FR_BACKGROUND, &req->flags);
- __clear_bit(FR_PENDING, &req->flags);
- request_end(fc, req);
- return;
- }
-
if (!fuse_request_queue_background(fc, req)) {
- req->out.h.error = -ENOTCONN;
+ if (!req->out.h.error)
+ req->out.h.error = -ENOTCONN;
req->end(fc, req);
fuse_put_request(fc, req);
}
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 7929f4b6b346..0222854340df 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1949,9 +1949,6 @@ __acquires(fi->lock)
__u64 data_size = req->num_pages * PAGE_CACHE_SIZE;
bool queued;
- if (test_bit(FUSE_S_FAIL_IMMEDIATELY, &req->ff->ff_state))
- goto out_free;
-
if (inarg->offset + data_size <= size) {
inarg->size = data_size;
} else if (inarg->offset < size) {
More information about the Devel
mailing list