Date: Thu, 24 Aug 2023 18:52:12 -0700 From: Rick Macklem <rick.macklem@gmail.com> To: J David <j.david.lists@gmail.com> Cc: FreeBSD FS <freebsd-fs@freebsd.org> Subject: Re: NFS client hang on 13.2-RELEASE-p2 on file locking / wrong interface selected Message-ID: <CAM5tNy6ZLgyBwvjWGRGByTMLkso4jQ-VXVLyJ1sri15FmXC%2BcQ@mail.gmail.com> In-Reply-To: <CABXB=RRgyDzZDKPgxL6fwJCbrnyK-JR%2B1nAS3nYpW95_RN6g=A@mail.gmail.com> References: <CABXB=RTGZ-4MDB7MBoDMzGU6K3xnVU8e7gxkzpGkA2sQ-Sw0Xw@mail.gmail.com> <CAM5tNy5o44W7qc=DuX75y9C7SME8nfmWJ1DxThHmLTV-FENP4Q@mail.gmail.com> <CABXB=RRgyDzZDKPgxL6fwJCbrnyK-JR%2B1nAS3nYpW95_RN6g=A@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Aug 24, 2023 at 10:25=E2=80=AFAM J David <j.david.lists@gmail.com> = wrote: > > On Thu, Aug 24, 2023 at 10:02=E2=80=AFAM Rick Macklem <rick.macklem@gmail= .com> wrote: > > Otherwise consider switching the mounts to NFSv4.1/4.2. > > Unfortunately, NFSv4 is worse. > > Under NFSv4.2, attempts to lock files that previously did not exist on > NFS servers work, but any attempt to lock an existing file, regardless > of permissions, inexplicably fails with "Permission denied." > > E.g.: > > $ lockf -k x sleep 3 && echo OK > OK > $ lockf -k x sleep 3 && echo OK > lockf: cannot open x: Permission denied Here's a snippet from "man lockf" -w Causes lockd to open file for writing rather than reading. This is necessary on filesystems (including NFSv4) where a file which has been opened read-only cannot be exclusively locked. I am pretty sure this is in 13.2, although I do not remember when it was added to "lockf". rick > $ rm x > $ lockf -k x sleep 3 && echo OK > OK > $ ktrace lockf -k x sleep 3 && echo OK > lockf: cannot open x: Permission denied > $ echo "what" >x > $ cat x > what > > From ktrace: > > 98614 lockf CALL > openat(AT_FDCWD,0x295c0979e8f1,0x224<O_RDONLY|O_NONBLOCK|O_EXLOCK|O_CREAT= >,0666<S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH>) > 98614 lockf NAMI "x" > 98614 lockf RET openat -1 errno 13 Permission denied > > Thanks!
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAM5tNy6ZLgyBwvjWGRGByTMLkso4jQ-VXVLyJ1sri15FmXC%2BcQ>