diff options
author | Xavier Hernandez <xhernandez@datalab.es> | 2015-01-30 11:47:11 +0100 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-02-05 05:33:07 -0800 |
commit | f75bb4a9ca14b50c7f828ee3fe4ba73dd78f094c (patch) | |
tree | ae9785f822fce82e1977d4ed03b473750e489368 /xlators/cluster/ec/src/ec-helpers.c | |
parent | b3b4f9d81a5c70b04fdb71b9eb7a619cfede7cf8 (diff) |
ec: Special handling of anonymous fd
Anonymous file descriptors need to be handled specially because
they can be used in some non standard ways (i.e. an anonymous fd
can be used without having been opened).
This caused NFS to fail on some operations because ec always
expected to have a previous successful opendir call (from patch
http://review.gluster.org/9098/).
This patch treats all anonymous fd as opened on all subvolumes.
Change-Id: I09dbbce2ffc1ae3a5bcbb328bed55b84f4f0b9f8
BUG: 1187474
Signed-off-by: Xavier Hernandez <xhernandez@datalab.es>
Reviewed-on: http://review.gluster.org/9513
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster/ec/src/ec-helpers.c')
-rw-r--r-- | xlators/cluster/ec/src/ec-helpers.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/xlators/cluster/ec/src/ec-helpers.c b/xlators/cluster/ec/src/ec-helpers.c index 751c0802ebb..c580166ef00 100644 --- a/xlators/cluster/ec/src/ec-helpers.c +++ b/xlators/cluster/ec/src/ec-helpers.c @@ -621,11 +621,6 @@ ec_fd_t * __ec_fd_get(fd_t * fd, xlator_t * xl) ec_fd_t * ctx = NULL; uint64_t value = 0; - if (fd->anonymous) - { - return NULL; - } - if ((__fd_ctx_get(fd, xl, &value) != 0) || (value == 0)) { ctx = GF_MALLOC(sizeof(*ctx), ec_mt_ec_fd_t); @@ -647,6 +642,14 @@ ec_fd_t * __ec_fd_get(fd_t * fd, xlator_t * xl) ctx = (ec_fd_t *)(uintptr_t)value; } + /* Treat anonymous fd specially */ + if (fd->anonymous) { + /* Mark the fd open for all subvolumes. */ + ctx->open = -1; + /* Try to populate ctx->loc with fd->inode information. */ + ec_loc_update(xl, &ctx->loc, fd->inode, NULL); + } + return ctx; } @@ -654,14 +657,11 @@ ec_fd_t * ec_fd_get(fd_t * fd, xlator_t * xl) { ec_fd_t * ctx = NULL; - if (!fd->anonymous) - { - LOCK(&fd->lock); + LOCK(&fd->lock); - ctx = __ec_fd_get(fd, xl); + ctx = __ec_fd_get(fd, xl); - UNLOCK(&fd->lock); - } + UNLOCK(&fd->lock); return ctx; } |