32 bit getdents(2) calls fail

Solution Verified - Updated -

Issue

Our storage admins are reporting that the getdents(2) call returns incorrect data in 32-bit mode, and actually throws an error when called against a large Isilon NFS filesystem.

The following shows 32b getdents throwing an error on a large Isilon filesystem, and strace showing the 32b getdent returning incorrect numbers of entities in almost all situations. Note the 'd_reclen==0' assertion.

# g++ -m64  -Wall dirs.C -o dir64
# g++ -m32 -Wall dirs.C -o dir32
# for i in . /logs/  /auto/sadmin /auto/linuxadm   /auto/bld /auto/rtt; do echo  "(`ls -a $i | wc -l` entries)" ; df -PhT $i; echo 32 $i ;  strace -e trace=getdents ./dir32 $i; echo 64 $i ;strace -e trace=getdents ./dir64 $i; echo ; done
(145 entries)
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/mapper/vg0-root ext3  9.7G  5.9G  3.4G  64% /
32 .
[ Process PID=32376 runs in 32 bit mode. ]
getdents(3, /* d_reclen == 0, problem here *//* 1 entries */, 32000) = 3432
getdent is successful
64 .
getdents(3, /* 145 entries */, 32000)   = 4864
getdent is successful

(29 entries)
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/mapper/vg0-logs ext3  102G   47G   50G  49% /logs
32 /logs/
[ Process PID=32384 runs in 32 bit mode. ]
getdents(3, /* 2 entries */, 32000)     = 668
getdent is successful
64 /logs/
getdents(3, /* 29 entries */, 32000)    = 936
getdent is successful

(13 entries)
Filesystem    Type    Size  Used Avail Use% Mounted on
server:/lx7_sadmin nfs   40G   21G   20G  52% /auto/sadmin
32 /auto/sadmin
[ Process PID=32394 runs in 32 bit mode. ]
getdents(3, /* d_reclen == 0, problem here *//* 1 entries */, 32000) = 244
getdent is successful
64 /auto/sadmin
getdents(3, /* 13 entries */, 32000)    = 376
getdent is successful

(17 entries)
Filesystem    Type    Size  Used Avail Use% Mounted on
server:/linuxadm nfs   64G   60G  4.0G  94% /auto/linuxadm
32 /auto/linuxadm
[ Process PID=32402 runs in 32 bit mode. ]
getdents(3, /* d_reclen == 0, problem here *//* 1 entries */, 32000) = 332
getdent is successful
64 /auto/linuxadm
getdents(3, /* 17 entries */, 32000)    = 504
getdent is successful

(45 entries)
Filesystem    Type    Size  Used Avail Use% Mounted on
server:/bld nfs  1.7T  1.6T  144G  92% /auto/bld
32 /auto/bld
[ Process PID=32410 runs in 32 bit mode. ]
getdents(3, /* d_reclen == 0, problem here *//* 1 entries */, 32000) = 1040
getdent is successful
64 /auto/bld
getdents(3, /* 45 entries */, 32000)    = 1480
getdent is successful

(6 entries)
Filesystem    Type    Size  Used Avail Use% Mounted on
server:/ifs/rtt nfs   13T  7.9T  5.2T  61% /auto/rtt
32 /auto/rtt
[ Process PID=32418 runs in 32 bit mode. ]
getdents(3, 0xff693554, 32000)          = -1 EINVAL (Invalid argument)
getdent call failed: Invalid argument
64 /auto/rtt
getdents(3, /* 6 entries */, 32000)     = 168
getdent is successful

Environment

  • Red Hat Enterprise Linux 5.7

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.