From owner-freebsd-fs Fri Oct 27 16:57:34 2000 Delivered-To: freebsd-fs@freebsd.org Received: from smtp03.primenet.com (smtp03.primenet.com [206.165.6.133]) by hub.freebsd.org (Postfix) with ESMTP id 77F3B37B479; Fri, 27 Oct 2000 16:57:29 -0700 (PDT) Received: (from daemon@localhost) by smtp03.primenet.com (8.9.3/8.9.3) id QAA07200; Fri, 27 Oct 2000 16:55:41 -0700 (MST) Received: from usr01.primenet.com(206.165.6.201) via SMTP by smtp03.primenet.com, id smtpdAAA2CayNl; Fri Oct 27 16:53:22 2000 Received: (from tlambert@localhost) by usr01.primenet.com (8.8.5/8.8.5) id QAA02252; Fri, 27 Oct 2000 16:55:01 -0700 (MST) From: Terry Lambert Message-Id: <200010272355.QAA02252@usr01.primenet.com> Subject: Re: smbfs-1.3.0 released To: cdillon@wolves.k12.mo.us (Chris Dillon) Date: Fri, 27 Oct 2000 23:55:01 +0000 (GMT) Cc: malachai@iname.com (Shawn Halpenny), bp@butya.kz (Boris Popov), freebsd-hackers@FreeBSD.ORG, freebsd-fs@FreeBSD.ORG In-Reply-To: from "Chris Dillon" at Oct 27, 2000 12:01:48 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > Oh yeah, I've noticed one more thing. When you're at the root of a > mount, you can cd into a directory using any case, but if you get the > case wrong, you don't get a listing. Here's an example: [ ... ] > So... the case-insensitivity only happens at the root of the mount. > Should it happen everywhere? It'd be nice if it did. :-) Ha! The full path is sent over the wire. The attempt to be "case sensitive on storage, case insensitive on lookup" is inhernetly flawed. The way this works on OSs which support it is that the globbing occurs in the kernel. This lets the case folding occur before the data is returned. The difference is that if you are iterating and comparing in user space, you will get a failure, but if you are doing an explicit VOP_LOOKUP in kernel space, the case folding will work. The problem is that you don't really get a directory handle object, like you get an inode in NFS, since in a DOS FS, and thus in the wire externalization of a DOS FS, which is what SMB gives you, the directory entry itself _is_ the inode, not a pointer to an independent object which dereferences to the inode. I suspect that this is at the heart of your lookup problems, given the way that UNIX programs tend to put in what they were given out. I think that if you disable the attempted case folding in the SMBFS VOP_LOOKUP code, your problem will go away. Note: things which reference explicit names use VOP_LOOKUP, while things which iterate directories use VOP_READDIR. I suspect that you will see similar problems on attempts to rename things, because of this. NB: Another approach would be to fold everything to lower case in both VOP_LOOKUP and VOP_READDIR; this could be accomplished using a mount option. If you wanted to be more Windows-like, you could make the first letter upper case, and subsequent letters lower case. NNB: The behaviour will also depend on the server you are using; some servers can return both the short (8.3) and long names over SMB, and others can only return the short names. NNNB: If you are using a Samba server as the server, and short names, you are probably screwed, since short names on a Samba server are synthetic, and indeterminately so. On a Windows box, if I rename (short:long) "PROGRA~1":"Program Files" to "PROGRA~7", I get "PROGRA~7":"PROGRA~7"; if I then rename "PROGRA~7" to "Program Files", I get "PROGRA~7":"Program Files". Since the Samba short namespace is synthetic even if the UNIX FS underneath supports both name spaces (since the UNIX name API is handicapped, compared to the Macintosh or Windows API), you will get a short name based on the inode number. --- As to the df/du problem, I'd suggest hacking VFS_STAT to return fake data, and then figure out why it's failing so catastrophically, since the problem is there. I suspect the problem is that it is an old VFS_STAT call that is being called, and that a new VFS_STAT struct is being copied out in all cases, instead of making sure it is old vs. new, and doing the right thing, and the resulting buffer overrun stomps on something important. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message