+++ 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
I have performed the following steps (as mentioned in #Description) and did NOT hit the issue on 3.12.2-45 build: 1) Create a pure distribute volume with two bricks and start it. 2) FUSE mount the volume on a client node using: # mount -t glusterfs -s <ip-address>:/<volname> /mnt/<mnt-dir> 3) On the mount point do following operations: # cd /mnt/<mnt-dir> # mkdir -p dir0/dir1/dir2 # cd dir0/dir1/dir2 # for i in {1..100}; do echo "Test file" > tfile-$i; done # for i in {1..100}; do mv tfile-$i ntfile-$i; done 4) Start remove-brick operation on the volume using: # gluster v remove-brick <vol-name> brick2 start 5) Check the remove brick status using: # gluster v remove-brick <vol-name> brick2 status 6) When the remove-brick status is shown as "complete" for all the nodes, stop the remove-brick operation using: # gluster v remove-brick <vol-name> brick2 stop 7) Go to brick2 and perform lookup on the files. (only linkto files must be present and all should point to "vol_name-client-0") 8) Now change the linkto xattr value for every file in brick2 to point to itself (in this case "vol_name-client-1", also make sure the string is null terminated) # setfattr -n trusted.glusterfs.dht.linkto -v 0x74766f6c2d636c69656e742d3100 /bricks/brick2/<vol-brick>/dir0/dir1/dir2/ntfile-* 9) Now from the mount-point perform following operations in order to delete the directory: # cd /mnt/<mnt-dir> # rm -rf * Also covered the regression cases as mentioned in the test plan shared in #comment5 Hence moving this bug to verified.
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, 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/RHBA-2019:0658
*** Bug 1667556 has been marked as a duplicate of this bug. ***