Date: Tue, 26 Nov 2024 11:08:47 +0100 From: Peter Blok <pblok@bsd4all.org> To: freebsd-hackers@freebsd.org Subject: flock on directory Message-ID: <F6940FC9-3B3E-40D0-8280-D341FAE41DF0@bsd4all.org>
next in thread | raw e-mail | index | archive | help
Hi, I=E2=80=99m trying to run diskless. Both server and client are recent = 14-stable. When running diskless NFSv3 locking doesn=E2=80=99t work, = although everything is setup correctly. ( Will investigate later ). If I = mount with nolockd everything looks ok - no messages. I fixed NFSv4 as a client and it works, but atrun complains about not = being able to flock with LOCK_EX /var/at/jobs, returning EINVAL = According to the manpage this is correct, because the object is not a = file. if ((spool =3D opendir(".")) =3D=3D NULL) perr("cannot read %s", ATJOB_DIR); =20 if (flock(dirfd(spool), LOCK_EX) =3D=3D -1) perr("cannot lock %s", ATJOB_DIR); On a zfs or ufs directory the flock works without returning EINVAL, = which is not in line with the manpage. What would be the approriate thing to change? Should NFS also allow a = flock on a directory, or should we always return EINVAL on any directory = on any file-system? The latter would probably cause some churn Peter
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F6940FC9-3B3E-40D0-8280-D341FAE41DF0>