alistair23-linux/include
Fabio Olive Leite c7e1596111 Re: [NFS] [PATCH] Attribute timeout handling and wrapping u32 jiffies
I would like to discuss the idea that the current checks for attribute
timeout using time_after are inadequate for 32bit architectures, since
time_after works correctly only when the two timestamps being compared
are within 2^31 jiffies of each other. The signed overflow caused by
comparing values more than 2^31 jiffies apart will flip the result,
causing incorrect assumptions of validity.

2^31 jiffies is a fairly large period of time (~25 days) when compared
to the lifetime of most kernel data structures, but for long lived NFS
mounts that can sit idle for months (think that for some reason autofs
cannot be used), it is easy to compare inode attribute timestamps with
very disparate or even bogus values (as in when jiffies have wrapped
many times, where the comparison doesn't even make sense).

Currently the code tests for attribute timeout by simply adding the
desired amount of jiffies to the stored timestamp and comparing that
with the current timestamp of obtained attribute data with time_after.
This is incorrect, as it returns true for the desired timeout period
and another full 2^31 range of jiffies.

In testing with artificial jumps (several small jumps, not one big
crank) of the jiffies I was able to reproduce a problem found in a
server with very long lived NFS mounts, where attributes would not be
refreshed even after touching files and directories in the server:

Initial uptime:
03:42:01 up 6 min, 0 users, load average: 0.01, 0.12, 0.07

NFS volume is mounted and time is advanced:
03:38:09 up 25 days, 2 min, 0 users, load average: 1.22, 1.05, 1.08

# ls -l /local/A/foo/bar /nfs/A/foo/bar
-rw-r--r--  1 root root 0 Dec 17 03:38 /local/A/foo/bar
-rw-r--r--  1 root root 0 Nov 22 00:36 /nfs/A/foo/bar

# touch /local/A/foo/bar

# ls -l /local/A/foo/bar /nfs/A/foo/bar
-rw-r--r--  1 root root 0 Dec 17 03:47 /local/A/foo/bar
-rw-r--r--  1 root root 0 Nov 22 00:36 /nfs/A/foo/bar

We can see the local mtime is updated, but the NFS mount still shows
the old value. The patch below makes it work:

Initial setup...
07:11:02 up 25 days, 1 min,  0 users,  load average: 0.15, 0.03, 0.04

# ls -l /local/A/foo/bar /nfs/A/foo/bar
-rw-r--r--  1 root root 0 Jan 11 07:11 /local/A/foo/bar
-rw-r--r--  1 root root 0 Jan 11 07:11 /nfs/A/foo/bar

# touch /local/A/foo/bar

# ls -l /local/A/foo/bar /nfs/A/foo/bar
-rw-r--r--  1 root root 0 Jan 11 07:14 /local/A/foo/bar
-rw-r--r--  1 root root 0 Jan 11 07:14 /nfs/A/foo/bar

Signed-off-by: Fabio Olive Leite <fleite@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2007-10-09 17:15:33 -04:00
..
acpi ACPI: CONFIG_ACPI_SLEEP=n power off regression in 2.6.23-rc8 (NOT in rc7) 2007-09-25 17:58:52 -04:00
asm-alpha Fix Alpha O_CLOEXEC definition 2007-08-09 08:39:22 -07:00
asm-arm Merge branch 'omap-fixes' of master.kernel.org:/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6 2007-08-25 12:38:47 +01:00
asm-avr32 [AVR32] Define mmiowb() 2007-08-15 16:36:56 +02:00
asm-blackfin Blackfin arch: fix PORT_J BUG for BF537/6 EMAC driver reported by Kalle Pokki <kalle.pokki@iki.fi> 2007-10-04 00:36:18 +08:00
asm-cris remove unused TIF_NOTIFY_RESUME flag 2007-07-31 15:39:38 -07:00
asm-frv FRV: connect up fallocate 2007-08-11 15:47:40 -07:00
asm-generic Define termios_1 functions for powerpc, s390, avr32 and frv 2007-09-12 09:08:05 -07:00
asm-h8300 Binfmt_flat: Add minimum support for the Blackfin relocations 2007-10-03 23:41:43 +08:00
asm-i386 i386: remove bogus comment about memory barrier 2007-09-29 09:13:59 -07:00
asm-ia64 [IA64] Cleanup HPSIM code (was: Re: Enable early console for Ski simulator) 2007-09-01 02:52:25 -07:00
asm-m32r Binfmt_flat: Add minimum support for the Blackfin relocations 2007-10-03 23:41:43 +08:00
asm-m68k m68k(nommu): add missing syscalls 2007-09-11 17:21:20 -07:00
asm-m68knommu Binfmt_flat: Add minimum support for the Blackfin relocations 2007-10-03 23:41:43 +08:00
asm-mips [MIPS] Terminally fix local_{dec,sub}_if_positive 2007-10-03 14:30:52 +01:00
asm-parisc [PARISC] Add dummy isa_(bus|virt)_to_(virt|bus) inlines 2007-08-27 00:29:22 -04:00
asm-powerpc [POWERPC] Fix timekeeping on PowerPC 601 2007-09-19 15:26:34 +10:00
asm-ppc [WATCHDOG] mv64x60_wdt: Add arch/powerpc platform support 2007-07-24 21:16:02 +00:00
asm-s390 [S390] Change atomic_read/set to inline functions with barrier semantics. 2007-08-22 13:51:49 +02:00
asm-sh Binfmt_flat: Add minimum support for the Blackfin relocations 2007-10-03 23:41:43 +08:00
asm-sh64 sh64: Add missing dma_sync_single_for_*(). 2007-08-10 02:47:31 +09:00
asm-sparc [SPARC32]: Make flush_tlb_kernel_range() an inline function. 2007-08-26 18:49:12 -07:00
asm-sparc64 [SPARC64]: Fix lockdep, particularly on SMP. 2007-09-16 11:51:15 -07:00
asm-um UML: Fix ELF_CORE_COPY_REGS build botch 2007-09-10 18:58:05 -07:00
asm-v850 Binfmt_flat: Add minimum support for the Blackfin relocations 2007-10-03 23:41:43 +08:00
asm-x86_64 Remove unnecessary cast in prefetch() 2007-10-05 08:04:35 -07:00
asm-xtensa [patch 1/2] Xtensa: enable arbitary tty speed setting ioctls 2007-08-27 13:54:25 -07:00
crypto
keys
linux Re: [NFS] [PATCH] Attribute timeout handling and wrapping u32 jiffies 2007-10-09 17:15:33 -04:00
math-emu Fix <math-emu/soft-fp.h> tpyo 2007-08-18 17:15:17 -07:00
media V4L/DVB (6220a): fix build error for et61x251 driver 2007-09-14 13:39:12 -03:00
mtd UBI: kill homegrown endian macros 2007-07-18 16:53:49 +03:00
net [ROSE]: Fix rose.ko oops on unload 2007-10-07 23:44:17 -07:00
pcmcia PCMCIA-NETDEV : add new ID of lan&modem multifunction card 2007-07-08 22:16:39 -04:00
rdma IB: Move the macro IB_UMEM_MAX_PAGE_CHUNK() to umem.c 2007-08-03 10:45:18 -07:00
rxrpc
scsi [SCSI] libiscsi: sync up iscsi and scsi eh's access to the connection 2007-08-15 13:09:21 -05:00
sound [ALSA] version 1.0.14 2007-07-20 11:13:35 +02:00
video remove tx3912fb 2007-07-31 15:39:41 -07:00
xen xen: xen/page.h compile fix 2007-07-26 11:35:16 -07:00
Kbuild