Running Samba 3.3.8 - it seems that 3.3.2 - 3.4.0 are affected. Users are unable to rename subfolders in the Folder pane of the Explorer view (left-hand side). Only tested in Windows XP against x86 and x86_64. Renaming parent folders works as expected, but any attempt to rename a subfolder on the Folder pane causes the (really generic) Windows error: Cannot rename 'x': Access is Denied Make sure that the disk is not full or write-protected and that the file is not currently in use. Tested with multiple shares in multiple configurations - common to all servers are the following: ldapsam backend on another server All servers tested are member servers Shares use different configuration options, have different names, etc. Here is a sample share configuration: [paperless] path = /paperless/file_room/ read only = No create mask = 07775 #Set temporarily security mask = 07775 # Set temporarily directory mask = 07775 # Set temporarily directory security mask = 07775 #Set temporarily inherit permissions = Yes inherit owner = Yes guest ok = Yes #Set temporarily delete readonly = Yes Log level 25 log follows - restarted the service, accessed the share and attempted to rename, which provoked the error message: [2009/10/06 15:21:08, 5] lib/debug.c:debug_dump_status(407) INFO: Current debug levels: all: True/25 tdb: False/0 printdrivers: False/0 lanman: False/0 smb: False/0 rpc_parse: False/0 rpc_srv: False/0 rpc_cli: False/0 passdb: False/0 sam: False/0 auth: False/0 winbind: False/0 vfs: False/0 idmap: False/0 quota: False/0 acls: False/0 locking: False/0 msdfs: False/0 dmapi: False/0 registry: False/0 doing parameter max log size = 1000 doing parameter syslog = 0 doing parameter panic action = /usr/share/samba/panic-action %d doing parameter security = domain doing parameter encrypt passwords = true doing parameter passdb backend = ldapsam:ldap://fuzzed_host_name doing parameter ldap suffix = dc=commund, dc=com doing parameter ldap machine suffix = ou=Computers doing parameter ldap user suffix = ou=Users doing parameter ldap group suffix = ou=Groups doing parameter ldap idmap suffix = ou=Users doing parameter ldap admin dn = cn=admin,dc=fuzzed_domain,dc=com doing parameter idmap backend = ldap:ldap://fuzzed_host_name doing parameter idmap uid = 10000-20000 doing parameter idmap gid = 10000-20000 doing parameter winbind trusted domains only = yes doing parameter obey pam restrictions = no doing parameter invalid users = root doing parameter ldap ssl = off doing parameter usershare allow guests = yes [2009/10/06 15:21:08, 4] param/loadparm.c:lp_load_ex(8873) pm_process() returned Yes [2009/10/06 15:21:08, 7] param/loadparm.c:lp_servicenumber(9078) lp_servicenumber: couldn't find homes [2009/10/06 15:21:08, 10] param/loadparm.c:set_server_role(8051) set_server_role: role = ROLE_DOMAIN_MEMBER [2009/10/06 15:21:08, 5] lib/iconv.c:smb_register_charset(104) Attempting to register new charset UCS-2LE [2009/10/06 15:21:08, 5] lib/iconv.c:smb_register_charset(112) Registered charset UCS-2LE [2009/10/06 15:21:08, 5] lib/iconv.c:smb_register_charset(104) Attempting to register new charset UTF-16LE [2009/10/06 15:21:08, 5] lib/iconv.c:smb_register_charset(112) Registered charset UTF-16LE [2009/10/06 15:21:08, 5] lib/iconv.c:smb_register_charset(104) Attempting to register new charset UCS-2BE [2009/10/06 15:21:08, 5] lib/iconv.c:smb_register_charset(112) Registered charset UCS-2BE [2009/10/06 15:21:08, 5] lib/iconv.c:smb_register_charset(104) Attempting to register new charset UTF-16BE [2009/10/06 15:21:08, 5] lib/iconv.c:smb_register_charset(112) Registered charset UTF-16BE [2009/10/06 15:21:08, 5] lib/iconv.c:smb_register_charset(104) Attempting to register new charset UTF8 [2009/10/06 15:21:08, 5] lib/iconv.c:smb_register_charset(112) Registered charset UTF8 [2009/10/06 15:21:08, 5] lib/iconv.c:smb_register_charset(104) Attempting to register new charset UTF-8 [2009/10/06 15:21:08, 5] lib/iconv.c:smb_register_charset(112) Registered charset UTF-8 [2009/10/06 15:21:08, 5] lib/iconv.c:smb_register_charset(104) Attempting to register new charset ASCII [2009/10/06 15:21:08, 5] lib/iconv.c:smb_register_charset(112) Registered charset ASCII [2009/10/06 15:21:08, 5] lib/iconv.c:smb_register_charset(104) Attempting to register new charset 646 [2009/10/06 15:21:08, 5] lib/iconv.c:smb_register_charset(112) Registered charset 646 [2009/10/06 15:21:08, 5] lib/iconv.c:smb_register_charset(104) Attempting to register new charset ISO-8859-1 [2009/10/06 15:21:08, 5] lib/iconv.c:smb_register_charset(112) Registered charset ISO-8859-1 [2009/10/06 15:21:08, 5] lib/iconv.c:smb_register_charset(104) Attempting to register new charset UCS2-HEX [2009/10/06 15:21:08, 5] lib/iconv.c:smb_register_charset(112) Registered charset UCS2-HEX [2009/10/06 15:21:08, 5] lib/charcnv.c:charset_name(82) Substituting charset 'UTF-8' for LOCALE [2009/10/06 15:21:08, 5] lib/charcnv.c:charset_name(82) Substituting charset 'UTF-8' for LOCALE [2009/10/06 15:21:08, 5] lib/charcnv.c:charset_name(82) Substituting charset 'UTF-8' for LOCALE [2009/10/06 15:21:08, 5] lib/charcnv.c:charset_name(82) Substituting charset 'UTF-8' for LOCALE [2009/10/06 15:21:08, 5] lib/charcnv.c:charset_name(82) Substituting charset 'UTF-8' for LOCALE [2009/10/06 15:21:08, 5] lib/charcnv.c:charset_name(82) Substituting charset 'UTF-8' for LOCALE [2009/10/06 15:21:08, 5] lib/charcnv.c:charset_name(82) Substituting charset 'UTF-8' for LOCALE [2009/10/06 15:21:08, 5] lib/charcnv.c:charset_name(82) Substituting charset 'UTF-8' for LOCALE [2009/10/06 15:21:08, 5] lib/charcnv.c:charset_name(82) Substituting charset 'UTF-8' for LOCALE [2009/10/06 15:21:08, 5] lib/charcnv.c:charset_name(82) Substituting charset 'UTF-8' for LOCALE [2009/10/06 15:21:08, 5] lib/charcnv.c:charset_name(82) Substituting charset 'UTF-8' for LOCALE [2009/10/06 15:21:08, 5] lib/charcnv.c:charset_name(82) Substituting charset 'UTF-8' for LOCALE [2009/10/06 15:21:08, 2] lib/tallocmsg.c:register_msg_pool_usage(106) Registered MSG_REQ_POOL_USAGE [2009/10/06 15:21:08, 2] lib/dmallocmsg.c:register_dmalloc_msgs(77) Registered MSG_REQ_DMALLOC_MARK and LOG_CHANGED Please let me know if any additional information is needed. I am happy to help where possible.
This is not reproducible with the 3.4.x code in the git tree. I don't think there have been any changes here w.r.t. subfolder renaming. This might be a config error. Please run Samba at debug level 10 and upload a log file containing the rename request. If you can name the folder a more descriptive name than 'x' (like folder_to_rename) that would help in finding the exact point in the log you're getting the error. Jeremy.
Created attachment 4791 [details] Log level 10 while renaming folder Attached is log level from client renaming a folder called folder_to_rename to folder_to_rename - renaming. Thank you for your assistance. I hope I have made a config error. :-)
Ok, I can't see any logic error in the log here. Looks like the OS is simply denying the rename. What do the UNIX ownership and permissions on the directory: Quotes/Online/ and the directory: Quotes/Online/folder_to_rename look like ? Jeremy.
(In reply to comment #3) > What do the UNIX ownership and permissions on the > directory: > > Quotes/Online/ drwxrwxrwx 7 nbaldridge Domain Users 4096 2009-10-06 15:54 Online > and the directory: > > Quotes/Online/folder_to_rename drwxrwxrwx 2 nbaldridge Domain Users 4096 2009-10-06 15:54 folder_to_rename > look like ? Thanks, -Nick
Ok, there's no conceivable reason that renaming fails here - all permissions allow it and the logic is correct in the server, it gets to the underlying VFS_RENAME call which just fails. Is this mounted on a read-only filesystem ? Do you have apparmour or SeLinux turned on ? To debug this further I'll need an strace output of the smbd trying to do the rename. Jeremy.
(In reply to comment #5) > Is this mounted on a read-only filesystem ? Nope. > Do you have apparmour or SeLinux turned on ? I do have apparmour on, no selinux. There is no samba profile and running with apparmour off entirely still causes the problem. > To debug this further I'll need an > strace output of the smbd trying to do the rename. I'll attach that next. Thanks again! -Nick
I've set the strace in the URL of the bug. Once closed, I'll remove the link from my server.
That file isn't an strace output, it's another smbd log. However, I have seen another possibility. Do you have any files open from the same client inside the directory you're trying to rename ? That would cause the access denied error. Can you compile Samba from source code ? If so, I'll send you a patch file that adds a lot more debugging info to the log file so I can understand what is going on here. Jeremy.
(In reply to comment #8) > That file isn't an strace output, it's another smbd log. Hmm. Interesting - I just ran strace smbd > strace.out and went through attempting to rename again. Sorry I put up the wrong info. I've taken it down. > Do you have any files open from the same client inside the > directory you're trying to rename ? That would cause the access denied error. That would be great, but no - I was wondering if Windows treated Explorer's folder view as two separate connections - the one on the left screen and the one on the right, as they interoperate semi-independently, which might be causing the confusion. > Can you compile Samba from source code ? Yep, this is the latest 3.3.8 from the Samba website downloaded today per your earlier recommendation. Thanks again! -Nick
No I already checked that myself (the explorer windows operating semi-independently). I had a view open in the right pane and renamed the left pane. If you're able to build from source I'll send a custom patch to add debug messages tomorrow so we can track down what is generating ACCESS_DENIED (too late here now). Jeremy.
Yep - ready, willing, and able - send it on!
Created attachment 4803 [details] Test debug patch. Please apply this patch, reproduce the problem then attach the debug level 10. This should give me more info. Thanks, Jeremy.
Created attachment 4804 [details] Log level 10 while renaming folder with debug patch applied Attached is the requested log. It's saying it found an open file, if I'm reading this correctly: can_rename: file_find_subpath found an open file below Quotes/Online/folder_to_rename But the interesting thing is that there are no files inside this folder (outside of . and ..), so I'm curious as to what it's seeing as locked... I very much appreciate your help, -Nick
Created attachment 4805 [details] Test debug patch with more info on open files. Ok, try this patch instead - will give more info about the open file it thinks matches. Please post the debug level 10 again. Should be enough to nail this. Jeremy.
Created attachment 4806 [details] Try this patch instead... Ooops sorry. Don't reference memory we just freed :-). Jeremy.
Ok, I've found the error. The client has the same directory open already, so the open for rename is an identical open. The code in file_find_subpath() was not handling this correctly (ie. it was returning "true" for an identical name, rather than only returning "true" for a name longer than the directory name). I have a fix for this that I'm checking into master and 3.5, and will add git-am patches for 3.3.9 and 3.4.2. Jeremy.
FYI. I'm guessing you have an anti-virus scanner on your XP box ? Jeremy.
Created attachment 4807 [details] git-am patch for 3.4.3. Version of the fix for 3.4.3. The current code there was better than the 3.3.x code, but still had the problem with a rename of ./a -> ./b failing when directory ./aa was already open. Jeremy.
Created attachment 4808 [details] git-am patch for 3.4.3 with simplified logic. Patch that should be in 3.4.3 (once vl reviews). Jeremy.
Created attachment 4809 [details] git-am patch for 3.3.9 Fix for 3.3.9, if vl approves. Without it XP clients will fail directory renames (my guess is when they have an active virus scanner). Jeremy.
Added regression test to smbtorture4 RAW-RENAME test - git log: 46d193324082000f19221f1b1ac679512aff96ed Jeremy.
Comment on attachment 4809 [details] git-am patch for 3.3.9 Looks good. Volker
Comment on attachment 4808 [details] git-am patch for 3.4.3 with simplified logic. Sorry, here I do not see the logic to deny a rename if a stream of the file in question is open. Can you explain how that would work? Thanks, Volker
(In reply to comment #17) > FYI. I'm guessing you have an anti-virus scanner on your XP box ? No, not an active virus scanner - I use clamwin on this box, which is an on-demand virus scanner. It was not scanning anywhere near the time. I also am not running any service that indexes any drive - not Windows search, not Windows Defender, nothing but plain vanilla services. Thanks for all your help! I'm going to test the fix today. -Nick > Jeremy. >
(In reply to comment #23) > (From update of attachment 4808 [details]) > Sorry, here I do not see the logic to deny a rename if a stream of the file in > question is open. > > Can you explain how that would work? Renames with open streams are not denied. See: source4/torture/raw/rename.c:665 in master. 664 /* 665 * Now try opening a stream on the directory and holding it open 666 * across a rename. This should be allowed. 667 */ 668 io.ntcreatex.in.fname = sname; 669 670 status = smb_raw_open(cli->tree, tctx, &io); 671 CHECK_STATUS(status, NT_STATUS_OK); 672 fnum = io.ntcreatex.out.file.fnum; 673 674 ren_io.generic.level = RAW_RENAME_RENAME; 675 ren_io.rename.in.pattern1 = dname2; 676 ren_io.rename.in.pattern2 = dname1; 677 ren_io.rename.in.attrib = 0; 678 679 status = smb_raw_rename(cli->tree, &ren_io); 680 CHECK_STATUS(status, NT_STATUS_OK); Jeremy.
Re-assigning to Karolin for inclusion in 3.3.9 and 3.4.3. Jeremy.
Pushed to v3-3-test and v3-4-test. Will be included in the next bug fix releases. Closing out bug report. Thanks!