Bug 1429377

Summary: [GANESHA] Files getting disappeared from V4 mount point while performing rm -rf from user not having permission to delete those files
Product: [Red Hat Storage] Red Hat Gluster Storage Reporter: Manisha Saini <msaini>
Component: nfs-ganeshaAssignee: Soumya Koduri <skoduri>
Status: CLOSED ERRATA QA Contact: Manisha Saini <msaini>
Severity: unspecified Docs Contact:
Priority: urgent    
Version: rhgs-3.2CC: amukherj, dang, ffilz, jthottan, kkeithle, mbenjamin, msaini, rcyriac, rhs-bugs, skoduri, storage-qa-internal
Target Milestone: ---   
Target Release: RHGS 3.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nfs-ganesha-2.4.1-9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-23 06:29:32 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:
Bug Depends On:    
Bug Blocks: 1351528    

Description Manisha Saini 2017-03-06 09:00:06 UTC
Description of problem:

Files are getting disappeared from mount point while performing rm -rf from user who does not have permission to delete those files

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

nfs-ganesha-gluster-2.4.1-7.el6rhs.x86_64

How reproducible:
Consistently

Steps to Reproduce:
1.Create 5 node ganesha cluster.Enable ganesha on it.
2.Create 6*2 Distributed-Replicate volume.Enable ganesha on it
3.Mount volume to client via v4.
4.Create 2 files say f1 and f2.

[root@dhcp37-192 ganesha]# touch f1
[root@dhcp37-192 ganesha]# touch f2
[root@dhcp37-192 ganesha]# ls -l
total 0
-rw-r--r--. 1 root root 0 Mar  6  2017 f1
-rw-r--r--. 1 root root 0 Mar  6  2017 f2


5.Change owner of the file 
[root@dhcp37-192 ganesha]# chown mani f1
[root@dhcp37-192 ganesha]# chown mani f2
[root@dhcp37-192 ganesha]# ls -l
total 0
-rw-r--r--. 1 mani root 0 Mar  6  2017 f1
-rw-r--r--. 1 mani root 0 Mar  6  2017 f2

6.su to another user who does not hv right to delete the files
[root@dhcp37-192 ganesha]# su mani1

7.Try removing the files
[mani1@dhcp37-192 ganesha]$ rm -rf *
rm: cannot remove ‘f1’: Permission denied
rm: cannot remove ‘f2’: Permission denied

8.Do ls on mount point.Files got disappeared from mount point but are present on bricks.

[mani1@dhcp37-192 ganesha]$ ls
f1  f2
[mani1@dhcp37-192 ganesha]$ ls
[mani1@dhcp37-192 ganesha]$ 



Actual results:
Files are getting disappeared from mount point  

Expected results:
Files should not be removed from mount point while performing rm -rf from user who doesn't hv access to delete those files.

Additional info:
Issue is observed with both MD-cache enable/disable

Comment 2 Soumya Koduri 2017-03-06 09:06:05 UTC
The issue is that mdcache is removing dirent even when unlink is unsuccessful at the sub-FSAL layer. The fix is already merged upstream -
https://review.gerrithub.io/#/c/346324/

Also Manisha,
there is another similar issue raised and fixed upstream - https://review.gerrithub.io/#/c/346241/

Could you try out the similar test case in downstream as well. We may need to pull in that patch as well.

Comment 3 Manisha Saini 2017-03-06 09:50:43 UTC
Soumya,

Tried the similar test case mentioned in patch.
That issue is not observed in downstream glusterfs-ganesha-3.8.4-16.el6rhs.x86_64

$ mkdir -p a/b/c a/d 
$ touch a/b/c/d 
$ mv a/b/c a/d 
$ rm -rf a/b 
$ find a

# find a
a
a/d
a/d/c
a/d/c/d

# ls -la a/d/c
total 8
drwxr-xr-x. 2 root root 4096 Mar  6  2017 .
drwxr-xr-x. 3 root root 4096 Mar  6  2017 ..
-rw-r--r--. 1 root root    0 Mar  6  2017 d

Comment 6 Manisha Saini 2017-03-08 09:04:16 UTC
Verified this bug on

# rpm -qa | grep ganesha
nfs-ganesha-2.4.1-9.el6rhs.x86_64
glusterfs-ganesha-3.8.4-17.el6rhs.x86_64
nfs-ganesha-gluster-2.4.1-9.el6rhs.x86_64

Steps:
1.Create 5 node ganesha cluster.Enable ganesha on it.
2.Create 6*2 Distributed-Replicate volume.Enable ganesha on it
3.Mount volume to client via v4.
4.Create 2 files say f1 and f2.

[root@dhcp37-192 ganesha]# touch f1
[root@dhcp37-192 ganesha]# touch f2
[root@dhcp37-192 ganesha]# ls -l
total 0
-rw-r--r--. 1 root root 0 Mar  8  2017 f1
-rw-r--r--. 1 root root 0 Mar  8  2017 f2



5.Change owner of the file 
[root@dhcp37-192 ganesha]# chown ms f1
[root@dhcp37-192 ganesha]# chown ms f2
[root@dhcp37-192 ganesha]# ls -l
total 0
-rw-r--r--. 1 ms root 0 Mar  8  2017 f1
-rw-r--r--. 1 ms root 0 Mar  8  2017 f2


6.su to another user who does not hv right to delete the files
[root@dhcp37-192 ganesha]# su mani1


7.Try removing the files
[mani1@dhcp37-192 ganesha]$ rm -rf *
rm: cannot remove ‘f1’: Permission denied
rm: cannot remove ‘f2’: Permission denied


8.Do ls on mount point.

[mani1@dhcp37-192 ganesha]$ ls
f1  f2
[mani1@dhcp37-192 ganesha]$ ls
f1  f2


Files are visible on mount point.
As the issue is no more observed with this build,moving this bug to verified state.

Comment 8 errata-xmlrpc 2017-03-23 06:29:32 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://rhn.redhat.com/errata/RHEA-2017-0493.html