Bug 23342 - nfsd debug messages print incorrect offsets
Summary: nfsd debug messages print incorrect offsets
Status: RESOLVED CODE_FIX
Alias: None
Product: File System
Classification: Unclassified
Component: NFS (show other bugs)
Hardware: All Linux
: P1 low
Assignee: bfields
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-20 02:02 UTC by dysbr01
Modified: 2010-11-29 20:35 UTC (History)
0 users

See Also:
Kernel Version:
Subsystem:
Regression: No
Bisected commit-id:


Attachments
nfsd: fix offset printk's if nfsd3 read/write (1.23 KB, patch)
2010-11-29 20:34 UTC, bfields
Details | Diff

Description dysbr01 2010-11-20 02:02:40 UTC
After enabling debug printing of nfsd service, the message prints negative values for offsets.

1) Enable nfsd debug messages:

echo 16 > /proc/sys/sunrpc/nfsd_debug

2) Write to a file larger than 2GB over NFS at an offset greater than 2GB.

nfsd: WRITE(3)    28: 02000001 0000fd00 19150001 19150004 eb8fc414 19150002 8192 bytes at -1122402816 stable

The value -1122402816 is 0xBD197E00 and should print as 3172564480.

Problem is in fs/nfsd/nfs3proc.c in nfsd3_proc_write(). The dprintk() call uses %ld to print ((nfs3d_writeargs*)argp)->offset which is declared in fs/nfsd/xdr3.h as __u64. So, it's printed as a signed value.

BTW: In fs/nfsd/nfs3proc.c, printing of the __u64 offset value in the read, write, and commit structs is *ALL* performed differently! ;-}

The nfsd3_proc_commit() function prints using %Lu, casting argp->offset to (unsigned long long) and looks like the most correct way to print the offset.

Recommendation: Modify the dprintk() calls in nfsd3_proc_write() and nfsd3_proc_read() to print the argp->offset value using %Lu, casted to (unsigned long long).

Found this while doing some NFS troubleshooting. Not a major bug at all but seems easy to fix.

Cheers!
Comment 1 dysbr01 2010-11-20 02:04:24 UTC
Should have mentioned that the "nfsd: WRITE(3)" above is from the output of `dmesg`, in case it's not clear.
Comment 2 Trond Myklebust 2010-11-20 02:16:09 UTC
Not a client bug. Reassigning to Bruce.
Comment 3 bfields 2010-11-29 20:34:49 UTC
Created attachment 38562 [details]
nfsd: fix offset printk's if nfsd3 read/write

Thanks, the suggested fix sounds right; applying for 2.6.38.

Note You need to log in before you can comment on or make changes to this bug.