Blob Blame History Raw
From 05926a815a7df19c732d1ab7ea2ef3b36632038f Mon Sep 17 00:00:00 2001
From: Jiffin Tony Thottan <jthottan@redhat.com>
Date: Mon, 7 Sep 2015 16:46:48 +0530
Subject: [PATCH 322/330] uss : handle `buf` variable properly in svs_glfs_readdir()

The svs_glfs_readdir() is a generic function which is called from
svs_readdir() and svs_readdirp(). But in svs_readdir 'buf' variable
is passed as NULL, then glfs_read_readdir() will fail. This patch
will fix the same.

It is backport of http://review.gluster.org/12117

Upstream Reference:
> Change-Id: Id02e4e17e30c85de117db5ddd9f97b578622dff9
> BUG: 1260611
> Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
> cherry-picked as 7b6183c36ebfe020b724c95b018a8cd535e1ecdd

Change-Id: I22628fdf3267e9366a5aa0df2b7984c0e6318819
BUG: 1260086
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/57343
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Niels de Vos <ndevos@redhat.com>
---
 .../features/snapview-server/src/snapview-server.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/xlators/features/snapview-server/src/snapview-server.c b/xlators/features/snapview-server/src/snapview-server.c
index 5ae9625..ed30cb8 100644
--- a/xlators/features/snapview-server/src/snapview-server.c
+++ b/xlators/features/snapview-server/src/snapview-server.c
@@ -1246,7 +1246,6 @@ svs_glfs_readdir (xlator_t *this, glfs_fd_t *glfd, gf_dirent_t *entries,
         GF_VALIDATE_OR_GOTO ("svs", this, out);
         GF_VALIDATE_OR_GOTO (this->name, glfd, out);
         GF_VALIDATE_OR_GOTO (this->name, entries, out);
-        GF_VALIDATE_OR_GOTO (this->name, buf, out);
 
         while (filled_size < size) {
                 in_case = glfs_telldir (glfd);
@@ -1287,9 +1286,10 @@ svs_glfs_readdir (xlator_t *this, glfs_fd_t *glfd, gf_dirent_t *entries,
                         entry->d_off = glfs_telldir (glfd);
                         entry->d_ino = de.d_ino;
                         entry->d_type = de.d_type;
-                        iatt_from_stat (buf, &statbuf);
-                        if (readdirplus)
+                        if (readdirplus) {
+                                iatt_from_stat (buf, &statbuf);
                                 entry->d_stat = *buf;
+                        }
                         list_add_tail (&entry->list, &entries->list);
 
                         filled_size += this_size;
-- 
1.7.1