In nfs_dir_read() count used before and after limiting?

Peter Dufault dufault at
Sat Sep 13 13:32:53 UTC 2014

On Sep 11, 2014, at 10:03 , Sebastian Huber <sebastian.huber at> wrote:

>> In nfs_dir_read() I see:
>>     /* align + round down the buffer */
>>     count &= ~ (DIRENT_HEADER_SIZE - 1);
>>     di->len = count;
>> Then later:
>>     if (count > NFS_MAXDATA)
>>         count = NFS_MAXDATA;
>>     di->readdirargs.count = count;
>> Can someone who understands this comment on it?
> Sorry, Peter.  I don't have time to look at this at the moment.  The NFS code 
> is hard to understand.  Since it works for me I have no urgent need to spend 
> time on this.

Can you answer one question?  If nfsStBlksize is set to zero so that this:

    /* Set to "preferred size" of this NFS client implementation */
    buf->st_blksize = nfsStBlksize ? nfsStBlksize : fa->blocksize;

returns 4096, then is it a bug if transfers larger than 4K are attempted?

Limiting all transfers to values other than the default 8K can end up with memory corruption.  512B works, 1K works, 2K and 4K corrupt things.  The changes are minor (attached).

If it's a bug for transfers to be larger than 4K when fa->blocksize=4K I can look at that, that's easy to trap when it happens.

Peter Dufault
HD Associates, Inc.      Software and System Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nfs.c.diffs
Type: application/octet-stream
Size: 2328 bytes
Desc: not available
URL: <>
-------------- next part --------------

More information about the devel mailing list