From f3204a06eb8156743110b1613b4b4b63b70572b6 Mon Sep 17 00:00:00 2001 From: Xavier Hernandez Date: Tue, 8 Jul 2014 17:52:57 +0200 Subject: cluster/ec: Fix incorrect management of NFS requests Some operations, specially those comming from NFS, do not use a regular fd and use an anonymous fd (i.e. a previous open call has not been sent). Any context information created during open or create will not be present on these fd's, so we simply return NULL for contexts of those fd. Also it seems that NFS can send write requests with a very big buffer (higher that the default value of 128 KB). Some changes have been made to correctly handle these large buffers. Change-Id: I281476bd0d2cbaad231822248d6a616fcf5d4003 BUG: 1122417 Signed-off-by: Xavier Hernandez Reviewed-on: http://review.gluster.org/8367 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/cluster/ec/src/ec-inode-write.c | 55 ++++++++++----------------------- 1 file changed, 17 insertions(+), 38 deletions(-) (limited to 'xlators/cluster/ec/src/ec-inode-write.c') diff --git a/xlators/cluster/ec/src/ec-inode-write.c b/xlators/cluster/ec/src/ec-inode-write.c index c0694531151..06a2fef8d17 100644 --- a/xlators/cluster/ec/src/ec-inode-write.c +++ b/xlators/cluster/ec/src/ec-inode-write.c @@ -1932,18 +1932,10 @@ void ec_wind_writev(ec_t * ec, ec_fop_data_t * fop, int32_t idx) { ec_trace("WIND", fop, "idx=%d", idx); - struct iovec vector[fop->int32]; - struct iobuf_pool * pool = NULL; + struct iovec vector[1]; struct iobref * iobref = NULL; struct iobuf * iobuf = NULL; - uint8_t * ptr = NULL; - ssize_t size = 0, slice = 0, pagesize = 0, maxsize = 0; - int32_t count = 0; - - pool = fop->xl->ctx->iobuf_pool; - - pagesize = iobpool_default_pagesize(pool); - maxsize = pagesize * ec->fragments; + ssize_t size = 0, bufsize = 0; iobref = iobref_new(); if (iobref == NULL) @@ -1951,43 +1943,30 @@ void ec_wind_writev(ec_t * ec, ec_fop_data_t * fop, int32_t idx) goto out; } - ptr = fop->vector[0].iov_base; size = fop->vector[0].iov_len; + bufsize = size / ec->fragments; - count = 0; - while (size > 0) + iobuf = iobuf_get2(fop->xl->ctx->iobuf_pool, bufsize); + if (iobuf == NULL) { - iobuf = iobuf_get(pool); - if (iobuf == NULL) - { - goto out; - } - if (iobref_add(iobref, iobuf) != 0) - { - goto out; - } - - slice = size; - if (slice > maxsize) - { - slice = maxsize; - } - - ec_method_encode(slice, ec->fragments, idx, ptr, iobuf->ptr); - ptr += slice; + goto out; + } + if (iobref_add(iobref, iobuf) != 0) + { + goto out; + } - vector[count].iov_base = iobuf->ptr; - vector[count].iov_len = slice / ec->fragments; - count++; + ec_method_encode(size, ec->fragments, idx, fop->vector[0].iov_base, + iobuf->ptr); - iobuf_unref(iobuf); + vector[0].iov_base = iobuf->ptr; + vector[0].iov_len = bufsize; - size -= slice; - } + iobuf_unref(iobuf); STACK_WIND_COOKIE(fop->frame, ec_writev_cbk, (void *)(uintptr_t)idx, ec->xl_list[idx], ec->xl_list[idx]->fops->writev, - fop->fd, vector, count, fop->offset / ec->fragments, + fop->fd, vector, 1, fop->offset / ec->fragments, fop->uint32, iobref, fop->xdata); iobref_unref(iobref); -- cgit