Bug 842319

Summary: getfattr fails for non-root users
Product: [Red Hat Storage] Red Hat Gluster Storage Reporter: Tim Speetjens <tspeetje>
Component: glusterfsAssignee: Amar Tumballi <amarts>
Status: CLOSED NOTABUG QA Contact: Sudhir D <sdharane>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.0CC: gluster-bugs, shaines, vbellur, vraman
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-07-25 04:44: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 Tim Speetjens 2012-07-23 13:21:22 UTC
Description of problem:
Running getattr as non-root user fails with "Operation not permitted". This happens for any attribute, including 'trusted.glusterfs.pathinfo'

Version-Release number of selected component (if applicable):
glusterfs-fuse-3.3.0-22.el6rhs.x86_64
glusterfs-3.3.0-22.el6rhs.x86_64
glusterfs-server-3.3.0-22.el6rhs.x86_64
glusterfs-rdma-3.3.0-22.el6rhs.x86_64
glusterfs-geo-replication-3.3.0-22.el6rhs.x86_64

How reproducible:
100%
mount a gluster filesystem at /gluster/volume1
run through the steps, outlined next


Steps to Reproduce:
  # cd /gluster/volume1
  # touch testfile
  # chmod 644 testfile
  # setfattr -n trusted.testattr -v testvalue testfile
  # getfattr -n trusted.testattr testfile
# file: testfile
trusted.testattr="testvalue"
  # su - hadoop
  $ cd /gluster/volume1
  $ getfattr -n trusted.testattr testfile
testfile: trusted.testattr: Operation not permitted
  
Actual results:
fails with: Operation not permitted, and RC=1

Expected results:
should display attribute value, and exit RC=0

Additional info:

Comment 2 Amar Tumballi 2012-07-25 04:44:26 UTC
Actually, 'trusted.*' domain is reserved only for superuser in Linux. Hence getting information about 'trusted' domain key will result in failure as non-root user. Happens even on other filesystems.

only issue here is, the error below on xfs is 'ENODATA' and on glusterfs its ENOTSUP 

------ Snip ------
[root@tumballi ~]# cd /tmp/
[root@tumballi tmp]# touch abcd
[root@tumballi tmp]# chmod 0777 abcd 
[root@tumballi tmp]# setfattr -n trusted.testing -v value abcd 
[root@tumballi tmp]# getfattr -n trusted.testing abcd
# file: abcd
trusted.testing="value"

[root@tumballi tmp]# su amar -
amar@tumballi:/tmp$ getfattr -n trusted.testing abcd
abcd: trusted.testing: No such attribute
amar@tumballi:/tmp$ getfattr -d -m . abcd
# file: abcd
security.selinux="unconfined_u:object_r:user_tmp_t:s0"

amar@tumballi:/tmp$ exit
[root@tumballi tmp]# getfattr -d -m . abcd
# file: abcd
security.selinux="unconfined_u:object_r:user_tmp_t:s0"
trusted.testing="value"

[root@tumballi tmp]# 

-----