Bug 1668989 - Unable to delete directories that contain linkto files that point to itself.
Summary: Unable to delete directories that contain linkto files that point to itself.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Gluster Storage
Classification: Red Hat Storage
Component: distribute
Version: rhgs-3.4
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: RHGS 3.4.z Batch Update 4
Assignee: Nithya Balachandran
QA Contact: Sayalee
URL:
Whiteboard:
: 1667556 (view as bug list)
Depends On: 1667804 1671611
Blocks: 1667556 1678183 1696806
TreeView+ depends on / blocked
 
Reported: 2019-01-24 04:37 UTC by Nithya Balachandran
Modified: 2022-03-13 16:50 UTC (History)
9 users (show)

Fixed In Version: glusterfs-3.12.2-41
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1667804
Environment:
Last Closed: 2019-03-27 03:43:40 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:0658 0 None None None 2019-03-27 03:44:49 UTC

Description Nithya Balachandran 2019-01-24 04:37:14 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 6 Sayalee 2019-02-26 11:45:35 UTC
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.

Comment 10 errata-xmlrpc 2019-03-27 03:43:40 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, 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

Comment 11 Nithya Balachandran 2019-05-09 06:18:24 UTC
*** Bug 1667556 has been marked as a duplicate of this bug. ***


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