[OpenAFS-devel] patch to get file locking working on 64bit linux

Pavel Semerad semerad@ss1000.ms.mff.cuni.cz
Mon, 12 Mar 2001 15:16:30 +0100 (CET)


Hi, I have found problem with file locking and 64bit linux (tested on
ultrasparc). When issued fcntl(fd, f_SETLK, ..) with l_start = 0 and l_len
= 0, it sets l_len to LONG_MAX, so it is needed to test this value (I
leaved both 32 and 64bits values, because I don't know if there is some
possibility that some program issues 32bit value).
  Other 64bit systems (Solaris,IRIX) are OK.

Pavel Semerad



--- src/afs/VNOPS/afs_vnop_flock.c 09:50:36     1.1.1.2
+++ src/afs/VNOPS/afs_vnop_flock.c 11:32:50     1.5@@ -536,6 +541,10 @@
struct AFS_UCRED *acred; {
           this way at least, they can get work done */
        if (af->l_len == 0x7fffffff)
            af->l_len = 0;      /* since some systems indicate it as EOF */
+#ifdef AFS_LINUX_64BIT_KERNEL
+       if (af->l_len == LONG_MAX)
+           af->l_len = 0;      /* since some systems indicate it as EOF */
+#endif
        /* next line makes byte range locks always succeed,
           even when they should block */
        if (af->l_whence != 0 || af->l_start != 0 || af->l_len != 0) {