Samba inode faking breaks fileutils (and may corrupt thefilesystem)

Tim Van Holder tim.vanholder at falconsoft.be
Thu Oct 19 06:25:20 GMT 2000


Urban Widmark wrote:
> 
> On Tue, 17 Oct 2000, Tim Van Holder wrote:
> 
> > as a result, I ended up with a structure like this:
> > /mnt/nt-share/fOO/fOO/fOO/fOO/fOO/fOO/fOO/fOO/fOO/fOO/...
> 
> Easily reproducable on the latest version. I'll look into this soon,
> unless someone else fixes it before me (hint, hint :)
> 
> > It seems mv happily moves the directory into itself. This directory tree
> > is nested so deeply even that NT is unable to access or even delete it, so
> > it effectively becomes immortal.
> 
> On the NT box or when doing it over smbfs? If not from smbfs it is
> probably "immortal" only to the application you were using to delete it
> (explorer?).
Both. NT just says pathname too long or nesting too deep (due to the
limits in the API).
I have been told that the only way around it is to use the unicode
version of the pathname, prepended with \\?\. This allows the Win32 API
to access paths that exceed its normal size limit. Note that very few
applications actually use this extension (the C Runtime included).
If going through samba, when it gets to a certain point in the tree (the
length limit, I expect), I get a Permission denied (both using cd and
rm/rmdir).

> > The problem seems to be with samba's inode number faking, as it generates
> > a new fake inode if a directory entry is referred to by a different name
> > (eg a directory entry foo will have gotten inode number 1234, but if it's
> > accessed as FOO, it gets a new inode generated for it). This breaks
> > fileutils, as they use the inode number to detect identical files.
> 
> Samba does not fake inode numbers, smbfs does. And the behaviour is
> related to dcache/dentries too, not only inodes. It is possible to create
> a directory and get the move to fail with the expected error message.
> 
> Btw, be careful when doing operations over smbfs to a deep directory
> structure. Before 2.2.18-pre15 there was no checks that the pathlengths
> remain within the fixed buffersizes of smbfs (of smb/cifs ?). You can
> easily crash your linux machine by doing that.
Then I was probably fortunate to interrupt mv when I did - I could have
ended up with an extremely deep path.

-- 
Tim Van Holder - Falcon Software NV
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Fight spam - go to http://www.politik-digital.de/spam/




More information about the samba mailing list