3604df
From 33d978b79396c909033f218171c0abb9f26224e0 Mon Sep 17 00:00:00 2001
3604df
From: Poornima G <pgurusid@redhat.com>
3604df
Date: Fri, 11 Nov 2016 12:08:57 +0530
3604df
Subject: [PATCH 177/206] marker: Fix inode value in loc, in setxattr fop
3604df
3604df
Backport of http://review.gluster.org/15826
3604df
3604df
On recieving a rename fop, marker_rename() stores the,
3604df
oldloc and newloc in its 'local' struct, once the rename
3604df
is done, the xtime marker(last updated time) is set on
3604df
the file, but sending a setxattr fop. When upcall
3604df
receives the setxattr fop, the loc->inode is NULL and
3604df
it crashes. The loc->inode can be NULL only in one valid
3604df
case, i.e. in rename case where the inode of new loc
3604df
can be NULL. Hence, marker should have filled the inode
3604df
of the new_loc before issuing a setxattr.
3604df
3604df
Change-Id: Id638f678c3daaf4a5c29b970b58929d377ae8977
3604df
BUG: 1387204
3604df
Signed-off-by: Poornima G <pgurusid@redhat.com>
3604df
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
3604df
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
3604df
Reviewed-by: Kotresh HR <khiremat@redhat.com>
3604df
Smoke: Gluster Build System <jenkins@build.gluster.org>
3604df
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
3604df
Signed-off-by: Poornima G <pgurusid@redhat.com>
3604df
Reviewed-on: https://code.engineering.redhat.com/gerrit/90548
3604df
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
3604df
Tested-by: Atin Mukherjee <amukherj@redhat.com>
3604df
---
3604df
 tests/bugs/upcall/bug-1394131.t      | 29 +++++++++++++++++++++++++++++
3604df
 xlators/features/marker/src/marker.c |  2 ++
3604df
 2 files changed, 31 insertions(+)
3604df
 create mode 100755 tests/bugs/upcall/bug-1394131.t
3604df
3604df
diff --git a/tests/bugs/upcall/bug-1394131.t b/tests/bugs/upcall/bug-1394131.t
3604df
new file mode 100755
3604df
index 0000000..b371ce4
3604df
--- /dev/null
3604df
+++ b/tests/bugs/upcall/bug-1394131.t
3604df
@@ -0,0 +1,29 @@
3604df
+#!/bin/bash
3604df
+
3604df
+. $(dirname $0)/../../include.rc
3604df
+. $(dirname $0)/../../volume.rc
3604df
+
3604df
+cleanup;
3604df
+
3604df
+## 1. Start glusterd
3604df
+TEST glusterd;
3604df
+
3604df
+## 2. Lets create volume
3604df
+TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2,3};
3604df
+
3604df
+## 3. Enable the upcall xlator, and increase the md-cache timeout to max
3604df
+TEST $CLI volume set $V0 features.cache-invalidation on
3604df
+TEST $CLI volume set $V0 features.cache-invalidation-timeout 600
3604df
+TEST $CLI volume set $V0 indexing on
3604df
+
3604df
+## 6. Start the volume
3604df
+TEST $CLI volume start $V0
3604df
+
3604df
+## 7. Create two gluster mounts
3604df
+TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0
3604df
+
3604df
+## 8. Create directory and files from the M0
3604df
+TEST touch $M0/file1
3604df
+TEST mv $M0/file1 $M0/file2
3604df
+
3604df
+cleanup;
3604df
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c
3604df
index e0e7c98..f578f6c 100644
3604df
--- a/xlators/features/marker/src/marker.c
3604df
+++ b/xlators/features/marker/src/marker.c
3604df
@@ -1492,6 +1492,8 @@ marker_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
3604df
 
3604df
                 if (priv->feature_enabled & GF_XTIME) {
3604df
                         //update marks on oldpath
3604df
+                        if (!local->loc.inode)
3604df
+                                local->loc.inode = inode_ref (oplocal->loc.inode);
3604df
                         gf_uuid_copy (local->loc.gfid, oplocal->loc.inode->gfid);
3604df
                         marker_xtime_update_marks (this, oplocal);
3604df
                         marker_xtime_update_marks (this, local);
3604df
-- 
3604df
2.9.3
3604df