diff options
author | Anand Avati <avati@redhat.com> | 2013-11-21 06:48:17 -0800 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-11-26 10:29:23 -0800 |
commit | d1879d04e39258ea25a49eed3244b395d4af2c1d (patch) | |
tree | 5f919b61f9eb05a5bd5cd760b83603be1c0a4257 /xlators/cluster | |
parent | ec8c678c4d8b948c1b471e497db5adc0221c154b (diff) |
core: fix errno for non-existent GFID
When clients refer to a GFID which does not exist, the errno to
be returned in ESTALE (and not ENOENT). Even though ENOENT might
look "proper" most of the time, as the application eventually expects
ENOENT even if a parent directory does not exist, not returning
ESTALE results in resolvers (FUSE and GFAPI) to not retry resolution
in uncached mode. This can result in spurious ENOENTs during
concurrent path modification operations.
Change-Id: I7a06ea6d6a191739f2e9c6e333a1969615e05936
BUG: 1032894
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/6318
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@gmail.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heald.c | 2 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-common.h | 2 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-helper.c | 2 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-inode-read.c | 8 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-inode-write.c | 12 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-layout.c | 1 |
6 files changed, 15 insertions, 12 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c index 1b48a1bca..8dbb9c69e 100644 --- a/xlators/cluster/afr/src/afr-self-heald.c +++ b/xlators/cluster/afr/src/afr-self-heald.c @@ -335,7 +335,7 @@ _get_path_from_gfid_loc (xlator_t *this, xlator_t *readdir_xl, loc_t *child, ret = syncop_getxattr (readdir_xl, child, &xattr, GFID_TO_PATH_KEY); if (ret < 0) { - if ((errno == ENOENT) && missing) + if ((errno == ENOENT || errno == ESTALE) && missing) *missing = _gf_true; goto out; } diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index 81e4cc175..0497352e9 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -351,6 +351,8 @@ typedef enum { } \ } while (0) +#define dht_inode_missing(op_errno) (op_errno == ENOENT || op_errno == ESTALE) + #define check_is_dir(i,s,x) (IA_ISDIR(s->ia_type)) #define layout_is_sane(layout) ((layout) && (layout->cnt > 0)) diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c index 311a48112..00a98f1cf 100644 --- a/xlators/cluster/dht/src/dht-helper.c +++ b/xlators/cluster/dht/src/dht-helper.c @@ -769,7 +769,7 @@ dht_migration_complete_check_task (void *data) dst_node = dht_linkfile_subvol (this, NULL, NULL, dict); if (ret) { - if ((errno != ENOENT) || (!local->loc.inode)) { + if (!dht_inode_missing(errno) || (!local->loc.inode)) { gf_log (this->name, GF_LOG_ERROR, "%s: failed to get the 'linkto' xattr %s", local->loc.path, strerror (errno)); diff --git a/xlators/cluster/dht/src/dht-inode-read.c b/xlators/cluster/dht/src/dht-inode-read.c index ece84151a..12a551505 100644 --- a/xlators/cluster/dht/src/dht-inode-read.c +++ b/xlators/cluster/dht/src/dht-inode-read.c @@ -35,7 +35,7 @@ dht_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, prev = cookie; local->op_errno = op_errno; - if ((op_ret == -1) && (op_errno != ENOENT)) { + if ((op_ret == -1) && !dht_inode_missing(op_errno)) { gf_log (this->name, GF_LOG_DEBUG, "subvolume %s returned -1 (%s)", prev->this->name, strerror (op_errno)); @@ -144,7 +144,7 @@ dht_file_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local = frame->local; prev = cookie; - if ((op_ret == -1) && (op_errno != ENOENT)) { + if ((op_ret == -1) && !dht_inode_missing(op_errno)) { local->op_errno = op_errno; gf_log (this->name, GF_LOG_DEBUG, "subvolume %s returned -1 (%s)", @@ -398,7 +398,7 @@ dht_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (local->call_cnt != 1) goto out; - if ((op_ret == -1) && (op_errno != ENOENT)) + if ((op_ret == -1) && !dht_inode_missing(op_errno)) goto out; local->op_errno = op_errno; @@ -722,7 +722,7 @@ dht_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, prev = cookie; local->op_errno = op_errno; - if (op_ret == -1 && (op_errno != ENOENT)) { + if (op_ret == -1 && !dht_inode_missing(op_errno)) { gf_log (this->name, GF_LOG_DEBUG, "subvolume %s returned -1 (%s)", prev->this->name, strerror (op_errno)); diff --git a/xlators/cluster/dht/src/dht-inode-write.c b/xlators/cluster/dht/src/dht-inode-write.c index 1ba98473e..363bff3bf 100644 --- a/xlators/cluster/dht/src/dht-inode-write.c +++ b/xlators/cluster/dht/src/dht-inode-write.c @@ -32,7 +32,7 @@ dht_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int ret = -1; xlator_t *subvol = NULL; - if (op_ret == -1 && (op_errno != ENOENT)) { + if (op_ret == -1 && !dht_inode_missing(op_errno)) { goto out; } @@ -181,7 +181,7 @@ dht_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local = frame->local; prev = cookie; - if ((op_ret == -1) && (op_errno != ENOENT)) { + if ((op_ret == -1) && !dht_inode_missing(op_errno)) { local->op_errno = op_errno; local->op_ret = -1; gf_log (this->name, GF_LOG_DEBUG, @@ -367,7 +367,7 @@ dht_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this, local = frame->local; prev = cookie; - if ((op_ret == -1) && (op_errno != ENOENT)) { + if ((op_ret == -1) && !dht_inode_missing(op_errno)) { local->op_errno = op_errno; local->op_ret = -1; gf_log (this->name, GF_LOG_DEBUG, @@ -501,7 +501,7 @@ dht_discard_cbk(call_frame_t *frame, void *cookie, xlator_t *this, local = frame->local; prev = cookie; - if ((op_ret == -1) && (op_errno != ENOENT)) { + if ((op_ret == -1) && !dht_inode_missing(op_errno)) { local->op_errno = op_errno; local->op_ret = -1; gf_log (this->name, GF_LOG_DEBUG, @@ -631,7 +631,7 @@ dht_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this, local = frame->local; prev = cookie; - if ((op_ret == -1) && (op_errno != ENOENT)) { + if ((op_ret == -1) && !dht_inode_missing(op_errno)) { local->op_errno = op_errno; local->op_ret = -1; gf_log (this->name, GF_LOG_DEBUG, @@ -763,7 +763,7 @@ dht_file_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, prev = cookie; local->op_errno = op_errno; - if ((op_ret == -1) && (op_errno != ENOENT)) { + if ((op_ret == -1) && !dht_inode_missing(op_errno)) { gf_log (this->name, GF_LOG_DEBUG, "subvolume %s returned -1 (%s)", prev->this->name, strerror (op_errno)); diff --git a/xlators/cluster/dht/src/dht-layout.c b/xlators/cluster/dht/src/dht-layout.c index 38e9970a7..2bd9e5ff6 100644 --- a/xlators/cluster/dht/src/dht-layout.c +++ b/xlators/cluster/dht/src/dht-layout.c @@ -540,6 +540,7 @@ dht_layout_anomalies (xlator_t *this, loc_t *loc, dht_layout_t *layout, switch (layout->list[i].err) { case -1: case ENOENT: + case ESTALE: missing++; continue; case ENOTCONN: |