RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2019461 - Directory containing dangling symlinks cannot be deleted.
Summary: Directory containing dangling symlinks cannot be deleted.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: samba
Version: 8.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: rc
: ---
Assignee: Pavel Filipensky
QA Contact: Denis Karpelevich
URL:
Whiteboard:
Depends On:
Blocks: 2026717
TreeView+ depends on / blocked
 
Reported: 2021-11-02 15:37 UTC by Bijesh Thekkepat
Modified: 2022-05-10 16:49 UTC (History)
8 users (show)

Fixed In Version: samba-4.15.2-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2026717 (view as bug list)
Environment:
Last Closed: 2022-05-10 15:27:35 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-101502 0 None None None 2021-11-02 16:35:02 UTC
Red Hat Issue Tracker SSSD-4081 0 None None None 2021-12-06 12:19:12 UTC
Red Hat Product Errata RHSA-2022:2074 0 None None None 2022-05-10 15:28:04 UTC
Samba Project 14878 0 None None None 2021-11-25 12:38:09 UTC
Samba Project 14879 0 None None None 2021-11-25 12:38:25 UTC

Description Bijesh Thekkepat 2021-11-02 15:37:32 UTC
Description of problem:

Dangling/dead symlinks cannot be detected by samba and folder containing Dangling/dead symlinks cannot be deleted.


Version-Release number of selected component (if applicable):

[root@smb ~]# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.4 (Ootpa)


[root@smb ~]# rpm -qa samba*
samba-client-4.13.3-4.el8_4.x86_64
samba-common-tools-4.13.3-4.el8_4.x86_64
samba-winbind-4.13.3-4.el8_4.x86_64
samba-libs-4.13.3-4.el8_4.x86_64
samba-winbind-modules-4.13.3-4.el8_4.x86_64
samba-common-libs-4.13.3-4.el8_4.x86_64
samba-common-4.13.3-4.el8_4.noarch
samba-client-libs-4.13.3-4.el8_4.x86_64
samba-winbind-clients-4.13.3-4.el8_4.x86_64
samba-4.13.3-4.el8_4.x86_64

How reproducible:

====
[root@smb ~]# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.4 (Ootpa)


[root@smb ~]# rpm -qa samba*
samba-client-4.13.3-4.el8_4.x86_64
samba-common-tools-4.13.3-4.el8_4.x86_64
samba-winbind-4.13.3-4.el8_4.x86_64
samba-libs-4.13.3-4.el8_4.x86_64
samba-winbind-modules-4.13.3-4.el8_4.x86_64
samba-common-libs-4.13.3-4.el8_4.x86_64
samba-common-4.13.3-4.el8_4.noarch
samba-client-libs-4.13.3-4.el8_4.x86_64
samba-winbind-clients-4.13.3-4.el8_4.x86_64
samba-4.13.3-4.el8_4.x86_64
====

#####################
[IDM1\bijeshtesting@smb smbtest]$ pwd
/home/IDM1/bijeshtesting/smbtest


[IDM1\bijeshtesting@smb smbtest]$ touch testfile
[IDM1\bijeshtesting@smb smbtest]$ echo "test" > testfile
[IDM1\bijeshtesting@smb smbtest]$ cat testfile
test
[IDM1\bijeshtesting@smb smbtest]$ ls -la
total 4
drwxrwsr-x 2 IDM1\bijeshtesting IDM1\domain users  22 Oct 20 02:18 .
drwxr-sr-x 6 IDM1\bijeshtesting IDM1\domain users 176 Oct 20 01:50 ..
-rw-r--r-- 1 IDM1\bijeshtesting IDM1\domain users   5 Oct 20 02:18 testfile


[IDM1\bijeshtesting@smb smbtest]$ ln -s testfile testfilelink  <----------------------------- created symbolic link

[IDM1\bijeshtesting@smb smbtest]$ ls -la
total 4
drwxrwsr-x 2 IDM1\bijeshtesting IDM1\domain users  42 Oct 20 02:19 .
drwxr-sr-x 6 IDM1\bijeshtesting IDM1\domain users 176 Oct 20 01:50 ..
-rw-r--r-- 1 IDM1\bijeshtesting IDM1\domain users   5 Oct 20 02:18 testfile
lrwxrwxrwx 1 IDM1\bijeshtesting IDM1\domain users   8 Oct 20 02:19 testfilelink -> testfile



[root@smb testshare]# smbclient -U bijeshtesting.global //smb.idm.local/testshare  <----------------------------- When connected to smbclient samba is able to detect both files as expected.
Enter bijeshtesting.global's password:
Try "help" to get a list of possible commands.
smb: \> cd smbtest\
smb: \smbtest\> ls
  .                                   D        0  Wed Oct 20 02:19:36 2021
  ..                                  D        0  Wed Oct 20 01:50:04 2021
  testfile                            N        5  Wed Oct 20 02:18:20 2021
  testfilelink                        N        5  Wed Oct 20 02:18:20 2021

