cb8e9e
From 05926a815a7df19c732d1ab7ea2ef3b36632038f Mon Sep 17 00:00:00 2001
cb8e9e
From: Jiffin Tony Thottan <jthottan@redhat.com>
cb8e9e
Date: Mon, 7 Sep 2015 16:46:48 +0530
cb8e9e
Subject: [PATCH 322/330] uss : handle `buf` variable properly in svs_glfs_readdir()
cb8e9e
cb8e9e
The svs_glfs_readdir() is a generic function which is called from
cb8e9e
svs_readdir() and svs_readdirp(). But in svs_readdir 'buf' variable
cb8e9e
is passed as NULL, then glfs_read_readdir() will fail. This patch
cb8e9e
will fix the same.
cb8e9e
cb8e9e
It is backport of http://review.gluster.org/12117
cb8e9e
cb8e9e
Upstream Reference:
cb8e9e
> Change-Id: Id02e4e17e30c85de117db5ddd9f97b578622dff9
cb8e9e
> BUG: 1260611
cb8e9e
> Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
cb8e9e
> cherry-picked as 7b6183c36ebfe020b724c95b018a8cd535e1ecdd
cb8e9e
cb8e9e
Change-Id: I22628fdf3267e9366a5aa0df2b7984c0e6318819
cb8e9e
BUG: 1260086
cb8e9e
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/57343
cb8e9e
Reviewed-by: Niels de Vos <ndevos@redhat.com>
cb8e9e
Tested-by: Niels de Vos <ndevos@redhat.com>
cb8e9e
---
cb8e9e
 .../features/snapview-server/src/snapview-server.c |    6 +++---
cb8e9e
 1 files changed, 3 insertions(+), 3 deletions(-)
cb8e9e
cb8e9e
diff --git a/xlators/features/snapview-server/src/snapview-server.c b/xlators/features/snapview-server/src/snapview-server.c
cb8e9e
index 5ae9625..ed30cb8 100644
cb8e9e
--- a/xlators/features/snapview-server/src/snapview-server.c
cb8e9e
+++ b/xlators/features/snapview-server/src/snapview-server.c
cb8e9e
@@ -1246,7 +1246,6 @@ svs_glfs_readdir (xlator_t *this, glfs_fd_t *glfd, gf_dirent_t *entries,
cb8e9e
         GF_VALIDATE_OR_GOTO ("svs", this, out);
cb8e9e
         GF_VALIDATE_OR_GOTO (this->name, glfd, out);
cb8e9e
         GF_VALIDATE_OR_GOTO (this->name, entries, out);
cb8e9e
-        GF_VALIDATE_OR_GOTO (this->name, buf, out);
cb8e9e
 
cb8e9e
         while (filled_size < size) {
cb8e9e
                 in_case = glfs_telldir (glfd);
cb8e9e
@@ -1287,9 +1286,10 @@ svs_glfs_readdir (xlator_t *this, glfs_fd_t *glfd, gf_dirent_t *entries,
cb8e9e
                         entry->d_off = glfs_telldir (glfd);
cb8e9e
                         entry->d_ino = de.d_ino;
cb8e9e
                         entry->d_type = de.d_type;
cb8e9e
-                        iatt_from_stat (buf, &statbuf);
cb8e9e
-                        if (readdirplus)
cb8e9e
+                        if (readdirplus) {
cb8e9e
+                                iatt_from_stat (buf, &statbuf);
cb8e9e
                                 entry->d_stat = *buf;
cb8e9e
+                        }
cb8e9e
                         list_add_tail (&entry->list, &entries->list);
cb8e9e
 
cb8e9e
                         filled_size += this_size;
cb8e9e
-- 
cb8e9e
1.7.1
cb8e9e