NFSD panics on RHEL 5.8

If you as unlucky as I am and your RHEL 5.8 server has just spat the same call trace as you see on the picture I attached, then I’m here to make your problem less painful. If you have RHN account you could find a thorough explanation and the root case here and here

If you don’t have any than you would find the answer below:

Root Cause

The rq_pages array has 1MB/PAGE_SIZE+2 elements. The loop in svc_recv attempts to allocate sv_bufsz/PAGE_SIZE+2 pages. But the NFS server is setting sv_bufsiz to over a megabyte, with the result that svc_recv may attempt to allocate sv_bufsz/PAGE_SIZE+3 pages and run past the end of the array, overwriting rq_respages.

Resolution

echo 524288 >/proc/fs/nfsd/max_block_size

Note this has to be done after mounting /proc/fs/nfsd, but before starting nfsd. It is recommended this change be made via modprobe.conf.dist as follows:

# grep max_block_size /etc/modprobe.d/modprobe.conf.dist
install nfsd /sbin/modprobe --first-time --ignore-install nfsd && { /bin/mount -t nfsd nfsd /proc/fs/nfsd > /dev/null 2>&1 || :; echo 524288 > /proc/fs/nfsd/max_block_size; }