8374272 blocks of size 1024. 3469108 blocks available
smb: \smbtest\> exit


[IDM1\bijeshtesting@smb smbtest]$ rm -rf testfile     <----------------------------- Deleted original file
[IDM1\bijeshtesting@smb smbtest]$ ls -la
total 0
drwxrwsr-x 2 IDM1\bijeshtesting IDM1\domain users  26 Oct 20 02:20 .
drwxr-sr-x 6 IDM1\bijeshtesting IDM1\domain users 176 Oct 20 01:50 ..
lrwxrwxrwx 1 IDM1\bijeshtesting IDM1\domain users   8 Oct 20 02:19 testfilelink -> testfile   <----------------------------- Since original file is deleted the symlink breaks. From server we can see Red colour highligted for the link  [Attached link.png]
[IDM1\bijeshtesting@smb smbtest]$ cat testfilelink
cat: testfilelink: No such file or directory
[IDM1\bijeshtesting@smb smbtest]$ cat testfile
cat: testfile: No such file or directory


1]
[root@smb testshare]# smbclient -U bijeshtesting.global //smb.idm.local/testshare  <----------------------------- smbclient is not able to detect both the files.
Enter bijeshtesting.global's password:
Try "help" to get a list of possible commands.
smb: \> cd smbtest\
smb: \smbtest\> ls
  .                                   D        0  Wed Oct 20 02:20:45 2021
  ..                                  D        0  Wed Oct 20 01:50:04 2021

8374272 blocks of size 1024. 3468380 blocks available
smb: \smbtest\> exit


Logs shows

=======
[2021/10/20 02:23:03.901018,  5, pid=38661, effective(1101347, 1100513), real(1101347, 0)] ../../source3/smbd/trans2.c:1808(smbd_dirptr_lanman2_mode_fn)
  smbd_dirptr_lanman2_mode_fn: Couldn't stat [smbtest/testfilelink] (No such file or directory)
=======

smb: \smbtest\> cd ..

2]
smb: \> rmdir smbtest\                                                   <----------------------------- When tried to delete the directory "smbtest" it fails with NT_STATUS_DIRECTORY_NOT_EMPTY error.
NT_STATUS_DIRECTORY_NOT_EMPTY removing remote directory file \smbtest\

Logs shows

=======
[2021/10/20 02:24:23.853803, 10, pid=38661, effective(1101347, 1100513), real(1101347, 0)] ../../source3/smbd/dir.c:1796(can_delete_directory_fsp)
  got name testfilelink - can't delete
=======

3]
The same issue happens when share is accessed from Windows explorer. The samba share is not able to detect the dead link and if we goto parent folder and try and delete the folder containing the dead link, we cannot remove it as samba see the folder as not being empty.
#####################



Detailed Samba debugging logs attached for 1] ls.txt and 2] rmdir.txt 3] Share not showing dead link file.png , Trying to delete parent folder.png , Parent folder not getting deleted.png, link.png



Below is my current smb.conf , I have tried with few options as below but it did not help.

==========
[IDM1\bijeshtesting@smb smbtest]$ cat /etc/samba/smb.conf
[global]
workgroup = IDM1
realm = GSSLAB1.IDM.GLOBAL
security = ads
idmap config * : backend = autorid
idmap config * : range = 100000-19999999
idmap config * : rangesize = 1000000
template homedir = /home/%D/%U
template shell = /bin/bash
winbind use default domain = false
winbind offline logon = true
log file = /var/log/samba/log.%m
max log size = 0
log level = 10
allow insecure wide links = yes   <------------------
unix extensions = no     <------------------
debug pid = true


[testshare]
comment = My Samba share
path = /home/IDM1/bijeshtesting/
read only = no
guest ok = no
valid users = +"IDM1\domain users"
write list = +"IDM1\domain users"
follow symlinks = yes   <------------------
wide links = yes        <------------------
==========


Steps to Reproduce:

As above

Actual results:

Folder containing Dangling/dead symlinks cannot be deleted.

Expected results:

Folder containing Dangling/dead symlinks should be deleted.

Additional info:

Samba sme expert Pavel Filipensky from Redhat was able to provide me below info

---
The fix was already coded by Jeremy Allison: https://bugzilla.samba.org/show_bug.cgi?id=14879. I was already able to verify that with 'delete veto files = yes' it will be possible to delete dir with dangling symlinks.

We will backport the fix to RHEL once it is ready. 
---

@Pavel Thank you..

Comment 14 errata-xmlrpc 2022-05-10 15:27:35 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: samba security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:2074


Note You need to log in before you can comment on or make changes to this bug.