[Samba] smbfs hard links

Martin Orr samba at martinorr.name
Fri Feb 11 16:33:39 GMT 2005


When I mount an smbfs file system from a Samba server, I am able to create
both symbolic and hard links in it with ln.  However, while the hard links
are real hard links on the server, they do not appear as such on the client
because they have different inode numbers:
testuser at computorr:~$ mkdir mountpoint
testuser at computorr:~$ smbmount //henry/testuser mountpoint
Password:
testuser at computorr:~$ cd mountpoint
testuser at computorr:~/mountpoint$ touch x
testuser at computorr:~/mountpoint$ ln x y
testuser at computorr:~/mountpoint$ ls -li
total 0
1484 -rw-r--r--  1 testuser testuser 0 Feb 11 15:38 x
1485 -rw-r--r--  1 testuser testuser 0 Feb 11 15:38 y
testuser at computorr:~/mountpoint$ ssh henry ls -li
total 0
5308465 -rw-r--r--  2 testuser testuser 0 Feb 11 15:38 x
5308465 -rw-r--r--  2 testuser testuser 0 Feb 11 15:38 y

Would it be possible to use the unique ID in the attributes returned by the
server to set the inode number on the client, instead of generating a new
inode for every dirent?  smbd sets the unique ID using the inode number on
the server, so this ought to get hard links right.

I can see that this could potentially return the same inode number for
distinct files if the share crosses multiple filesystems on the server.
However, I think inode numbers only really looked at when creating
temporary/lock files and only on hard links within the same directory.

-- 
Martin Orr
Linux Administrator,
Methodist College Belfast


More information about the samba mailing list