NFS: directory XXX contains a readdir loop seems to be triggered by well-behaving server

From Linux NFS

Jump to: navigation, search

Contents

About

  • Kernel version: 2.6.39
  • Bug 38572
  • Reported by: Petr Vandrovec (June 30, 2011)
  • Fixed by: Trond Myklebust (March 25, 2011)

Symptoms

  • Run this in one terminal:
for a in `seq 1 1000`; do mkdir $a; touch $a-test; done
for a in `seq 1 1000`; do rmdir $a; done
for a in `seq 1 1000`; do rm $a-test; done
  • Run this in another:
while true; do ls; done
  • Every now and then the kernel will print this message to dmesg:
NFS: directory A/B/C contains a readdir loop.  Please contact your server vendor.  Offending cookie: 41912
NFS: directory A/B/C contains a readdir loop.  Please contact your server vendor.  Offending cookie: 42904
  • Server did return same cookie twice, but only because the client issued the same readdir request twice
  • Directory is growing and shrinking while ls is running

Resolution

Resolution

commit 0c0308066ca53fdf1423895f3a42838b67b3a5a8
Author: Trond Myklebust <Trond.Myklebust@netapp.com>
Date:   Sat Jul 30 12:45:35 2011 -0400

    NFS: Fix spurious readdir cookie loop messages
    
    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>
    Cc: stable@kernel.org [2.6.39+]
    Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Personal tools