Date: Fri, 29 Aug 2014 15:04:22 +0200 From: Ivan Voras <ivoras@freebsd.org> To: freebsd-fs@freebsd.org Subject: lockf(1) and NFS Message-ID: <ltptp4$aaq$1@ger.gmane.org>
index | next in thread | raw e-mail
[-- Attachment #1 --]
Hi,
I had some fun troubleshooting NFS locking and among other things, found
that lockf(1) doesn't really work on NFSv4 mounts. Googling around (so
correct me if I'm wrong), it looks like this is because NFS quietly
translates the old-style locks into POSIX range locks, and those cannot
be acquired exclusively if the file is opened read-only.
I've tested the following patch and it works.
Any objections to committing it?
--- a/lockf.c Fri Aug 29 14:58:10 2014 +0200
+++ b/lockf.c Fri Aug 29 14:59:12 2014 +0200
@@ -169,7 +169,7 @@
{
int fd;
- if ((fd = open(name, flags|O_RDONLY|O_EXLOCK|flags, 0666)) == -1) {
+ if ((fd = open(name, flags|O_RDWR|O_EXLOCK|flags, 0666)) == -1) {
if (errno == EAGAIN || errno == EINTR)
return (-1);
err(EX_CANTCREAT, "cannot open %s", name);
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iKYEARECAGYFAlQAemRfFIAAAAAALgAoaXNzdWVyLWZwckBub3RhdGlvbnMub3Bl
bnBncC5maWZ0aGhvcnNlbWFuLm5ldDYxNDE4MkQ3ODMwNDAwMDJFRUIzNDhFNUZE
MDhENTA2M0RGRjFEMkMACgkQ/QjVBj3/HSwlVgCeOAIZdpnVbarFltjwPm9SPeH7
VakAnAmzt1PF8iLCMfoTRgoOx9OVzn3V
=Ii34
-----END PGP SIGNATURE-----
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ltptp4$aaq$1>
