NFS: Fix spurious readdir cookie loop messages
commitc14acb19a4b1482b6dd6e9d0874b2c8e32d6599d
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Sat, 30 Jul 2011 16:45:35 +0000 (30 12:45 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 5 Aug 2011 04:58:40 +0000 (4 21:58 -0700)
tree09449801fb0b88b73bdbb83876f251a65a2120ac
parent1fcb9d4b03b6ad6f4de417bbbe21d82123290114
NFS: Fix spurious readdir cookie loop messages

commit 0c0308066ca53fdf1423895f3a42838b67b3a5a8 upstream.

If the directory contents change, then we have to accept that the
file->f_pos value may shrink if we do a 'search-by-cookie'. In that
case, we should turn off the loop detection and let the NFS client
try to recover.

The patch also fixes a second loop detection bug by ensuring
that after turning on the ctx->duped flag, we read at least one new
cookie into ctx->dir_cookie before attempting to match with
ctx->dup_cookie.

Reported-by: Petr Vandrovec <petr@vandrovec.name>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/nfs/dir.c
include/linux/nfs_fs.h