From owner-svn-src-all@FreeBSD.ORG Wed Oct 27 13:10:08 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 797EC106564A; Wed, 27 Oct 2010 13:10:08 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 673AB8FC08; Wed, 27 Oct 2010 13:10:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9RDA8Ic007032; Wed, 27 Oct 2010 13:10:08 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9RDA8PH007028; Wed, 27 Oct 2010 13:10:08 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201010271310.o9RDA8PH007028@svn.freebsd.org> From: Rick Macklem Date: Wed, 27 Oct 2010 13:10:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214415 - stable/8/sys/rpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 13:10:08 -0000 Author: rmacklem Date: Wed Oct 27 13:10:08 2010 New Revision: 214415 URL: http://svn.freebsd.org/changeset/base/214415 Log: MFC: r213756 Fix the krpc so that it can handle NFSv3,UDP mounts with a read/write data size greater than 8192. Since soreserve(so, 256*1024, 256*1024) would always fail for the default value of sb_max, modify clnt_dg.c so that it uses the calculated values and checks for an error return from soreserve(). Also, add a check for error return from soreserve() to clnt_vc.c and change __rpc_get_t_size() to use sb_max_adj instead of the bogus maxsize == 256*1024. Modified: stable/8/sys/rpc/clnt_dg.c stable/8/sys/rpc/clnt_vc.c stable/8/sys/rpc/rpc_generic.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/rpc/clnt_dg.c ============================================================================== --- stable/8/sys/rpc/clnt_dg.c Wed Oct 27 12:51:36 2010 (r214414) +++ stable/8/sys/rpc/clnt_dg.c Wed Oct 27 13:10:08 2010 (r214415) @@ -193,6 +193,7 @@ clnt_dg_create( struct rpc_msg call_msg; struct __rpc_sockinfo si; XDR xdrs; + int error; if (svcaddr == NULL) { rpc_createerr.cf_stat = RPC_UNKNOWNADDR; @@ -267,7 +268,12 @@ clnt_dg_create( */ cu->cu_closeit = FALSE; cu->cu_socket = so; - soreserve(so, 256*1024, 256*1024); + error = soreserve(so, (u_long)sendsz, (u_long)recvsz); + if (error != 0) { + rpc_createerr.cf_stat = RPC_FAILED; + rpc_createerr.cf_error.re_errno = error; + goto err2; + } sb = &so->so_rcv; SOCKBUF_LOCK(&so->so_rcv); Modified: stable/8/sys/rpc/clnt_vc.c ============================================================================== --- stable/8/sys/rpc/clnt_vc.c Wed Oct 27 12:51:36 2010 (r214414) +++ stable/8/sys/rpc/clnt_vc.c Wed Oct 27 13:10:08 2010 (r214415) @@ -288,13 +288,19 @@ clnt_vc_create( * Create a client handle which uses xdrrec for serialization * and authnone for authentication. */ + sendsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)sendsz); + recvsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsz); + error = soreserve(ct->ct_socket, sendsz, recvsz); + if (error != 0) { + if (ct->ct_closeit) { + soclose(ct->ct_socket); + } + goto err; + } cl->cl_refs = 1; cl->cl_ops = &clnt_vc_ops; cl->cl_private = ct; cl->cl_auth = authnone_create(); - sendsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)sendsz); - recvsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsz); - soreserve(ct->ct_socket, sendsz, recvsz); SOCKBUF_LOCK(&ct->ct_socket->so_rcv); soupcall_set(ct->ct_socket, SO_RCV, clnt_vc_soupcall, ct); Modified: stable/8/sys/rpc/rpc_generic.c ============================================================================== --- stable/8/sys/rpc/rpc_generic.c Wed Oct 27 12:51:36 2010 (r214414) +++ stable/8/sys/rpc/rpc_generic.c Wed Oct 27 13:10:08 2010 (r214415) @@ -63,6 +63,8 @@ __FBSDID("$FreeBSD$"); #include +extern u_long sb_max_adj; /* not defined in socketvar.h */ + #if __FreeBSD_version < 700000 #define strrchr rindex #endif @@ -113,9 +115,8 @@ u_int /*ARGSUSED*/ __rpc_get_t_size(int af, int proto, int size) { - int maxsize, defsize; + int defsize; - maxsize = 256 * 1024; /* XXX */ switch (proto) { case IPPROTO_TCP: defsize = 64 * 1024; /* XXX */ @@ -131,7 +132,7 @@ __rpc_get_t_size(int af, int proto, int return defsize; /* Check whether the value is within the upper max limit */ - return (size > maxsize ? (u_int)maxsize : (u_int)size); + return (size > sb_max_adj ? (u_int)sb_max_adj : (u_int)size); } /*