lkml.org 
[lkml]   [2003]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[BUG 2.5.57] NFSv2 READDIR broken
Hi,

if mounting a Linux partition with NFSv2, READDIR fills in the last cookie
byte-swapped. The following READDIR will fail, so the NFS client sees a
truncated directory:

Frame 43 (1074 bytes on wire, 1074 bytes captured)
Ethernet II, Src: 00:00:e8:d4:01:61, Dst: 00:60:b3:1f:52:7c
Internet Protocol, Src Addr: 192.168.94.2 (192.168.94.2), Dst Addr: 192.168.95.4 (192.168.95.4)
User Datagram Protocol, Src Port: 2049 (2049), Dst Port: 800 (800)
Remote Procedure Call
Network File System
Program Version: 2
V2 Procedure: READDIR (16)
Status: OK (0)
Value Follows: Yes
Entry: file ID 1274231, name .
File ID: 1274231
Name: .
length: 1
contents: .
fill bytes: opaque data
Cookie: 12
Value Follows: Yes
[...]
Entry: file ID 1274709, name LICENSE.SRC
File ID: 1274709
Name: LICENSE.SRC
length: 11
contents: LICENSE.SRC
fill bytes: opaque data
Cookie: 644
Value Follows: Yes
Entry: file ID 1275342, name Makefile
File ID: 1275342
Name: Makefile
length: 8
contents: Makefile
Cookie: 2483159040 <<<<<<<<<<< should be 678
Value Follows: No
EOF: 0

This patch corrects the problem:

===== nfsproc.c 1.23 vs edited =====
--- 1.23/fs/nfsd/nfsproc.c Sat Jan 11 02:00:12 2003
+++ edited/nfsproc.c Mon Jan 13 21:03:28 2003
@@ -482,7 +482,7 @@

resp->count = resp->buffer - argp->buffer;
if (resp->offset)
- *resp->offset = (u32)offset;
+ *resp->offset = htonl(offset);

fh_put(&argp->fh);
return nfserr;
--jochen


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:32    [W:0.040 / U:2.992 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site