From fb0bb972dfac3c255c53ddc7b588b73a08883288 Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Wed, 25 Aug 2010 01:40:00 +0000 Subject: 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 Signed-off-by: Anand V. Avati BUG: 1430 (encoding of readdirp response fails occasionally) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1430 --- xlators/storage/posix/src/posix.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'xlators/storage/posix/src/posix.c') diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 1fd369b8ffe..c75429b0eb5 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); -- cgit