[Samba] Empty folder deletion issue - Samba 4.15 thru 4.18

Rowland Penny rpenny at samba.org
Wed Mar 15 16:44:47 UTC 2023



On 15/03/2023 15:29, CaptainTrips28 via samba wrote:
> Encountering a strange one... has been occuring since samba 4.15.x and
> continues to occur even in 4.17.5 and 4.18
> 
> Issue does not occur in earlier versions (4.13.x) and have switched back
> and forth between versions to confirm.
> 
> Servers are winbind joined, PAM and krb5 auth, all seems to work fine
> (reading, writing, creating, moving) until trying to delete an empty folder
> on the share from Windows client. Folder briefly disappears, but then
> reappears once refreshed. I've confirmed no attributes set,
> files/subfolders or hidden files are in the folder. Age of the folder
> doesn't matter, new empty folders, old empty folders... issue occurs on
> them regardless.
> 
> Servers are all various RHEL releases, version 7.9, 8.4 and 8.6. Issue
> occurs regardless if RHEL repo samba packages 4.15.x or Samba source builds
> (4.17.5 or 4.18). I did originally open a ticket with Redhat but they
> simply suggested it was a bug since it doesn't occur with samba 4.13.x and
> passed it onto their engineering team (haven't heard any follow-up in
> months since opening that ticket)
> 
> All I can find is a rmdir_internal related error in the logs:
> 
> """""""
> [2023/03/15 10:59:21.285508, 10, pid=8606, effective(1617208032,
> 1617207642), real(1617208032, 0)]
> ../../source3/smbd/files.c:528(openat_pathref_fullname)
> 
>    openat_pathref_fullname: fsp [wrk/anly/testfolder/New folder]: OK
> 
> [2023/03/15 10:59:21.285573,  3, pid=8606, effective(1617208032,
> 1617207642), real(1617208032, 0)]
> ../../source3/smbd/close.c:1134(rmdir_internals)
> 
>    rmdir_internals: couldn't remove directory wrk/anly/testfolder/New
> folder/New folder2 : Invalid argument
> 
> [2023/03/15 10:59:21.285596,  5, pid=8606, effective(1617208032,
> 1617207642), real(1617208032, 0)] ../../source3/smbd/files.c:1814(file_free)
> 
>    file_free: freed files structure 0 (3 used)
> 
> [2023/03/15 10:59:21.285611,  5, pid=8606, effective(1617208032,
> 1617207642), real(1617208032, 0)]
> ../../source3/smbd/close.c:1573(close_directory)
> 
>    close_directory: wrk/anly/testfolder/New folder/New folder2. Delete on
> close was set - deleting directory returned NT_STATUS_INVALID_PARAMETER.
> """"""
> 
> 
> 
> Any help/suggestions greatly appreciated.

I think it may be the spaces in the directory names, I cannot easily 
delete a similar name with smbclient:

smb: \> rmdir test two
NT_STATUS_OBJECT_NAME_NOT_FOUND removing remote directory file \test

I tried various 'escaping' of the space and found that double quotes worked

e.g.

smb: \> ls
   .                                   D        0  Wed Mar 15 16:34:08 2023
   ..                                  D        0  Wed Mar 15 16:22:07 2023
   test two                            D        0  Wed Mar 15 16:24:01 2023

		19946096 blocks of size 1024. 8002180 blocks available

smb: \> rmdir "test two"
smb: \> ls
   .                                   D        0  Wed Mar 15 16:39:48 2023
   ..                                  D        0  Wed Mar 15 16:22:07 2023

		19946096 blocks of size 1024. 8002188 blocks available

Whilst this isn't a fix, it may point to a workaround and a way to a 
permanent fix.

Rowland









More information about the samba mailing list