RHEL 6 NFS client prints "NFS:directory XXXXX contains a readdir loop." due to NFS client issuing the same readdir request twice on a directory whose contents is changing
Environment
- Red Hat Enterprise Linux 6 (NFS client)
- kernel prior to kernel-2.6.32-220.17.1.el6
- kernel prior to kernel-2.6.32-279.el6
Issue
-
Listing files in a large directory on an NFS mount sometimes produces
ELOOP(errno 40) errors instdoutor the kernel log (dmesg) when there are no circular loops present. -
Dovecot generates following messages in /var/log/maillog
Jan 18 13:32:04 host dovecot: imap-login: Login: user=<staff3>, method=PLAIN, rip=1.1.1.1, lip=1.1.1.2, mpid=12283
Jan 18 13:32:22 host dovecot: imap(staff3): Disconnected: Logged out bytes=717/4619
Jan 18 13:32:27 host dovecot: imap-login: Login: user=<testc3>, method=PLAIN, rip=1.1.1.1, lip=1.1.1.2, mpid=12292, TLS
Jan 18 13:32:30 host dovecot: imap(testc3): Error: readdir(/export/mail/testc3/Maildir/new) failed: Too many levels of symbolic links
- And following errors are printed in /var/log/messages
Jan 18 13:32:29 host kernel: NFS: directory Maildir/new contains a readdir loop. Please contact your server vendor. Offending cookie: 69645
Jan 18 13:32:30 host kernel: NFS: directory Maildir/new contains a readdir loop. Please contact your server vendor. Offending cookie: 69645
Resolution
- Update the kernel on the NFS client to at least one of the below errata kernels.
Red Hat Enterprise Linux 6
- FIxed in RHEL6.3 Errata: RHSA-2012-0862 (kernel-2.6.32-279.el6)
- Originally tracked in RHEL 6.3 This content is not included.Bug 770250 - readdir64_r calls fail with ELOOP
Red Hat Enterprise Linux 6.2 (EUS)
-
Fixed in RHEL6.2.z Errata: RHSA-2012:0571 (kernel-2.6.32-220.17.1.el6)
- Originally tracked in RHEL 6.2 This content is not included.Bug 811135 - readdir64_r calls fail with ELOOP [rhel-6.2.z]
-
NOTE: The same "readdir loop" error message may appear due to an NFS server bug. For more information, please see https://access.redhat.com/solutions/227983
Root Cause
On NFS, when repeatedly reading a directory, content of which kept changing, the client issued the same readdir request twice. Consequently, the following warning messages were returned to the dmesg output:
NFS: directory A/B/C contains a readdir loop.
This update fixes the bug by turning off the loop detection and letting the NFS client try to recover in the described scenario and the messages are no longer returned.
Diagnostic Steps
- Errors messages similar to the following may be found in the system log:
Dec 23 10:44:54 myhostname kernel: NFS: directory 51809410.2_imap/mail contains a readdir loop. Please contact your server vendor. Offending cookie: 4110
Dec 23 10:44:54 myhostname quotad[2161]: {140608674498304} readdir64_r failed: 40=Too many levels of symbolic links
- Error messages similar to the following may be found in standard output:
OSError: [Errno 40] Too many levels of symbolic links
Where errno 40 resolves to ELOOP in errno.h for the OS.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.