Bug 1671611

Summary: Unable to delete directories that contain linkto files that point to itself.
Product: [Community] GlusterFS Reporter: Nithya Balachandran <nbalacha>
Component: distributeAssignee: Nithya Balachandran <nbalacha>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5CC: bugs
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glusterfs-5.5 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1667804 Environment:
Last Closed: 2019-02-04 14:51:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1667804    
Bug Blocks: 1667556, 1668989    

Description Nithya Balachandran 2019-02-01 05:07:31 UTC
+++ This bug was initially created as a clone of Bug #1667804 +++

Description of problem:
A directory containing linkto files that point to itself cannot be deleted.


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


How reproducible:

Consistently

Steps to Reproduce:

1. gluster v create tvol 192.168.122.7:/bricks/brick2/tvol-{1..2}
2. gluster v start tvol
3. mount -t glusterfs -s 192.168.122.7:/tvol /mnt/g1
4. cd /mnt/g1
5. mkdir -p dir0/dir1/dir2
6. cd dir0/dir1/dir2
7. for i in {1..100}; do echo "Test file" > tfile-$i; done
8. for i in {1..100}; do mv tfile-$i ntfile-$i; done
9. gluster v remove-brick tvol 192.168.122.7:/bricks/brick2/tvol-2 start

Once the remove-brick status shows "completed", 
10. gluster v remove-brick tvol 192.168.122.7:/bricks/brick2/tvol-2 stop

You should now have only linkto files in 192.168.122.7:/bricks/brick2/tvol-2/dir0/dir1/dir2 and they should all be pointing to 
tvol-client-0. 
Manually change the linkto xattr value for every file in brick2 to point to itself, in this case "tvol-client-1"(make sure the string is null terminated).

11. setfattr -n trusted.glusterfs.dht.linkto -v 0x74766f6c2d636c69656e742d3100 /bricks/brick2/tvol-2/dir0/dir1/dir2/ntfile-*

12. Try to delete the directory from the mount point:

[root@myserver g1]# rm -rf *


Actual results:

[root@myserver g1]# rm -rf *
rm: cannot remove ‘dir0/dir1/dir2’: Directory not empty

Expected results:

The directory should be deleted as there are no data files inside.

Additional info:

--- Additional comment from Worker Ant on 2019-01-21 09:50:09 UTC ---

REVIEW: https://review.gluster.org/22066 (cluster/dht: Delete invalid linkto files in rmdir) posted (#1) for review on master by N Balachandran

--- Additional comment from Worker Ant on 2019-01-22 05:23:04 UTC ---

REVIEW: https://review.gluster.org/22066 (cluster/dht: Delete invalid linkto files in rmdir) merged (#2) on master by Amar Tumballi

Comment 1 Worker Ant 2019-02-01 05:14:01 UTC
REVIEW: https://review.gluster.org/22136 (cluster/dht: Delete invalid linkto files in rmdir) posted (#1) for review on release-5 by N Balachandran

Comment 2 Worker Ant 2019-02-04 14:51:38 UTC
REVIEW: https://review.gluster.org/22136 (cluster/dht: Delete invalid linkto files in rmdir) merged (#2) on release-5 by Shyamsundar Ranganathan

Comment 3 Shyamsundar 2019-03-27 13:44:07 UTC
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-5.5, please open a new bug report.

glusterfs-5.5 has been announced on the Gluster mailinglists [1], packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update infrastructure for your distribution.

[1] https://lists.gluster.org/pipermail/announce/2019-March/000119.html
[2] https://www.gluster.org/pipermail/gluster-users/