diff options
| -rw-r--r-- | build_env | 1 | ||||
| -rw-r--r-- | xlators/storage/posix/src/posix-handle.c | 6 | ||||
| -rw-r--r-- | xlators/storage/posix/src/posix-helpers.c | 7 | ||||
| -rw-r--r-- | xlators/storage/posix/src/posix.c | 19 |
4 files changed, 28 insertions, 5 deletions
diff --git a/build_env b/build_env index 5c53cc57b72..74f7c0256e1 100644 --- a/build_env +++ b/build_env @@ -24,6 +24,7 @@ if [ $REDHAT_MAJOR -ge 7 ]; then fi export GF_CONF_OPTS +ASAN_ENABLED=0 # Check if ASAN is enabled if [ "$ASAN_ENABLED" -eq "1" ]; then GF_CONF_OPTS="$GF_CONF_OPTS --with-asan" diff --git a/xlators/storage/posix/src/posix-handle.c b/xlators/storage/posix/src/posix-handle.c index d3f48f859bf..558755af009 100644 --- a/xlators/storage/posix/src/posix-handle.c +++ b/xlators/storage/posix/src/posix-handle.c @@ -210,6 +210,12 @@ posix_make_ancestryfromgfid (xlator_t *this, char *path, int pathsize, goto out; } + if (!inode && path) { + gf_log (this->name, GF_LOG_WARNING, "OOPS: Failed to resolve" + "path (%s), inode is null. Bailing!", path); + goto out; + } + ret = posix_make_ancestral_node (priv_base_path, path, pathsize, head, dir_name, &iabuf, inode, type, xdata); if (*parent != NULL) { diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 8694383241e..f8e1948e3d5 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -434,18 +434,21 @@ _posix_xattr_get_set (dict_t *xattr_req, char *key, data_t *data, "Failed to set dictionary value for %s", key); } - } else if (!strcmp (key, GET_ANCESTRY_PATH_KEY)) { + } else if (!strcmp (key, GET_ANCESTRY_PATH_KEY) && + filler->loc && filler->loc->inode && + !gf_uuid_is_null (filler->loc->inode->gfid)) { /* As of now, the only consumers of POSIX_ANCESTRY_PATH attempt * fetching it via path-based fops. Hence, leaving it as it is * for now. */ if (!filler->real_path) goto out; + char *path = NULL; ret = posix_get_ancestry (filler->this, filler->loc->inode, NULL, &path, POSIX_ANCESTRY_PATH, &filler->op_errno, xattr_req); - if (ret < 0) { + if (ret < 0 || !path) { goto out; } diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index eb0986ffb6a..859df6cefac 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -180,8 +180,15 @@ posix_lookup (call_frame_t *frame, xlator_t *this, op_ret = dict_get_int32 (xdata, GF_GFIDLESS_LOOKUP, &gfidless); op_ret = -1; if (gf_uuid_is_null (loc->pargfid) || (loc->name == NULL)) { - /* nameless lookup */ - MAKE_INODE_HANDLE (real_path, this, loc, &buf); + if (gf_uuid_is_null (loc->gfid)) { + gf_log (this->name, GF_LOG_WARNING, + "OOPS: Namless lookup with null gfid!"); + op_errno = EINVAL; + op_ret = -1; + goto out; + } else { + MAKE_INODE_HANDLE (real_path, this, loc, &buf); + } } else { MAKE_ENTRY_HANDLE (real_path, par_path, this, loc, &buf); @@ -4355,6 +4362,12 @@ posix_get_ancestry (xlator_t *this, inode_t *leaf_inode, op_errno, xdata); } + if (ret == 0 && path && !*path) { + gf_log (this->name, GF_LOG_DEBUG, + "Failed to resolve ancestry path, pgfid " + "attribute isn't set (yet)."); + ret = -1; + } out: if (ret && path && *path) { GF_FREE (*path); @@ -4576,7 +4589,7 @@ posix_getxattr (call_frame_t *frame, xlator_t *this, goto done; } - if (loc->inode && name + if (loc->inode && !gf_uuid_is_null(loc->inode->gfid) && name && (strcmp (name, GET_ANCESTRY_PATH_KEY) == 0)) { int type = POSIX_ANCESTRY_PATH; |
