Bug 1425697 - dht_setxattr returns EINVAL when a file is deleted during the FOP
Summary: dht_setxattr returns EINVAL when a file is deleted during the FOP
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Gluster Storage
Classification: Red Hat Storage
Component: distribute
Version: rhgs-3.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: RHGS 3.3.0
Assignee: Nithya Balachandran
QA Contact: Prasad Desala
URL:
Whiteboard:
Depends On: 1421653
Blocks: 1417147 1424915 1424921 1424925
TreeView+ depends on / blocked
 
Reported: 2017-02-22 07:07 UTC by Nithya Balachandran
Modified: 2017-09-21 04:57 UTC (History)
6 users (show)

Fixed In Version: glusterfs-3.8.4-19
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1421653
Environment:
Last Closed: 2017-09-21 04:33:25 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2774 0 normal SHIPPED_LIVE glusterfs bug fix and enhancement update 2017-09-21 08:16:29 UTC

Description Nithya Balachandran 2017-02-22 07:07:00 UTC
+++ This bug was initially created as a clone of Bug #1421653 +++

Description of problem:

dht_setxattr returns EINVAL when a file is deleted after the FOP hits dht_setxattr.



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


How reproducible:
Consistently


Steps to Reproduce:
1. Create a dist-rep volume (I used a 4x2)
2. Fuse mount the volume on 2 different mount points (/mnt/g1 and /mnt/g2)
3. gdb into the mount process for /mnt/g2 and set a breakpoint on dht_setxattr
4. From /mnt/g1, touch file1
5. From /mnt/g2, set an xattr on file1. This will hit the breakpoint set in (3)
6. From /mnt/g1, rm file1
7. Continue in gdb


Actual results:
[root@rhgs313-6 g2]# setfattr -n trusted.test.yahh -v "testing 1 2 3..." file1 
setfattr: file1: Invalid argument



Expected results:
[root@rhgs313-6 g2]# setfattr -n trusted.test.yahh -v "testing 1 2 3..." file1
setfattr: file1: No such file or directory


Additional info:

The same issue shows up in dht_removexattr as well. (Repeat the test steps with the breakpoint in dht_removexattr and "setxfattr -x" )

--- Additional comment from Nithya Balachandran on 2017-02-13 06:18:29 EST ---

RCA: 

op_errno is not set to local->op_errno in dht_setxattr2 immediately after the frame check. This causes the function to unwind with op_errno set to EINVAL in case of error.

The null subvol check has also been moved to after op_errno is set to local->op_errno in dht_removexattr2 .

--- Additional comment from Worker Ant on 2017-02-13 06:22:04 EST ---

REVIEW: https://review.gluster.org/16610 (cluster/dht Correct error assignment in *xattr2 functions) posted (#1) for review on master by N Balachandran (nbalacha)

--- Additional comment from Worker Ant on 2017-02-13 06:22:49 EST ---

REVIEW: https://review.gluster.org/16610 (cluster/dht Fix error assignment in dht_*xattr2 functions) posted (#2) for review on master by N Balachandran (nbalacha)

--- Additional comment from Worker Ant on 2017-02-15 20:53:52 EST ---

COMMIT: https://review.gluster.org/16610 committed in master by Shyamsundar Ranganathan (srangana) 
------
commit 028626a86ea409f908783b9007c02877f20be43e
Author: N Balachandran <nbalacha>
Date:   Mon Feb 13 16:49:06 2017 +0530

    cluster/dht Fix error assignment in dht_*xattr2 functions
    
    Corrected the op_errno assignments and NULL checks in
    the dht_sexattr2 and dht_removexattr2 functions. Earlier,
    they unwound with the default EINVAL op_errno if the
    file had been deleted.
    
    Change-Id: Iaf837a473d769cea40132487a966c7f452990071
    BUG: 1421653
    Signed-off-by: N Balachandran <nbalacha>
    Reviewed-on: https://review.gluster.org/16610
    Smoke: Gluster Build System <jenkins.org>
    NetBSD-regression: NetBSD Build System <jenkins.org>
    CentOS-regression: Gluster Build System <jenkins.org>
    Reviewed-by: MOHIT AGRAWAL <moagrawa>
    Reviewed-by: Shyamsundar Ranganathan <srangana>

Comment 5 Atin Mukherjee 2017-03-24 09:48:27 UTC
downstream patch : https://code.engineering.redhat.com/gerrit/#/c/101316/

Comment 7 Prasad Desala 2017-05-03 10:27:31 UTC
Verified this BZ on glusterfs version 3.8.4-24.el7rhgs.x86_64.

Followed the same steps as in the description, after the fix dht_setxattr and dht_removexattr returns ENOENT when the file is deleted.

Output console snips:
=====================
Set xattr:
==========
[root@dhcp tmp_fuse]# setfattr -n trusted.test.sample1 -v "testing" block 
setfattr: block: No such file or directory
[root@dhcp tmp_fuse]# setfattr -n trusted.test.sample1 -v "testing" char
setfattr: char: No such file or directory
[root@dhcp tmp_fuse]# setfattr -n trusted.test.sample1 -v "testing" vitest
setfattr: vitest: No such file or directory
[root@dhcp tmp_fuse]# setfattr -n trusted.test.sample1 -v "testing" pipefile 
setfattr: pipefile: No such file or directory
[root@dhcp tmp_fuse]# setfattr -n trusted.test.sample1 -v "testing" zero 
setfattr: zero: No such file or directory
[root@dhcp tmp_fuse]# setfattr -n trusted.test.sample1 -v "testing" dir_test
setfattr: dir_test: No such file or directory

Remove xattr:
=============
[root@dhcp tmp_fuse]# setfattr -x trusted.test.sample1 char
setfattr: char: No such file or directory
[root@dhcp tmp_fuse]# setfattr -x trusted.test.sample1 pipefile 
setfattr: pipefile: No such file or directory
[root@dhcp tmp_fuse]# setfattr -x trusted.test.sample1 zero 
setfattr: zero: No such file or directory

Comment 9 errata-xmlrpc 2017-09-21 04:33:25 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-2017:2774

Comment 10 errata-xmlrpc 2017-09-21 04:57:48 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-2017:2774


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