Excerpted from 2.4 ChangeSet 1.122. From Trond: Make readdir xdr verify the reply packet.
nfs2xdr.c | 14 ++++++++------ nfs3xdr.c | 25 +++++++++++++++++-------- 2 files changed, 25 insertions(+), 14 deletions(-)
Excerpted from 2.4 ChangeSet 1.139. From Dave Miller: Fixes an off-by-one error when checksumming NFS read replies that are an odd number of bytes in length.
xprt.c | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-)
Excerpted from 2.4 ChangeSet 1.146. From Trond: Stricter verification of NFSv2 read replies.
nfs2xdr.c | 38 ++++++++++++++++++++------------------ 1 files changed, 20 insertions(+), 18 deletions(-)
This is 2.4 ChangeSet 1.383.13.53, backported to the RHAS 2.1 kernel. It is the same as patch 2690, but adjusted slightly to apply to e.25. Note that 2690 is not normally applied to the RHAS 2.1 kernel during a standard build because it breaks backward ABI compatibility. From Trond:
[PATCH] Do RPC over TCP reads in the bh fastpath...
sched.c:
- Remove references to rpciod_tcp_dispatcher.
xprt.c:
Speed up synchronous RPC over TCP calls by having the
replies delivered by the IPV4 "bottom half", instead of
switching to the rpciod process in order to call recvmsg().
- Remove sock_recvmsg() interface.
- Remove rpc_xprt_pending list and rpciod_tcp_dispatcher() interface.
- Use the new tcp_read_sock() interface to deliver data directly
from within tcp_data_ready().
xprt.h:
- New set of flags to reflect the TCP record read state.
include/linux/sunrpc/xprt.h | 32 +- include/net/tcp.h | 5 net/ipv4/tcp.c | 79 +++++++ net/netsyms.c | 1 net/sunrpc/sched.c | 5 net/sunrpc/xprt.c | 474 ++++++++++++++++---------------------------- 6 files changed, 278 insertions(+), 318 deletions(-)
This is 2.4 ChangeSet 1.555.44.101, backported to 2.4.9-e.25. From Trond:
[PATCH] Teach RPC client to send pages rather than iovecs. [1/3] Stop rpciod from deadlocking against itself in map_new_virtual() on HIGHMEM systems. RPC client currently has to keep all pages that are scheduled for transmission kmap()ed into an iovec for the entire duration of the call. We only actually need to kmap() pages while making the (non-blocking) call to sock_sendmsg(). NOTE: When transmitting several pages in one RPC call, sock_sendmsg() requires us to kmap() *all* those pages at the same time. Opens for deadlocks between rpciod and some other process that also kmaps more than 1 page at a time. For the TCP case we can solve later by converting to TCP_CORK+sendpage().
fs/nfs/nfs2xdr.c | 44 ++---------------- fs/nfs/nfs3proc.c | 9 +-- fs/nfs/nfs3xdr.c | 38 +--------------- fs/nfs/proc.c | 11 ++-- fs/nfs/write.c | 25 ++++------ include/linux/nfs_xdr.h | 8 +-- include/linux/sunrpc/xdr.h | 34 ++++++++++++++ include/linux/sunrpc/xprt.h | 8 +-- net/sunrpc/clnt.c | 10 ++-- net/sunrpc/sunrpc_syms.c | 1 net/sunrpc/xdr.c | 103 ++++++++++++++++++++++++++++++++++++++++++++ net/sunrpc/xprt.c | 23 +++++---- 12 files changed, 195 insertions(+), 119 deletions(-)
This is 2.4 ChangeSet 1.555.44.102, backported to 2.4.9-e.25. From Trond:
[PATCH] Teach RPC client to send pages rather than iovecs. [2/3]
Remove another class of rpciod deadlocks on HIGHMEM
systems. Kick habit of keeping pages kmap()ed for the entire
duration of NFS read/readdir/readlink operations.
Use struct page directly in RPC client data receive
buffer. TCP and UDP sk->data_ready() bottom-halves copy (and
checksum when needed) data into pages rather than
iovecs. atomic_kmap() of single pages is used for the copy.
fs/nfs/dir.c | 10 +- fs/nfs/nfs2xdr.c | 121 +++++++++++++------------------ fs/nfs/nfs3proc.c | 36 +++------ fs/nfs/nfs3xdr.c | 118 ++++++++++++------------------ fs/nfs/proc.c | 33 +++----- fs/nfs/read.c | 35 ++++----- fs/nfs/symlink.c | 5 - include/asm-i386/kmap_types.h | 2 include/asm-ppc/kmap_types.h | 2 include/asm-sparc/kmap_types.h | 2 include/linux/nfs_xdr.h | 46 +++-------- include/linux/sunrpc/xdr.h | 30 +++++++ include/linux/sunrpc/xprt.h | 12 --- net/sunrpc/clnt.c | 10 +- net/sunrpc/sunrpc_syms.c | 4 - net/sunrpc/xdr.c | 90 +++++++++++++++++++++++ net/sunrpc/xprt.c | 159 ++++++++++++++++++----------------------- 17 files changed, 368 insertions(+), 347 deletions(-)
This is 2.4 ChangeSet 1.555.44.103, backported to 2.4.9-e.25. From Trond:
[PATCH] Teach RPC client to send pages rather than iovecs. [3/3]
Clean out routines that were obsoleted by previous 2 patches.
Remove obsolete NFS and RPC routines.
Remove 'inline' attribute from xdr_decode_fattr().
fs/nfs/nfs2xdr.c | 13 +------------ fs/nfs/nfs3xdr.c | 13 +------------ include/linux/sunrpc/xprt.h | 9 --------- net/sunrpc/xdr.c | 18 ------------------ net/sunrpc/xprt.c | 31 ------------------------------- 5 files changed, 2 insertions(+), 82 deletions(-)
This is 2.4 ChangeSet 1.744. From Trond: Remove unbalanced kunmap() in NFS readdir code.
dir.c | 1 - 1 files changed, 1 deletion(-)
This is 2.4 ChangeSet 1.757.13.4. From Trond: Another kmap imbalance in 2.4.x/2.5.x RPC.
xdr.c | 5 +++++ 1 files changed, 5 insertions(+)
This is 2.4 ChangeSet 1.757.23.14, backported to 2.4.9-e.25. From Trond:
Problem is due to the change to using 'struct xdr_buf'. The macro req->rlen does not quite translate into the received buffer length, so the code that tests for whether or not we have a buffer overflow fails.
Note that this change requires 2.4 ChangeSet 1.555.44.106, and does not strictly address a kmap issue, so it is not included here.
nfs2xdr.c | 41 +++++++++++++++++++++++++++++++++-------- nfs3xdr.c | 35 ++++++++++++++++++++++++++--------- 2 files changed, 59 insertions(+), 17 deletions(-)
This is 2.4 ChangeSet 1.930.44.10. From Andrea Arcangeli:
btw, I finished today fixing a deadlock condition in the xdr layer triggered by nfs on highmem machines, here's the fix against 2.4.21pre4, please apply it now to pre4 or will have to live in my tree with the other hundred of patches like it happened to some of the patches we're discussing in this thread. Explanation is very simple: you _can't_ kmap two times in the context of a single task (especially if more than one task can run the same code at the same time). I don't yet have the confirmation that this fixes the deadlock though (it takes days to reproduce so it will take weeks to confirm), but I can't see anything else wrong at the moment, and this remains a genuine highmem deadlock that has to be fixed. The fix is optimal, no change unless you run out of kmaps and in turn you can deadlock, i.e. all the light workloads won't be affected at all.
include/asm-i386/highmem.h | 9 +++++--- include/linux/sunrpc/xdr.h | 2 - mm/highmem.c | 15 ++++++++++---- net/sunrpc/xdr.c | 48 +++++++++++++++++++++++++++++++++++---------- net/sunrpc/xprt.c | 35 +++++++++++++++++++++----------- 5 files changed, 79 insertions(+), 30 deletions(-)
This is 2.4 ChangeSet 1.930.70.34. From Trond: Fix unbalanced kunmap() in NFS symlink code.
symlink.c | 1 - 1 files changed, 1 deletion(-)
This is 2.4 ChangeSet 1.1003.9.13. From Trond:
Replace buggy version of xdr_shift_buf() with the version from 2.5.x. This has the added bonus that we also get rid of the need for doing kmap() of multiple pages at the same time.
xdr.c | 221 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 207 insertions(+), 14 deletions(-)
This is 2.4 ChangeSet 1.1019.7.3. From Trond:
If xdr_kmap() fails, we need to ensure that it unmaps all the pages, and returns 0. We don't want to be sending partial RPC requests to the server.
xdr.c | 14 +++++++++----- xprt.c | 4 ++++ 2 files changed, 13 insertions(+), 5 deletions(-)
This patch implements uncached I/O for RHAS 2.1 kernels. The I/O paths in this implementation are kmap-friendly. All previous patches on this page are required before applying this one.
fs/exec.c | 4 fs/nfs/Makefile | 2 fs/nfs/direct.c | 888 ++++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/file.c | 14 fs/nfs/inode.c | 59 ++- include/linux/nfs_fs.h | 6 include/linux/nfs_mount.h | 1 7 files changed, 966 insertions(+), 8 deletions(-)
Last modified: Wed Nov 5 13:47:07 EST 2003