[Devel] [PATCH RHEL9 COMMIT] ms/fuse: drop obsoleted and incorrect restriction in fuse_setlk

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jan 12 18:36:41 MSK 2022


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-4.vz9.10.38
------>
commit bf6d514060f2834b0d21ca04e84ceeb4b6df6842
Author: Vasily Averin <vvs at virtuozzo.com>
Date:   Wed Jan 12 18:36:41 2022 +0300

    ms/fuse: drop obsoleted and incorrect restriction in fuse_setlk
    
    kernel export threads like nfsd, lockd and ksmbd can deadlock if
    exported file system does not support asynchronous processing of
    blocking locks.
    
    Some time ago this problem was work arounded in fuse by commit
    48e90761b570 ("fuse: lockd support"), however it was not fully
    correct because of all locking requests was disables including
    non-blocking (i.e. w/o FL_SLEEP in fl_flags) locks.
    
    Now this check is incomplete: nfs v4 does not use lockd and handles
    locking request via nfsd directly, recently added ksmbd uses
    vfs_lock_file() too. However both these servers does not have
    fl->fl_lmops->lm_grant defined.
    
    Original problem was noticed again, and now it will be fixed on the
    server side: all affected kernel threads will not use FL_SLEEP if
    exported file system does not support asynchronous processing of
    blocking locks.
    
    (patch was submitted upstream but was not merged yet)
    https://jira.sw.ru/browse/PSBM-136851
    
    Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
    
    Feature: fix ms/fuse
---
 fs/fuse/file.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 97f860cfc195..2cefa342b2b8 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2479,11 +2479,6 @@ static int fuse_setlk(struct file *file, struct file_lock *fl, int flock)
 	pid_t pid_nr = pid_nr_ns(pid, fm->fc->pid_ns);
 	int err;
 
-	if (fl->fl_lmops && fl->fl_lmops->lm_grant) {
-		/* NLM needs asynchronous locks, which we don't support yet */
-		return -ENOLCK;
-	}
-
 	/* Unlock on close is handled by the flush method */
 	if ((fl->fl_flags & FL_CLOSE_POSIX) == FL_CLOSE_POSIX)
 		return 0;


More information about the Devel mailing list