[Devel] [PATCH RHEL7 COMMIT] fs/fuse kio: missed clean di->size.op in failed shrink request

Konstantin Khorenko khorenko at virtuozzo.com
Mon Dec 17 11:59:55 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.20.2.vz7.73.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.20.2.vz7.73.22
------>
commit be9ecb5ba7af0a3fc006733754f7436738f95b24
Author: Pavel Butsykin <pbutsykin at virtuozzo.com>
Date:   Mon Dec 17 11:59:53 2018 +0300

    fs/fuse kio: missed clean di->size.op in failed shrink request
    
    The state di->size.op is set to PCS_SIZE_SHRINK in order to postpone all read
    requests during shrink request execution. But, if the shrink request fails in
    __fuse_request_send(), then di->size.op is never cleaned up and it remains
    PCS_SIZE_SHRINK forever, and pending read requests can remain hanging
    indefinitely.
    
    To fix this we can reuse req->end that actually _pcs_shrink_end() which already
    has everything we need to cleanup shrink request.
    
    There is no need to make a similar fix for ms since req->end callback is no
    where used for sync(no background) requests except kio.
    
    https://pmc.acronis.com/browse/VSTOR-18947
    
    Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
    Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 fs/fuse/dev.c                      | 4 ++++
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 5 +++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index ce75d218025b..6fcbb117aa9c 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -543,9 +543,13 @@ static void __fuse_request_send(struct fuse_conn *fc, struct fuse_req *req,
 	if (!fiq->connected) {
 		spin_unlock(&fiq->waitq.lock);
 		req->out.h.error = -ENOTCONN;
+		if (req->end)
+			req->end(fc, req);
 	} else if (ff && test_bit(FUSE_S_FAIL_IMMEDIATELY, &ff->ff_state)) {
 		spin_unlock(&fiq->waitq.lock);
 		req->out.h.error = -EIO;
+		if (req->end)
+			req->end(fc, req);
 	} else {
 		req->in.h.unique = fuse_get_unique(fiq);
 		queue_request(fiq, req);
diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index 3b1d819792b2..de54fedeb5e4 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -992,8 +992,9 @@ static void kpcs_setattr_end(struct fuse_conn *fc, struct fuse_req *req)
 	u64 old_size;
 
 	BUG_ON(req->in.h.opcode != FUSE_SETATTR);
-	TRACE("update size: ino:%lu old_sz:%lld new:%lld\n",
-	      req->io_inode->i_ino, di->fileinfo.attr.size, outarg->attr.size);
+	TRACE("update size: ino:%lu old_sz:%lld new:%lld, error: %d\n",
+	      req->io_inode->i_ino, di->fileinfo.attr.size, outarg->attr.size,
+	      req->out.h.error);
 
 	if (req->out.h.error)
 		goto fail;



More information about the Devel mailing list