From 146c31a9e8c246d6e22b41de546e4f102d23ab37 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sun, 31 Jan 2010 14:08:56 -0800 Subject: [PATCH] kernel - NFS - Document an issue with nfs_realign() * Document the fact that nfs_realign() must use blocking mbuf allocations or risk locking up TCP NFS mount connections due to TCP NFS mounts not retrying RPCs unless the link itself is lost. --- sys/vfs/nfs/nfs_socket.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/sys/vfs/nfs/nfs_socket.c b/sys/vfs/nfs/nfs_socket.c index 294f627419..23e0d01c70 100644 --- a/sys/vfs/nfs/nfs_socket.c +++ b/sys/vfs/nfs/nfs_socket.c @@ -2153,19 +2153,25 @@ nfs_rcvunlock(struct nfsmount *nmp) } /* - * nfs_realign: + * nfs_realign: * - * Check for badly aligned mbuf data and realign by copying the unaligned - * portion of the data into a new mbuf chain and freeing the portions - * of the old chain that were replaced. + * Check for badly aligned mbuf data and realign by copying the unaligned + * portion of the data into a new mbuf chain and freeing the portions + * of the old chain that were replaced. * - * We cannot simply realign the data within the existing mbuf chain - * because the underlying buffers may contain other rpc commands and - * we cannot afford to overwrite them. + * We cannot simply realign the data within the existing mbuf chain + * because the underlying buffers may contain other rpc commands and + * we cannot afford to overwrite them. * - * We would prefer to avoid this situation entirely. The situation does - * not occur with NFS/UDP and is supposed to only occassionally occur - * with TCP. Use vfs.nfs.realign_count and realign_test to check this. + * We would prefer to avoid this situation entirely. The situation does + * not occur with NFS/UDP and is supposed to only occassionally occur + * with TCP. Use vfs.nfs.realign_count and realign_test to check this. + * + * NOTE! MB_DONTWAIT cannot be used here. The mbufs must be acquired + * because the rpc request OR reply cannot be thrown away. TCP NFS + * mounts do not retry their RPCs unless the TCP connection itself + * is dropped so throwing away a RPC will basically cause the NFS + * operation to lockup indefinitely. */ static void nfs_realign(struct mbuf **pm, int hsiz) -- 2.11.4.GIT