Bug 1104954

Summary: Dist-geo-rep : geo-rep doesn't preserve the ownership while syncing entry operations to slave through mount-broker.
Product: [Community] GlusterFS Reporter: Aravinda VK <avishwan>
Component: geo-replicationAssignee: Aravinda VK <avishwan>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: mainlineCC: aavati, csaba, cww, david.macdonald, gluster-bugs, nlevinki, nsathyan, ssamanta, vagarwal, vshankar
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: glusterfs-3.7.0beta1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1104061
: 1159213 (view as bug list) Environment:
Last Closed: 2015-05-18 10:47:05 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: 1104061    
Bug Blocks: 1159213    

Comment 1 Anand Avati 2014-06-05 05:48:03 UTC
REVIEW: http://review.gluster.org/7984 (geo-rep: gid is not set in entry ops) posted (#1) for review on master by Aravinda VK (avishwan)

Comment 2 Anand Avati 2014-10-21 10:30:48 UTC
REVIEW: http://review.gluster.org/8959 (feature/gfid-access: Storing correct uid/gid in frame->root.) posted (#1) for review on master by ajeet jha (ajha)

Comment 3 Anand Avati 2014-10-22 07:05:35 UTC
REVIEW: http://review.gluster.org/8964 (feature/changelog: Fix changelog missing a SETATTR entries.) posted (#1) for review on master by Kotresh HR (khiremat)

Comment 4 Anand Avati 2014-10-22 07:29:30 UTC
REVIEW: http://review.gluster.org/8959 (feature/gfid-access: Storing correct uid/gid in frame->root.) posted (#2) for review on master by Aravinda VK (avishwan)

Comment 5 Anand Avati 2014-10-22 10:23:11 UTC
REVIEW: http://review.gluster.org/8964 (feature/changelog: Fix changelog missing a SETATTR entries.) posted (#2) for review on master by Kotresh HR (khiremat)

Comment 6 Anand Avati 2014-10-27 08:47:03 UTC
REVIEW: http://review.gluster.org/8964 (feature/changelog: Fix changelog missing a SETATTR entries.) posted (#3) for review on master by Kotresh HR (khiremat)

Comment 7 Anand Avati 2014-10-28 06:45:47 UTC
REVIEW: http://review.gluster.org/8964 (feature/changelog: Fix changelog missing a SETATTR entries.) posted (#4) for review on master by Kotresh HR (khiremat)

Comment 8 Anand Avati 2014-10-28 06:51:01 UTC
REVIEW: http://review.gluster.org/8964 (feature/changelog: Fix changelog missing SETATTR entries.) posted (#5) for review on master by Kotresh HR (khiremat)

Comment 9 Anand Avati 2014-10-28 07:21:08 UTC
REVIEW: http://review.gluster.org/8964 (feature/changelog: Fix changelog missing SETATTR entries.) posted (#6) for review on master by Kotresh HR (khiremat)

Comment 10 Anand Avati 2014-10-28 08:39:02 UTC
REVIEW: http://review.gluster.org/8964 (feature/changelog: Fix changelog missing SETATTR entries.) posted (#7) for review on master by Kotresh HR (khiremat)

Comment 11 Anand Avati 2014-10-28 12:46:33 UTC
COMMIT: http://review.gluster.org/7984 committed in master by Venky Shankar (vshankar) 
------
commit 3993728390cc50390a527f5f01d6dcf3e6293110
Author: Aravinda VK <avishwan>
Date:   Thu Jun 5 11:12:22 2014 +0530

    geo-rep: gid is not set in entry ops
    
    uid is sent in place of gid while CREATE and
    MKDIR.
    
    Change-Id: Icd1072cb9dcbfc1f419a3cdd456f3d02168175fa
    BUG: 1104954
    Signed-off-by: Aravinda VK <avishwan>
    Reviewed-on: http://review.gluster.org/7984
    Tested-by: Gluster Build System <jenkins.com>
    Reviewed-by: Kotresh HR <khiremat>
    Reviewed-by: Venky Shankar <vshankar>
    Tested-by: Venky Shankar <vshankar>

