summaryrefslogtreecommitdiffstats
path: root/xlators/storage
diff options
context:
space:
mode:
authorRichard Wareing <rwareing@fb.com>2016-02-01 19:25:02 -0800
committerShreyas Siravara <sshreyas@fb.com>2017-08-30 01:39:51 +0000
commit9bc7c9df41f4e7fc0b8462cbc56298d421cb8722 (patch)
tree70a0c0df32ba9ea0393386a55dff00243bb300ab /xlators/storage
parentc87639ad04a3c1a0d1fccbf426ad040d36505693 (diff)
storage/posix: Fix crash bug in posix_make_ancestryfromgfid
Summary: - Per title, adding OOPS logging - Clean-up quota related log spew from when older clients connect to 3.6.x quota enabled clusters Test Plan: - Spew: Tested on dev servers, one with old client against dev server w/ 3.6.3_fb - Crash: Canaried on offending node (gfsai040.prn2) and ensure crash no longer happens - Canary on gfsbudev shadow tiers once approved - This is a port of D2894799 to 3.8 Reviewers: sshreyas, dph, dld, moox Change-Id: I13e7d6915ee301b8d607d5770ef2261a9ab78493 Reviewed-on: https://review.gluster.org/18140 CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Shreyas Siravara <sshreyas@fb.com> Smoke: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/storage')
-rw-r--r--xlators/storage/posix/src/posix-handle.c6
-rw-r--r--xlators/storage/posix/src/posix-helpers.c7
-rw-r--r--xlators/storage/posix/src/posix.c19
3 files changed, 27 insertions, 5 deletions
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;