2003-03-22 16:38:41

by Zwane Mwaikambo

[permalink] [raw]
Subject: RPCSVC_MAXPAGES doesn't account for overhead(?) pages

I got this BUG with a 32k PAGE_SIZE, it looks like we unconditionally
allocate 2 extra pages on top of requested size so we wouldn't be able to
service a maximum payload from nfsd.

Is there a more suitable/elegant fix?

------------[ cut here ]------------
kernel BUG at net/sunrpc/svc.c:121!
invalid operand: 0000
CPU: 0
EIP: 0060:[<c03e6baf>] Not tainted
EFLAGS: 00010202
EIP is at svc_init_buffer+0x2f/0x80
eax: 00000002 ebx: 00000004 ecx: 000000d0 edx: 000001e0
esi: 00000000 edi: cba45948 ebp: fffffff4 esp: c9b99f28
ds: 007b es: 007b ss: 0068
Process rpc.nfsd (pid: 762, threadinfo=c9b98000 task=cace0700)
Stack: cba45948 c98bad44 00008400 c03e6d73 cba45948 00008400 c05a2f10 00000007
00000000 00000801 c01e31b1 c01e3330 c98bad44 c7c38004 00000008 00000002
cb4f7690 c01e3a5c 00000801 00000008 00000008 caf385d4 c7c38000 00000000
Call Trace:
[<c03e6d73>] svc_create_thread+0xa3/0xe0
[<c01e31b1>] nfsd_svc+0xb1/0x230
[<c01e3330>] nfsd+0x0/0x480
[<c01e3a5c>] TA_write+0x10c/0x160
[<c018597a>] sys_nfsservctl+0xba/0x100
[<c0109477>] syscall_call+0x7/0xb

Code: 0f 0b 79 00 5d 05 48 c0 85 db 74 25 90 8d 74 26 00 31 d2 b9


--
function.linuxpower.ca


2003-03-22 16:45:17

by Zwane Mwaikambo

[permalink] [raw]
Subject: Re: RPCSVC_MAXPAGES doesn't account for overhead(?) pages

On Sat, 22 Mar 2003, Zwane Mwaikambo wrote:

> I got this BUG with a 32k PAGE_SIZE, it looks like we unconditionally
> allocate 2 extra pages on top of requested size so we wouldn't be able to
> service a maximum payload from nfsd.
>
> Is there a more suitable/elegant fix?

I forgot the patch...

Index: linux-2.5.65-pgcl/include/linux/sunrpc/svc.h
===================================================================
RCS file: /build/cvsroot/linux-2.5.65/include/linux/sunrpc/svc.h,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 svc.h
--- linux-2.5.65-pgcl/include/linux/sunrpc/svc.h 17 Mar 2003 23:08:31 -0000 1.1.1.1
+++ linux-2.5.65-pgcl/include/linux/sunrpc/svc.h 22 Mar 2003 16:22:22 -0000
@@ -73,7 +73,8 @@ struct svc_serv {
* This assumes that the non-page part of an rpc reply will fit
* in a page - NFSd ensures this. lockd also has no trouble.
*/
-#define RPCSVC_MAXPAGES ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE + 1)
+
+#define RPCSVC_MAXPAGES (2+((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE+1))

static inline u32 svc_getu32(struct iovec *iov)
{

--
function.linuxpower.ca

2003-03-22 17:00:42

by William Lee Irwin III

[permalink] [raw]
Subject: Re: RPCSVC_MAXPAGES doesn't account for overhead(?) pages

On Sat, Mar 22, 2003 at 11:52:44AM -0500, Zwane Mwaikambo wrote:
> I forgot the patch...
> -#define RPCSVC_MAXPAGES ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE + 1)
> +#define RPCSVC_MAXPAGES (2+((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE+1))


This looks fine to me. Applied, thanks.


-- wli

2003-03-23 11:08:00

by Trond Myklebust

[permalink] [raw]
Subject: Re: RPCSVC_MAXPAGES doesn't account for overhead(?) pages

>>>>> " " == Zwane Mwaikambo <[email protected]> writes:


> -#define RPCSVC_MAXPAGES
> ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE + 1) + +#define
> RPCSVC_MAXPAGES
> (2+((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE+1))

Huh? RPCSVC_MAXPAYLOAD is set at 64k. Should be quite ample for a 32k
read or write.

Cheers,
Trond

2003-03-23 11:31:58

by William Lee Irwin III

[permalink] [raw]
Subject: Re: RPCSVC_MAXPAGES doesn't account for overhead(?) pages

" " == Zwane Mwaikambo <[email protected]> writes:
>> -#define RPCSVC_MAXPAGES
>> ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE + 1) + +#define
>> RPCSVC_MAXPAGES
>> (2+((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE+1))

On Sun, Mar 23, 2003 at 12:18:57PM +0100, Trond Myklebust wrote:
> Huh? RPCSVC_MAXPAYLOAD is set at 64k. Should be quite ample for a 32k
> read or write.

Sure, there's just a dependency on PAGE_SIZE we're trying to get sorted
out here. If PAGE_SIZE is 64KB (e.g. IA64, pgcl) then this trips a BUG().


-- wli