Bug 1122028

Summary: Unlink fails on files having no trusted.pgfid.<gfid> xattr when linkcount>1 and build-pgfid is turned on.
Product: [Community] GlusterFS Reporter: Prashanth Pai <ppai>
Component: posixAssignee: Prashanth Pai <ppai>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: mainlineCC: gluster-bugs
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: glusterfs-3.7.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-05-14 17:26:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Prashanth Pai 2014-07-22 11:57:03 UTC
Description of problem:
File not deletable. Unlinks fail.

Version-Release number of selected component (if applicable):
glusterfs upstream master source

How reproducible:
Can be reproduced only when these three conditions are met:
1. File must not have trusted.pgfid.<gfid> xattr set. This won't be set when build-pgfid is off (default).
2. File must have a hardlink count > 1
3. "build-pgfid" option must be turned on (either manually or by quota)

My setup:
[root@vm1 dir]# gluster v i
 
Volume Name: test
Type: Distribute
Volume ID: 4efeaf5d-79ac-4e9b-994c-05dbe1d0cffa
Status: Started
Number of Bricks: 1
Transport-type: tcp
Bricks:
Brick1: vm1:/mnt/brick-test/b
Options Reconfigured:
diagnostics.brick-log-level: DEBUG
auto-delete: disable
snap-max-soft-limit: 90
snap-max-hard-limit: 256

Steps to Reproduce:
1. mount -t glusterfs  vm1:test /mnt/testvol
2. cd /mnt/testvol; mkdir dir; cd dir
3. touch a
4. ln a b
5. gluster volume set test build-pgfid on
6. rm -f ./a

Actual results:
[root@vm1 dir]# rm -f ./a 
rm: cannot remove ‘./a’: No data available

[root@vm1 dir]# unlink ./a 
unlink: cannot unlink ‘./a’: No data available
[root@vm1 dir]# 

Expected results:
File successfully deleted.

Brick logs:
[2014-07-22 11:52:03.927827] D [io-threads.c:351:iot_schedule] 0-test-io-threads: UNLINK scheduled as normal fop
[2014-07-22 11:52:03.927938] W [posix.c:1455:posix_unlink] 0-test-posix: getting xattr failed on /mnt/brick-test/b/dir/a: key = trusted.pgfid.620dfcbc-0dba-4c63-bc22-7f3e60edce15 (No data available)
[2014-07-22 11:52:03.927985] W [posix.c:1463:posix_unlink] 0-test-posix: modification of parent gfid xattr failed (path:/mnt/brick-test/b/dir/a gfid:7357b71f-5b4b-40a2-9bd2-a6388a52011e)
[2014-07-22 11:52:03.928033] E [server-rpc-fops.c:1077:server_unlink_cbk] 0-test-server: 67: UNLINK /dir/a (620dfcbc-0dba-4c63-bc22-7f3e60edce15/a) ==> (No data available)


Additional info:
Based on pure _speculation_, this is the patch that introduces the feature (and bug): http://review.gluster.org/5951 
The code snippet _likely_ causing the bug (line nos. may have changed):
https://github.com/gluster/glusterfs/blob/master/xlators/storage/posix/src/posix.c#L1448-L1466

Comment 1 Anand Avati 2014-07-23 05:39:44 UTC
REVIEW: http://review.gluster.org/8352 (posix: Fix unlink failing under specific condition) posted (#2) for review on master by Prashanth Pai (ppai)

Comment 2 Anand Avati 2015-02-19 11:33:31 UTC
COMMIT: http://review.gluster.org/8352 committed in master by Raghavendra G (rgowdapp) 
------
commit 7847db9a6dc560cb0078bdfdb0ac0187e8a79443
Author: Prashanth Pai <ppai>
Date:   Tue Jul 22 18:49:44 2014 +0530

    posix: Fix unlink failing under specific condition
    
    PROBLEM:
    Files are undeletable when these three conditions are met:
    1. File does not have trusted.pgfid.<gfid> xattr set.
       This won't be set when build-pgfid is off (default).
    2. File has hardlink count > 1.
    3. build-pgfid option is turned on.
    
    FIX:
    Allow unlink on files not having trusted.pgfid.<gfid> xattr.
    
    Change-Id: I58a9d9a1b29a0cb07f4959daabbd6dd04fab2b34
    BUG: 1122028
    Signed-off-by: Prashanth Pai <ppai>
    Reviewed-on: http://review.gluster.org/8352
    Tested-by: Gluster Build System <jenkins.com>
    Reviewed-by: Raghavendra G <rgowdapp>
    Tested-by: Raghavendra G <rgowdapp>

Comment 3 Niels de Vos 2015-05-14 17:26:26 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-3.7.0, please open a new bug report.

glusterfs-3.7.0 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] http://thread.gmane.org/gmane.comp.file-systems.gluster.devel/10939
[2] http://thread.gmane.org/gmane.comp.file-systems.gluster.user

Comment 4 Niels de Vos 2015-05-14 17:35:29 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-3.7.0, please open a new bug report.

glusterfs-3.7.0 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] http://thread.gmane.org/gmane.comp.file-systems.gluster.devel/10939
[2] http://thread.gmane.org/gmane.comp.file-systems.gluster.user

Comment 5 Niels de Vos 2015-05-14 17:37:51 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-3.7.0, please open a new bug report.

glusterfs-3.7.0 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] http://thread.gmane.org/gmane.comp.file-systems.gluster.devel/10939
[2] http://thread.gmane.org/gmane.comp.file-systems.gluster.user

Comment 6 Niels de Vos 2015-05-14 17:42:42 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-3.7.0, please open a new bug report.

glusterfs-3.7.0 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] http://thread.gmane.org/gmane.comp.file-systems.gluster.devel/10939
[2] http://thread.gmane.org/gmane.comp.file-systems.gluster.user