From: Vasily Averin <vvs@virtuozzo.com>
To: David Howells <dhowells@redhat.com>,
Marc Dionne <marc.dionne@auristor.com>
Cc: kernel@openvz.org, linux-afs@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] afs: handle async processing of F_SETLK with FL_SLEEP flag
Date: Thu, 23 Dec 2021 15:51:31 +0300 [thread overview]
Message-ID: <d4f73d2c-59e9-8497-dcd4-57abb6f2f089@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.
afs does not support it, does not check F_SETLK cmd and handles
FL_SLEEP flag like usual blocking lock request.
To work around the problem let's detect this situation and
drop FL_SLEEP flag before afs_do_setlk() execution.
Dropped flag should be restored back because some calling function
(nfsd4_lock) require it.
https://bugzilla.kernel.org/show_bug.cgi?id=215383
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
fs/afs/flock.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/fs/afs/flock.c b/fs/afs/flock.c
index c4210a3964d8..297c859d1f54 100644
--- a/fs/afs/flock.c
+++ b/fs/afs/flock.c
@@ -778,11 +778,19 @@ int afs_lock(struct file *file, int cmd, struct file_lock *fl)
fl->fl_u.afs.debug_id = atomic_inc_return(&afs_file_lock_debug_id);
trace_afs_flock_op(vnode, fl, afs_flock_op_lock);
- if (fl->fl_type == F_UNLCK)
+ if (fl->fl_type == F_UNLCK) {
ret = afs_do_unlk(file, fl);
- else
+ } else {
+ bool async = (fl->fl_flags & FL_SLEEP) && IS_SETLK(cmd);
+
+ if (async)
+ fl->fl_flags &= ~FL_SLEEP;
+
ret = afs_do_setlk(file, fl);
+ if (async)
+ fl->fl_flags |= FL_SLEEP;
+ }
switch (ret) {
case 0: op = afs_flock_op_return_ok; break;
case -EAGAIN: op = afs_flock_op_return_eagain; break;
--
2.25.1
reply other threads:[~2021-12-23 12:51 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=d4f73d2c-59e9-8497-dcd4-57abb6f2f089@virtuozzo.com \
--to=vvs@virtuozzo.com \
--cc=dhowells@redhat.com \
--cc=kernel@openvz.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.dionne@auristor.com \
/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®