Bug 1051896 - setfacl with "invalid argument" will return 0, not return EINVAL in glusterfs
Summary: setfacl with "invalid argument" will return 0, not return EINVAL in glusterfs
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: access-control
Version: mainline
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Vijay Bellur
QA Contact:
URL:
Whiteboard:
Depends On: 1039631
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-12 17:47 UTC by Vijay Bellur
Modified: 2014-11-19 06:59 UTC (History)
7 users (show)

Fixed In Version: glusterfs-3.6.0beta1
Doc Type: Bug Fix
Doc Text:
Clone Of: 1039631
Environment:
Last Closed: 2014-11-11 08:26:52 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description Vijay Bellur 2014-01-12 17:47:35 UTC
+++ This bug was initially created as a clone of Bug #1039631 +++

Description of problem:
When send invalid argument to setfacl, it should return EINVAL. But in glusterfs, it return 0.


Version-Release number of selected component (if applicable):
The gluster server:
1, build two gluster servers(ser0 and ser1) by use rhel-x86_64-server-6-rhs-2.1 channel in RHEL-6.4.
2, create bricks on ser0 and ser1, the bricks dir created on xfs filesystem.
3, create a gv0 volume by the above bricks, and start it.
----
[root@dhcp12-143 ~]# gluster volume info
 
Volume Name: gv0
Type: Distribute
Volume ID: 1a960657-bff3-43f2-b1a3-c6baf41d88ca
Status: Started
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: 10.66.86.68:/data/gluster/brick
Brick2: 10.66.12.143:/data/gluster/brick
----




How reproducible:
I find this problem by run posix compliance test,you can get the upstream source by:
git clone git://git.code.sf.net/p/ntfs-3g/pjd-fstest

Then mount the glusterfs by run:
mount -t glusterfs 10.66.86.68:/gv0 /mnt -o attribute-timeout=0,entry-timeout=0,acl

Then run the posix test:
prove ntfs-3g-pjd-fstest/tests/xacl/06.t

The failure messages:
ntfs-3g-pjd-fstest/tests/xacl/06.t (Wstat: 0 Tests: 42 Failed: 1)
  Failed test:  15

This mean this line run failed:
expect EINVAL setfacl ${d0}/${n1} m 'u::r,u::w,g::r--,o::r--'

There is no setfacl system call in linux, in posix compliance test the setfacl test is acl_set_file() test. Please refer to do_setfacl() function in ntfs-3g-pjd-fstest/fstest.c.

If you just use the setfacl command, you can't trigger this problem. So for test simply, I write a simple program which use acl_set_file() function.
If you don't want to use posix compliance test, you can use the program(setfacl_test.c) which I submit it in the attachment.

You can do the test like below:

Steps to Reproduce:
1. mount -t glusterfs 10.66.86.68:/gv0 /mnt -o attribute-timeout=0,acl

If you want to use the posix test:
2. cd /mnt; git clone git://git.code.sf.net/p/ntfs-3g/pjd-fstest
3. cd ntfs-3g-pjd-fstest/; make (maybe you need some build dependent packages)
4. prove ntfs-3g-pjd-fstest/tests/xacl/06.t

If you want to use the program which I submit to the attachment:
2. cd /mnt; wget the program
3. gcc -o setfacl_test setfacl_test -lacl (maybe you need libacl-devel and libacl packages)
4. touch foo
5. ./setfacl foo m 'u::r,u::w,g::r--,o::r--'
6. echo $?


Actual results:
If you use posix test:
Step#4 will get:
ntfs-3g-pjd-fstest/tests/xacl/06.t (Wstat: 0 Tests: 42 Failed: 1)
  Failed test:  15

If you use my program to test:
Step#5 will get nothing
Step#6 will get 0.



Expected results:
If you use posix test:
Step#4 will get:
ntfs-3g-pjd-fstest/tests/xacl/06.t .. ok     
All tests successful.

If you use my program to test:
Step#5 will get "do_setfacl failed: Invalid request code"
Step#6 will get 200. (I get 200 When I test, maybe different kernel will get different number for EINVAL, but it never be 0).



Additional info:

The xfs test successed.

--- Additional comment from Zorro Lang on 2013-12-09 11:31:03 EST ---

Notice that this bug can't be tested by setfacl command, you need to use acl_set_file function. So you can use posix-compliance-test or use the attachment "set acl test program".

Comment 1 Anand Avati 2014-01-12 18:00:18 UTC
REVIEW: http://review.gluster.org/6684 (storage/posix: UNWIND right op_error and op_errno in *setxattr()) posted (#1) for review on master by Vijay Bellur (vbellur)

Comment 2 Anand Avati 2014-01-14 08:24:07 UTC
COMMIT: http://review.gluster.org/6684 committed in master by Anand Avati (avati) 
------
commit 3af42583dd804371952d61e9d7ff4c640e67ba0d
Author: Vijay Bellur <vbellur>
Date:   Sun Jan 12 22:39:14 2014 +0530

    storage/posix: UNWIND right op_error and op_errno in *setxattr()
    
    1. errno was being set after gf_log() in posix_{f}handle_pair, this
    would cause errno to be overwritten.
    
    2. dht would expect -1 for indication of failure in setxattr
    callback (dht_err_cbk()). posix_{f}setxattr has been changed to set
    op_ret as -1 instead of -op_errno.
    
    3. dict_foreach() has been changed to return an error if the invoked
    fn() returns < 0.
    
    Bug report and test case credits to Zorro Lang <zlang>
    
    Change-Id: I96c15f12a5d7717b7584ba392f390a0b4f704a98
    BUG: 1051896
    Signed-off-by: Vijay Bellur <vbellur>
    Reviewed-on: http://review.gluster.org/6684
    Tested-by: Gluster Build System <jenkins.com>
    Reviewed-by: Niels de Vos <ndevos>
    Reviewed-by: Anand Avati <avati>

Comment 3 Niels de Vos 2014-09-22 12:34:55 UTC
A beta release for GlusterFS 3.6.0 has been released. Please verify if the release solves this bug report for you. In case the glusterfs-3.6.0beta1 release does not have a resolution for this issue, leave a comment in this bug and move the status to ASSIGNED. If this release fixes the problem for you, leave a note and change the status to VERIFIED.

Packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update (possibly an "updates-testing" repository) infrastructure for your distribution.

[1] http://supercolony.gluster.org/pipermail/gluster-users/2014-September/018836.html
[2] http://supercolony.gluster.org/pipermail/gluster-users/

Comment 4 Niels de Vos 2014-11-11 08:26:52 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.6.1, please reopen this bug report.

glusterfs-3.6.1 has been announced [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://supercolony.gluster.org/pipermail/gluster-users/2014-November/019410.html
[2] http://supercolony.gluster.org/mailman/listinfo/gluster-users

Comment 5 Zorro Lang 2014-11-19 06:59:46 UTC
I just tested on glusterfs-3.6.1-1 (upstream):
http://download.gluster.org/pub/gluster/glusterfs/3.6/3.6.1/RHEL/epel-6.6/x86_64/

pjd-fstest xacl/06.t all pass.


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