From 42c12a784d3acdb135eaf69d0589f9b6ddc277f3 Mon Sep 17 00:00:00 2001
From: Ashish Pandey <aspandey@redhat.com>
Date: Tue, 8 Sep 2015 12:27:50 +0530
Subject: [PATCH 323/330] features/snap : cleanup the root loc in statfs
Problem : In svc_statfs function, wipe_loc is getting called on loc
passed by nfs. This loc is being used by svc_stat which
throws erro if loc->inode is NULL.
Solution : wipe_loc should be called on local root_loc.
Patch for upstream -
http://review.gluster.org/#/c/12123/
Patch for downstream -
http://review.gluster.org/#/c/12147/
Change-Id: I9cc5ee3b1bd9f352f2362a6d997b7b09051c0f68
BUG: 1257509
Signed-off-by: Ashish Pandey <aspandey@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/57439
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
---
tests/bugs/snapshot/bug-1260848.t | 25 ++++++++++++++++++++
.../features/snapview-client/src/snapview-client.c | 2 +-
2 files changed, 26 insertions(+), 1 deletions(-)
create mode 100644 tests/bugs/snapshot/bug-1260848.t
diff --git a/tests/bugs/snapshot/bug-1260848.t b/tests/bugs/snapshot/bug-1260848.t
new file mode 100644
index 0000000..9963b29
--- /dev/null
+++ b/tests/bugs/snapshot/bug-1260848.t
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../nfs.rc
+. $(dirname $0)/../../volume.rc
+
+cleanup;
+
+## Start and create a volume
+TEST glusterd
+TEST pidof glusterd
+
+TEST $CLI volume create $V0 disperse 6 redundancy 2 $H0:$B0/${V0}{0..5}
+TEST $CLI volume set $V0 uss on
+TEST $CLI volume start $V0
+
+## Wait for volume to register with rpc.mountd
+EXPECT_WITHIN $NFS_EXPORT_TIMEOUT "1" is_nfs_export_available;
+
+## Mount NFS
+TEST mount_nfs $H0:/$V0 $N0 nolock;
+
+TEST df -h $N0
+
+cleanup;
diff --git a/xlators/features/snapview-client/src/snapview-client.c b/xlators/features/snapview-client/src/snapview-client.c
index b3f1a92..e784ff6 100644
--- a/xlators/features/snapview-client/src/snapview-client.c
+++ b/xlators/features/snapview-client/src/snapview-client.c
@@ -546,7 +546,7 @@ svc_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc,
STACK_WIND_TAIL (frame, subvolume, subvolume->fops->statfs,
temp_loc, xdata);
- if (temp_loc)
+ if (temp_loc == &root_loc)
loc_wipe (temp_loc);
wind = _gf_true;
--
1.7.1