From: Kenneth Johansson <ken@kenjo.org>
To: linux-nfs@vger.kernel.org
Subject: F_SETLK blocks on nfsv4
Date: Sun, 29 Jul 2018 12:48:55 +0200 [thread overview]
Message-ID: <df5a7061-cc69-f90a-2d24-292e52d1f198@kenjo.org> (raw)
I was trying to change over to using nfsv4 from nfsv3 and hit a problem
with VLC. after some strace digging I came up with a test program that
has the same effect and works on nfs3 but hangs on nfsv4.
Even more interesting when run on a nfsv4 mounted home directory it is
no longer possible to open new connections in google-chrome so the error
is visible not only for the test program but probably all program that
does locking after this program is started on the same mount. or
something I have not investigated what really happens.
anyway the program is below and it hangs on last the line "ret =
"fcntl(fd, F_SETLK, &fl);" if run on a nfsv4 mount.
server; debain 9.5 with kernel version 4.9 or 4.17.0-0.bpo.1-amd64.
client: ubuntu 18.04. kernel 4.18.0-041800rc6-generic
--------------
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/file.h>
#include <string.h>
char *lfile="lock";
int main(int argc, char *argv[])
{
int fd;
int ret;
struct flock fl;
fd = openat(AT_FDCWD, lfile, O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC,
0600);
if (fd <0) {perror("");exit(1);}
ret = fcntl(fd, F_SETFD, FD_CLOEXEC);
if (ret <0) {perror("");exit(1);}
ret = flock(fd, LOCK_EX|LOCK_NB);
if (ret <0) {perror("");exit(1);}
memset(&fl,0,sizeof(fl));
fl.l_type = F_WRLCK;
fl.l_whence=SEEK_SET;
ret = fcntl(fd, F_SETLK, &fl);
if (ret <0) {perror("");exit(1);}
printf("done\n");
}
next reply other threads:[~2018-07-29 12:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-29 10:48 Kenneth Johansson [this message]
2018-07-29 12:21 ` F_SETLK blocks on nfsv4 Jeff Layton
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=df5a7061-cc69-f90a-2d24-292e52d1f198@kenjo.org \
--to=ken@kenjo.org \
--cc=linux-nfs@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).