From c63aa2239bc682739328e0aa6cbcb3279a72a8e2 Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Mon, 7 Aug 2017 12:14:23 +0530 Subject: posix: add null gfid checks ...in file/dir creation and lookup codepaths. The check is relaxed for fops coming from trash xlator at the moment until trash has client side logic to send the create fops with gfid-req. Also fixed the missing trash pid assignment in creates sent by trash xlator. Without this, truncated files won't be moved to .trashcan. Change-Id: Ieddd7f0634850e7c7010e4fbb4ad1eead35888c8 BUG: 1478297 Signed-off-by: Ravishankar N Reviewed-on: https://review.gluster.org/17975 Smoke: Gluster Build System Reviewed-by: jiffin tony Thottan CentOS-regression: Gluster Build System Reviewed-by: Raghavendra Bhat --- xlators/storage/posix/src/posix-helpers.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'xlators/storage/posix/src/posix-helpers.c') diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 1a05d65161a..e09c6d796cb 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -855,6 +855,12 @@ posix_gfid_set (xlator_t *this, const char *path, loc_t *loc, dict_t *xattr_req) loc->path); goto out; } + if (gf_uuid_is_null (uuid_req)) { + gf_msg (this->name, GF_LOG_ERROR, EINVAL, P_MSG_NULL_GFID, + "gfid is null for %s", loc ? loc->path : ""); + ret = -1; + goto out; + } ret = sys_lsetxattr (path, GFID_XATTR_KEY, uuid_req, 16, XATTR_CREATE); if (ret == -1) { -- cgit