Jeremy Allison
1999-Jul-06 21:13 UTC
VERY SERIOUS smbclient problems w/samba 2.0.* (PR#18263)
jimd@gie.com wrote:>> Overview: > Pulling files from an NT 4.0 machine to a RedHat 5.0 linux box using > 2.0.3 or 2.0.4b smbclient *consistently* results in randomly corrupt > files, with no error message to indicate internal file corruption. We > are able to recreate this problem on all manners of servers and > workstations running NT 4.0, and all manner of linux boxen running > kernels 2.2.4 & 2.2.9. Although this subset of servers/clients is far > from global, we feel that the nature of the error is such that it > demonstrates a serious problem with smbclient in these versions. We're > also able to show that smbclient 1.9.18p10 does not demonstrate this > flaw. > > Conclusion: > If you use smbclient or smbtar, test your setup using the method > outlined below. If you can demonstrate the same problem, use the > smbclient 1.9.18p10 binary until a fix is found -- do not trust any > backups of files made using smbclient/smbtar versions 2.0.* > > Testing methodology: > A 240 MB directory consisting of 459 files and 51 sub directories, > located on an NT server (nts001) was chosen for the test. This > directory contains static, archived, reference files. This directory > was given it's own share (smbtest). Two directories on the linux server > are created (/var/smbtest1, and /var/smbtest2). The following set of > commands is executed: > > cd /var/smbtest1 > smbclient \\\\nts001\\smbtest <password> -U administrator -W NT_NET > smb: \> recurse > smb: \> prompt > smb: \> mget * > smb: \> exit > > cd /var/smbtest2 > smbclient \\\\nts001\\smbtest <password> -U administrator -W NT_NET > smb: \> recurse > smb: \> prompt > smb: \> mget * > smb: \> exit > > diff -r /var/smbtest1 /var/smbtest2 > > In every case, using 2.0.3 and 2.0.4b, several (20 to 50) files are > found to be different. The procedure would indicate that all files > should be identical. Although no errors appear during the transfer > process, and file sizes are identical, contents of affected files are > radically different. We've been able to demonstrate this happening on > directories containing as few as 23 files, 20 MB. > > Tests using smbclient binary from samba 1.9.18p10 indicate that the > 1.9.18p10 version of smbclient does not demonstrate this flaw. > > Our Setups: > Dual PII-450 \ Linux kernel 2.2.9, gcc 2.7.2.3, Intel NIC > Dual PII-233 \ Linux kernel 2.2.9, gcc 2.7.2.3, Intel NIC > Dual P-133 \ Linux kernel 2.0.36, gcc 2.7.2.3, Intel NIC > P-233 \ Linux kernel 2.0.36, gcc 2.7.2.3, 3Com NIC > Dual PII-233, NT 4.0 Server, SP3, Intel NIC > K6-2 300, NT 4.0 Workstation, SP4, 3Com NIC > Dual PPro-180, NT 4.0 Server, SP3, Intel NIC > > TO WHOEVER MAINTAINS SMBCLIENT: > I can send anything you'd like to see, with regards to log files, etc. > Contact me if you need more information -- I'm glad to help in any way > that I can.Jim, I've tracked this down to what looks like a problem with the multiple read outstanding code added to speed client reads in the 2.x code. Can you try this patch to see if it fixes the problem (it does here). Regards, Jeremy Allison, Samba Team. Index: libsmb/clientgen.c ==================================================================RCS file: /data/cvs/samba/source/libsmb/clientgen.c,v retrieving revision 1.88.2.18 diff -u -r1.88.2.18 clientgen.c --- clientgen.c 1999/06/13 04:43:16 1.88.2.18 +++ clientgen.c 1999/07/06 21:12:27 @@ -1399,7 +1399,17 @@ int total = -1; int issued=0; int received=0; - int mpx = MAX(cli->max_mux-1, 1); +/* + * There is a problem in this code when mpx is more than one. + * for some reason files can get corrupted when being read. + * Until we understand this fully I am serializing reads (one + * read/one reply) for now. JRA. + */ +#if 0 + int mpx = MAX(cli->max_mux-1, 1); +#else + int mpx = 1; +#endif int block = (cli->max_xmit - (smb_size+32)) & ~1023; int mid; int blocks = (size + (block-1)) / block; -- -------------------------------------------------------- Buying an operating system without source is like buying a self-assembly Space Shuttle with no instructions. --------------------------------------------------------