Bug 9492 - unable to POSIX delete symlinks that don't have a valid target
Summary: unable to POSIX delete symlinks that don't have a valid target
Status: NEW
Alias: None
Product: Samba 3.6
Classification: Unclassified
Component: File services (show other bugs)
Version: 3.6.9
Hardware: All All
: P5 normal
Target Milestone: ---
Assignee: Volker Lendecke
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-11 19:44 UTC by Jeff Layton
Modified: 2012-12-11 21:10 UTC (History)
0 users

See Also:


Attachments
smbd -d10 log from above operations (355.49 KB, application/octet-stream)
2012-12-11 19:44 UTC, Jeff Layton
no flags Details
pcap file (4.53 KB, application/x-gzip)
2012-12-11 21:10 UTC, Jeff Layton
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Layton 2012-12-11 19:44:31 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)
Context: system_u:object_r:cifs_t:s0
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
 Birth: -

$ 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.
Comment 1 Jeremy Allison 2012-12-11 19:51:09 UTC
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.

Jeremy.
Comment 2 Jeff Layton 2012-12-11 21:10:56 UTC
Created attachment 8342 [details]
pcap file

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.