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