From owner-freebsd-current Sat Nov 23 19:35: 8 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C5FCC37B40B for ; Sat, 23 Nov 2002 19:35:00 -0800 (PST) Received: from smtp01.iprimus.net.au (smtp01.iprimus.net.au [210.50.30.70]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0720A43EAA for ; Sat, 23 Nov 2002 19:34:58 -0800 (PST) (envelope-from tim@robbins.dropbear.id.au) Received: from dilbert.robbins.dropbear.id.au ([210.50.218.1]) by smtp01.iprimus.net.au with Microsoft SMTPSVC(5.0.2195.5600); Sun, 24 Nov 2002 14:34:51 +1100 Received: from dilbert.robbins.dropbear.id.au (4goqu4tzrbr2bdzs@localhost [127.0.0.1]) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6) with ESMTP id gAO3YfEi089293 for ; Sun, 24 Nov 2002 14:34:41 +1100 (EST) (envelope-from tim@dilbert.robbins.dropbear.id.au) Received: (from tim@localhost) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6/Submit) id gAO3Ye3R089292 for current@FreeBSD.ORG; Sun, 24 Nov 2002 14:34:40 +1100 (EST) (envelope-from tim) Date: Sun, 24 Nov 2002 14:34:40 +1100 From: Tim Robbins To: current@FreeBSD.ORG Subject: smbfs workaround Message-ID: <20021124143440.A88845@dilbert.robbins.dropbear.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i X-OriginalArrivalTime: 24 Nov 2002 03:34:52.0613 (UTC) FILETIME=[73115F50:01C2936A] Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I'd appreciate it if the people who were experiencing problems with smbfs could try this patch and let me know how it goes. The patch adds two sysctls, net.smb.readwritex and net.smb.reqdatasize. readwritex controls whether LARGE_READX and LARGE_WRITEX requests are used, and is off by default. reqdatasize controls the maximum number of bytes of data to request from the user with each read request, and it defaults to a fairly conservative value of 4096. Setting readwritex to 0 makes smbfs work when the server OS is Windows XP. Setting reqdatasize to 4096 makes it work when the server OS is FreeBSD 4.7-RELEASE-p2 w/ Samba 2.2.3a. This patch is just a temporary workaround, of course. I have not been able to track down the real problem. Tim Index: src/sys/netsmb/smb_smb.c =================================================================== RCS file: /x/freebsd/src/sys/netsmb/smb_smb.c,v retrieving revision 1.7 diff -u -r1.7 smb_smb.c --- src/sys/netsmb/smb_smb.c 16 Sep 2002 10:50:38 -0000 1.7 +++ src/sys/netsmb/smb_smb.c 24 Nov 2002 02:50:14 -0000 @@ -71,6 +71,22 @@ #define SMB_DIALECT_MAX (sizeof(smb_dialects) / sizeof(struct smb_dialect) - 2) +SYSCTL_DECL(_net_smb); + +/* + * XXX Something is causing requests for more than about 4 kbytes of data + * to fail. LARGE_READX and LARGE_WRITEX requests are disabled by default, + * and data is requested in 4 kbyte (or smaller) chunks. + */ + +static int smb_rwx = 0; +SYSCTL_INT(_net_smb, OID_AUTO, readwritex, CTLFLAG_RW, &smb_rwx, 0, + "Controls whether LARGE_READX and LARGE_WRITEX requests will be used"); + +static int smb_reqdatasize = 4096; +SYSCTL_INT(_net_smb, OID_AUTO, reqdatasize, CTLFLAG_RW, &smb_reqdatasize, 0, + "Maximum number of bytes of data to request at a time"); + static u_int32_t smb_vc_maxread(struct smb_vc *vcp) { @@ -78,7 +94,7 @@ * Specs say up to 64k data bytes, but Windows traffic * uses 60k... no doubt for some good reason. */ - if (vcp->vc_sopt.sv_caps & SMB_CAP_LARGE_READX) + if (smb_rwx && vcp->vc_sopt.sv_caps & SMB_CAP_LARGE_READX) return (60*1024); else return (vcp->vc_sopt.sv_maxtx); @@ -91,7 +107,7 @@ * Specs say up to 64k data bytes, but Windows traffic * uses 60k... probably for some good reason. */ - if (vcp->vc_sopt.sv_caps & SMB_CAP_LARGE_WRITEX) + if (smb_rwx && vcp->vc_sopt.sv_caps & SMB_CAP_LARGE_WRITEX) return (60*1024); else return (vcp->vc_sopt.sv_maxtx); @@ -239,7 +255,7 @@ sp->sv_maxtx = 1024; else sp->sv_maxtx = min(sp->sv_maxtx, - 63*1024 + SMB_HDRLEN + 16); + smb_reqdatasize + SMB_HDRLEN + 16); SMB_TRAN_GETPARAM(vcp, SMBTP_RCVSZ, &maxqsz); vcp->vc_rxmax = min(smb_vc_maxread(vcp), maxqsz - 1024); SMB_TRAN_GETPARAM(vcp, SMBTP_SNDSZ, &maxqsz); @@ -735,7 +751,7 @@ u_int8_t wc; int error, rlen, blksz; - if (SSTOVC(ssp)->vc_sopt.sv_caps & SMB_CAP_LARGE_READX) + if (smb_rwx && SSTOVC(ssp)->vc_sopt.sv_caps & SMB_CAP_LARGE_READX) return (smb_smb_readx(ssp, fid, len, rresid, uio, scred)); error = smb_rq_alloc(SSTOCP(ssp), SMB_COM_READ, scred, &rqp); @@ -813,7 +829,8 @@ u_int8_t wc; int error, blksz; - if (*len && SSTOVC(ssp)->vc_sopt.sv_caps & SMB_CAP_LARGE_WRITEX) + if (smb_rwx && *len && + SSTOVC(ssp)->vc_sopt.sv_caps & SMB_CAP_LARGE_WRITEX) return (smb_smb_writex(ssp, fid, len, rresid, uio, scred)); blksz = SSTOVC(ssp)->vc_txmax - SMB_HDRLEN - 16; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message