The Samba-Bugzilla – Bug 9492
unable to POSIX delete symlinks that don't have a valid target
Last modified: 2012-12-11 21:10:56 UTC
Created attachment 8341 [details]
smbd -d10 log from above operations
I'm unable to remove a symlink on a CIFS share that does not point to a valid target:
1) Mount up a share with Linux CIFS and have unix extensions enabled (e.g. onto /mnt/cifs).
$ cd /mnt/cifs
$ stat foo
stat: cannot stat ‘foo’: No such file or directory
$ ln -s foo/bar baz
$ stat baz
File: ‘baz’ -> ‘foo/bar’
Size: 7 Blocks: 2048 IO Block: 16384 symbolic link
Device: 20h/32d Inode: 554300431 Links: 1
Access: (0777/lrwxrwxrwx) Uid: (50000/testuser) Gid: (50000/testuser)
Access: 2012-12-11 14:41:21.625111800 -0500
Modify: 2012-12-11 14:41:18.736976400 -0500
Change: 2012-12-11 14:41:18.736976400 -0500
$ rm baz
rm: cannot remove ‘baz’: No such file or directory
...sniffing traffic shows that the ENOENT response comes from the server. Now...
$ mkdir foo
$ touch foo/bar
$ rm baz <===== SUCCESS!
From this, I sort of infer that the server is likely doing a stat() call or something when it should be doing lstat() instead, but I haven't confirmed that.
Arg. This bug is the bane of my life and it keeps coming back... I thought we had regression tests that stopped this re-occuring. Can you upload a wireshark trace also ?
I'll take a look. Thanks for reporting Jeff.
Created attachment 8342 [details]
Here's the capture you requested. It also contains all of the session setup stuff at the beginning. I only did the create, stat and then the rm attempt in this. I didn't bother with creating the files that the symlink points to and doing a successful delete.