From: Vasily Averin <vvs@virtuozzo.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: kernel@openvz.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] fuse: async processing of F_SETLK with FL_SLEEP flag
Date: Thu, 23 Dec 2021 14:31:51 +0300 [thread overview]
Message-ID: <f0b7b363-2820-d184-52ea-c67bb3e4054d@virtuozzo.com> (raw)
kernel export thread (nfsd/lockd/ksmbd) use F_SETLK cmd with set FL_SLEEP
flag to request asynchronous processing of blocking locks.
Fuse does not support async processing and should drop FL_SLEEP flag
to avoid execution of blocking FUSE_SETLKW request.
Dropped FL_SLEEP flag should be restored back, because it can be used
in caller, at least in nfsd4_lock() does it actually.
https://bugzilla.kernel.org/show_bug.cgi?id=215383
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
fs/fuse/file.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 06e0d7fa86f3..54a9a5d660a6 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2540,8 +2540,17 @@ static int fuse_file_lock(struct file *file, int cmd, struct file_lock *fl)
} else {
if (fc->no_lock)
err = posix_lock_file(file, fl, NULL);
- else
+ else {
+ bool async = (fl->fl_flags & FL_SLEEP) && IS_SETLK(cmd);
+
+ if (async)
+ fl->fl_flags &= ~FL_SLEEP;
+
err = fuse_setlk(file, fl, 0);
+
+ if (async)
+ fl->fl_flags |= FL_SLEEP;
+ }
}
return err;
}
--
2.25.1
reply other threads:[~2021-12-23 11:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f0b7b363-2820-d184-52ea-c67bb3e4054d@virtuozzo.com \
--to=vvs@virtuozzo.com \
--cc=kernel@openvz.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®