From e37ee6d509aa98587d55f9ea73bc831c10761eaa Mon Sep 17 00:00:00 2001 From: karthik-us Date: Fri, 3 Aug 2018 15:55:18 +0530 Subject: posix: Delete the entry if gfid link creation fails Problem: If the gfid link file inside .glusterfs is not present for a file, the operations which are dependent on the gfid will fail, complaining the link file does not exists inside .glusterfs. Fix: If the link file creation fails, fail the entry creation operation and delete the original file. Change-Id: Id767511de2da46b1f45aea45cb68b98d965ac96d fixes: bz#1612037 Signed-off-by: karthik-us --- xlators/storage/posix/src/posix-entry-ops.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'xlators/storage/posix/src/posix-entry-ops.c') diff --git a/xlators/storage/posix/src/posix-entry-ops.c b/xlators/storage/posix/src/posix-entry-ops.c index cb96d76332a..acda68371d5 100644 --- a/xlators/storage/posix/src/posix-entry-ops.c +++ b/xlators/storage/posix/src/posix-entry-ops.c @@ -490,10 +490,13 @@ ignore: } if (!linked) { - op_ret = posix_gfid_set (this, real_path, loc, xdata); + op_ret = posix_gfid_set (this, real_path, loc, xdata, + frame->root->pid, &op_errno); if (op_ret) { - gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_GFID_FAILED, - "setting gfid on %s failed", real_path); + gf_msg (this->name, GF_LOG_ERROR, op_errno, + P_MSG_GFID_FAILED, "setting gfid on %s failed", + real_path); + goto out; } else { gfid_set = _gf_true; } @@ -812,10 +815,12 @@ posix_mkdir (call_frame_t *frame, xlator_t *this, "setting xattrs on %s failed", real_path); } - op_ret = posix_gfid_set (this, real_path, loc, xdata); + op_ret = posix_gfid_set (this, real_path, loc, xdata, frame->root->pid, + &op_errno); if (op_ret) { - gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_GFID_FAILED, + gf_msg (this->name, GF_LOG_ERROR, op_errno, P_MSG_GFID_FAILED, "setting gfid on %s failed", real_path); + goto out; } else { gfid_set = _gf_true; } @@ -1508,10 +1513,12 @@ ignore: "setting xattrs on %s failed ", real_path); } - op_ret = posix_gfid_set (this, real_path, loc, xdata); + op_ret = posix_gfid_set (this, real_path, loc, xdata, frame->root->pid, + &op_errno); if (op_ret) { - gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_GFID_FAILED, + gf_msg (this->name, GF_LOG_ERROR, op_errno, P_MSG_GFID_FAILED, "setting gfid on %s failed", real_path); + goto out; } else { gfid_set = _gf_true; } @@ -2164,10 +2171,12 @@ ignore: } fill_stat: - op_ret = posix_gfid_set (this, real_path, loc, xdata); + op_ret = posix_gfid_set (this, real_path, loc, xdata, frame->root->pid, + &op_errno); if (op_ret) { - gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_GFID_FAILED, + gf_msg (this->name, GF_LOG_ERROR, op_errno, P_MSG_GFID_FAILED, "setting gfid on %s failed", real_path); + goto out; } else { gfid_set = _gf_true; } -- cgit