Comment 12 Anand Avati 2014-10-29 08:54:16 UTC
COMMIT: http://review.gluster.org/8964 committed in master by Venky Shankar (vshankar) 
------
commit 5ae0df29b4e590d9a8a5f3c8f9e98cc944b006cf
Author: Kotresh HR <khiremat>
Date:   Wed Oct 22 12:09:01 2014 +0530

    feature/changelog: Fix changelog missing SETATTR entries.
    
    Problem: Valid SETATTR entries are missing in changelog when more
             than one metadata operation happen on same inode within
             changelog roll-over time.
    
    Cause: Metadata entries with fop num being GF_FOP_NULL are logged
           in changelog which is of no use. Since slice version
           checking is done for metadata entries to avoid logging of
           subsequent entries of same inode falling into same
           changelog, if the entry with GF_FOP_NULL is logged first,
           subsequent valid ones will be missed.
    
    Solution: Have a boundary condition to log only those fops whose fop
              number falls between GF_FOP_NULL and GF_FOP_MAXVALUE.
    
    Change-Id: Iff585ea573ac5e521a361541c6646225943f0b2d
    BUG: 1104954
    Signed-off-by: Kotresh HR <khiremat>
    Reviewed-on: http://review.gluster.org/8964
    Reviewed-by: Aravinda VK <avishwan>
    Tested-by: Gluster Build System <jenkins.com>
    Reviewed-by: Venky Shankar <vshankar>
    Tested-by: Venky Shankar <vshankar>

Comment 13 Aravinda VK 2014-10-30 11:09:09 UTC
Patches:
http://review.gluster.org/#/c/7984/
http://review.gluster.org/#/c/8964/

With these three patches, I tested following cases and worked as expected.

gvm - Master volume
gvs - Slave volume
/mnt/gvm - Master mount
/mnt/gvs - Slave mount

Case 1:
=======
cd /mnt/gvm
touch f1

ls -l /mnt/gvm
-rw-r--r-- 1 root     root      0 Oct 22 16:04 f1

ls -l /mnt/gvm
-rw-r--r-- 1 root     root      0 Oct 22 16:05 f1


Case 2:
=======
cd /mnt/gvm
mkdir dir1
chown -R aravinda dir1
su aravinda
cd /mnt/gvm/dir1
touch dir1_f1

ls -l /mnt/gvm/dir1
-rw-rw-r-- 1 aravinda aravinda 0 Oct 22 16:07 dir1_f1

ls -l /mnt/gvs/dir1
-rw-rw-r-- 1 aravinda aravinda 0 Oct 22 16:07 dir1_f1

Case 3:
=======
cp -p /etc/motd /mnt/gvm/

ls -l /mnt/gvm/
-rw-r--r-- 1 root     root      0 Jun  7  2013 motd

ls -l /mnt/gvs/
-rw-r--r-- 1 root     root      0 Oct 22 16:57 motd

Case 4:
=======
touch /tmp/tmp_f1
chmod 0400 /tmp/tmp_f1
chown aravinda.users /tmp/t_f1
cp -p /tmp/t_f1 /mnt/gvm/

ls -l /mnt/gvm/
-r-------- 1 aravinda  users     0 Oct 22 16:59 t_f1

ls -l /mnt/gvs/
-r-------- 1 aravinda  users     0 Oct 22 17:02 t_f1

Comment 14 Anand Avati 2014-11-05 07:30:58 UTC
REVIEW: http://review.gluster.org/9051 (feature/gfid-access: Always send setattr down in overloaded setxattr.) posted (#1) for review on master by Kotresh HR (khiremat)

Comment 15 Anand Avati 2014-11-07 09:02:17 UTC
COMMIT: http://review.gluster.org/9051 committed in master by Venky Shankar (vshankar) 
------
commit a3252b9d8c4cc024b5528ca88076c7e33aecad38
Author: Kotresh HR <khiremat>
Date:   Wed Nov 5 12:36:32 2014 +0530

    feature/gfid-access: Always send setattr down in overloaded setxattr.
    
    Problem: File ownership is not being preserved for root in geo-rep
             mountbroker setup.
    
    Analysis and Cause:
             Entry creations for geo-rep is overloaded in ga_setxattr.
             It happens in two phase, entry creation followed by setattr
             to preserve ownership as in master.
    
             If uid and gid of file being synced is root, setattr was
             not being sent down. Since, the file creation happens with
             non-root user in mountborker geo-rep setup, if setattr is
             not done explicitly, file ownership is not preserved for root.
    
    Solution:
             Always pass setattr down in overloaded ga_setxattr.
    
    Change-Id: I062215c1b2379d515f28ec7f271077ad37182c7e
    BUG: 1104954
    Signed-off-by: Kotresh HR <khiremat>
    Reviewed-on: http://review.gluster.org/9051
    Reviewed-by: Aravinda VK <avishwan>
    Tested-by: Gluster Build System <jenkins.com>
    Reviewed-by: Venky Shankar <vshankar>
    Tested-by: Venky Shankar <vshankar>

Comment 16 Aravinda VK 2014-12-29 04:48:35 UTC
*** Bug 1024467 has been marked as a duplicate of this bug. ***

Comment 17 Aravinda VK 2014-12-29 05:35:00 UTC
*** Bug 1146263 has been marked as a duplicate of this bug. ***

Comment 18 Aravinda VK 2015-05-18 10:47:05 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.