Bug 10516 - Recursive directory deletion from windows command fails with "directory not empty".
Summary: Recursive directory deletion from windows command fails with "directory not e...
Status: NEW
Alias: None
Product: Samba 3.6
Classification: Unclassified
Component: SMB2 (show other bugs)
Version: 3.6.12
Hardware: All FreeBSD
: P5 major
Target Milestone: ---
Assignee: Jeremy Allison
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-26 11:42 UTC by Hemanth
Modified: 2014-03-28 01:11 UTC (History)
1 user (show)

See Also:


Attachments
packet capture during the problem (930.18 KB, application/octet-stream)
2014-03-26 11:42 UTC, Hemanth
no flags Details
Client debug level 10 logs. (627.46 KB, application/x-zip-compressed)
2014-03-27 06:26 UTC, Hemanth
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hemanth 2014-03-26 11:42:19 UTC
Created attachment 9802 [details]
packet capture during the problem

We have a freenas server running samba 3.6.12 stack. Not sure if this is fixed in latest 3.6.X or 4.X branches.

When we attempt to delete a directory(with more than 500 files) from windows command prompt its failing with "directory not empty" error.

X:\>rmdir /S /Q test2
The directory is not empty.

In this case, test2 has 600 files in it. On the first attempt of rmdir, it is able to delete only few files. If we run the same command for 2 to 3 times, then all the files getting deleted and finally recursive delete will be succeeded.

From packet capture:
Client initially send a find request before it start deleting the files in test dir. Before it start attempting to delete the files, client is re-issuing the find request with max output buffer set to 4K. Based on the response, client is attempting to delete the files found in the find response. Again sends find request for next set with 4K buffer. After a while of these iterations, client received STATUS_NO_MORE_FILES for one of the find requests and thats where it stopped deleting the files and attempted to delete the parent dir. Since there are still some files left in the parent dir, delete failed with "STATUS_DIRECTORY_NOT_EMPTY". 

Deletion from explorer is not having any issue. Able to delete the files in one attempt itself. Because, explorer is not re-issuing the find requests to get the lists in chunk. 

From the logs, I could figure out that vfs_readdirname() is actually returning NULL after few iterations which is causing the error to be STATUS_NO_MORE_FILES though there are actually few files remaining in the directory. At this point I am not sure why readdir is unable to get/read the remaining entries in the directory.
Comment 1 Richard Sharpe 2014-03-26 14:13:31 UTC
Did you test against Windows?
Comment 2 Hemanth 2014-03-26 14:35:27 UTC
(In reply to comment #1)
> Did you test against Windows?

Yes. I have tested against windows 2K8 server. Its working fine.
Comment 3 Jeremy Allison 2014-03-26 19:08:40 UTC
Please upload a debug level 10 log also.

Thanks,

Jeremy.
Comment 4 Hemanth 2014-03-27 06:26:03 UTC
Created attachment 9807 [details]
Client debug level 10 logs.

Attached the debug level 10 client logs during the problem.