summaryrefslogtreecommitdiffstats
path: root/xlators/storage
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2010-08-25 01:40:00 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-08-25 00:41:58 -0700
commitfb0bb972dfac3c255c53ddc7b588b73a08883288 (patch)
treea608564fef9a0a7a43ce99359b3f7e16d45fb2f1 /xlators/storage
parent36ae62ada88b8477994d17527868370a4634999e (diff)
storage/posix: calculate the correct size of each dirent in readdir/readdirp.
- In addition to posix, protocol/server also adds a check to make sure that iobuf allocated to hold readdir/readdirp response can hold all the dentries, rpc and proc (readdir/readdirp) header. Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1430 (encoding of readdirp response fails occasionally) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1430
Diffstat (limited to 'xlators/storage')
-rw-r--r--xlators/storage/posix/src/Makefile.am8
-rw-r--r--xlators/storage/posix/src/posix.c5
2 files changed, 8 insertions, 5 deletions
diff --git a/xlators/storage/posix/src/Makefile.am b/xlators/storage/posix/src/Makefile.am
index 0fdcfdcec..b8d1668ae 100644
--- a/xlators/storage/posix/src/Makefile.am
+++ b/xlators/storage/posix/src/Makefile.am
@@ -9,10 +9,10 @@ posix_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
noinst_HEADERS = posix.h posix-mem-types.h
-AM_CFLAGS = -fPIC -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D$(GF_HOST_OS) -Wall \
- -I$(top_srcdir)/libglusterfs/src -shared -nostartfiles \
- -I$(top_srcdir)/contrib/md5 \
- $(GF_CFLAGS)
+AM_CFLAGS = -fPIC -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE \
+ -D$(GF_HOST_OS) -Wall -I$(top_srcdir)/libglusterfs/src -shared \
+ -nostartfiles -I$(top_srcdir)/contrib/md5 -I$(top_srcdir)/rpc/xdr/src \
+ -I$(top_srcdir)/rpc/rpc-lib/src $(GF_CFLAGS)
CLEANFILES =
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 1fd369b8f..c75429b0e 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -52,6 +52,7 @@
#include "statedump.h"
#include "locking.h"
#include "timer.h"
+#include "glusterfs3-xdr.h"
#undef HAVE_SET_FSID
#ifdef HAVE_SET_FSID
@@ -4016,7 +4017,9 @@ posix_do_readdir (call_frame_t *frame, xlator_t *this,
&& (!strcmp(entry->d_name, GF_REPLICATE_TRASH_DIR)))
continue;
- this_size = dirent_size (entry);
+ this_size = max (sizeof (gf_dirent_t),
+ sizeof (gfs3_dirplist))
+ + strlen (entry->d_name) + 1;
if (this_size + filled > size) {
seekdir (dir, in_case);