[Devel] [PATCH RHEL8 COMMIT] fuse: resend interrupted release

Konstantin Khorenko khorenko at virtuozzo.com
Fri Apr 23 11:54:53 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.19
------>
commit eff36fcb347eeb30d16f996f0acc7bad888145d2
Author: Maxim Patlasov <mpatlasov at virtuozzo.com>
Date:   Fri Apr 23 11:54:52 2021 +0300

    fuse: resend interrupted release
    
    If a client gets fatal signal while explicitly waiting for ACK from fused
    (request_wait_answer()), kernel fuse discards the request like this:
    
    >               /* Request is not yet in userspace, bail out */
    >               if (req->state == FUSE_REQ_PENDING) {
    >                       list_del(&req->list);
    >                       __fuse_put_request(req);
    >                       req->out.h.error = -EINTR;
    >                       return;
    >               }
    
    This is nice for requests directly initiated by client, but not for RELEASE
    requests: we have to avoid discarding RELEASE requests because otherwise
    fused won't know when the file is "closed" by client (last fput called).
    
    The problem didn't exist before close_wait feature because then fuse_file_put
    sent RELEASE asynchronously. Hence no request_wait_answer() involved.
    
    The patch solves the problem by resending interrupted RELEASE asynchronously.
    This is OK because if the client is killed, he/she doesn't care about
    sync/async close(2) behavior.
    
    https://jira.sw.ru/browse/PSBM-45428
    
    Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
    
    +++
    fs/fuse: re-init req->list for interrupted release
    
    This is fix-up for commit c726a5807e00309b2fb386be0030fe154f332829.
    
    If we want to reuse request, we need to reinitialize it. For reserved request
    this is usually done by calling put_reserved_req(). This patch adds re-init of
    req->list before re-sending interrupted release.
    
    https://pmc.acronis.com/browse/VSTOR-11275
    
    mFixes: c726a5807e00 ("fuse: resend interrupted release")
    Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
    
    Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 fs/fuse/file.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 03499bb3ab5e..452ad4dabf51 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -134,10 +134,12 @@ static void fuse_file_put(struct fuse_file *ff, bool sync, bool isdir)
 			/* Do nothing when client does not implement 'open' */
 			fuse_release_end(ff->fc, args, 0);
 		} else if (sync) {
-			fuse_simple_request(ff->fc, args);
+			if (fuse_simple_request(ff->fc, args) == -EINTR)
+				goto async_fallback;
 			fuse_file_list_del(ff);
 			fuse_release_end(ff->fc, args, 0);
 		} else {
+async_fallback:
 			fuse_file_list_del(ff);
 			args->end = fuse_release_end;
 			if (fuse_simple_background(ff->fc, args,


More information about the Devel mailing list