From 1c3b280602153481fead83622aa885f6735c094c Mon Sep 17 00:00:00 2001 From: Barak Sason Date: Thu, 15 Aug 2019 11:06:26 +0300 Subject: storage/posix - fixing a coverity issue CID: 1394644 & 1394639 Updates: bz#789278 Added logging in case method calls fails Change-Id: Ib833a5f68d37b98287b84c325637bc688937f647 Signed-off-by: Barak Sason --- xlators/storage/posix/src/posix-inode-fd-ops.c | 21 +++++++++++++++++++-- xlators/storage/posix/src/posix-messages.h | 4 ++-- 2 files changed, 21 insertions(+), 4 deletions(-) (limited to 'xlators/storage') diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c index 27b622346e5..8bd8692f86b 100644 --- a/xlators/storage/posix/src/posix-inode-fd-ops.c +++ b/xlators/storage/posix/src/posix-inode-fd-ops.c @@ -4395,10 +4395,19 @@ posix_common_removexattr(call_frame_t *frame, loc_t *loc, fd_t *fd, goto out; } - if (loc) + if (loc) { ret = posix_pstat(this, inode, loc->gfid, real_path, &preop, _gf_false); - else + if (ret) { + gf_msg(this->name, GF_LOG_WARNING, errno, P_MSG_PSTAT_FAILED, + "pstat operaton failed on %s", real_path); + } + } else { ret = posix_fdstat(this, inode, _fd, &preop); + if (ret) { + gf_msg(this->name, GF_LOG_WARNING, errno, P_MSG_FDSTAT_FAILED, + "fdstat operaton failed on %s", real_path); + } + } if (gf_get_index_by_elem(disallow_removexattrs, (char *)name) >= 0) { gf_msg(this->name, GF_LOG_WARNING, 0, P_MSG_XATTR_NOT_REMOVED, @@ -4454,9 +4463,17 @@ posix_common_removexattr(call_frame_t *frame, loc_t *loc, fd_t *fd, posix_set_ctime(frame, this, real_path, -1, inode, NULL); ret = posix_pstat(this, inode, loc->gfid, real_path, &postop, _gf_false); + if (ret) { + gf_msg(this->name, GF_LOG_WARNING, errno, P_MSG_PSTAT_FAILED, + "pstat operaton failed on %s", real_path); + } } else { posix_set_ctime(frame, this, NULL, _fd, inode, NULL); ret = posix_fdstat(this, inode, _fd, &postop); + if (ret) { + gf_msg(this->name, GF_LOG_WARNING, errno, P_MSG_FDSTAT_FAILED, + "fdstat operaton failed on %s", real_path); + } } if (ret) goto out; diff --git a/xlators/storage/posix/src/posix-messages.h b/xlators/storage/posix/src/posix-messages.h index 15e23ff7563..f5bede266da 100644 --- a/xlators/storage/posix/src/posix-messages.h +++ b/xlators/storage/posix/src/posix-messages.h @@ -68,7 +68,7 @@ GLFS_MSGID(POSIX, P_MSG_XATTR_FAILED, P_MSG_NULL_GFID, P_MSG_FCNTL_FAILED, P_MSG_FALLOCATE_FAILED, P_MSG_STOREMDATA_FAILED, P_MSG_FETCHMDATA_FAILED, P_MSG_GETMDATA_FAILED, P_MSG_SETMDATA_FAILED, P_MSG_FRESHFILE, P_MSG_MUTEX_FAILED, - P_MSG_COPY_FILE_RANGE_FAILED, P_MSG_TIMER_DELETE_FAILED, - P_MSG_NOMEM); + P_MSG_COPY_FILE_RANGE_FAILED, P_MSG_TIMER_DELETE_FAILED, P_MSG_NOMEM, + P_MSG_PSTAT_FAILED, P_MSG_FDSTAT_FAILED); #endif /* !_GLUSTERD_MESSAGES_H_ */ -- cgit