summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarak Sason <bsasonro@redhat.com>2019-08-15 11:06:26 +0300
committerAmar Tumballi <amarts@gmail.com>2019-08-21 04:42:57 +0000
commit1c3b280602153481fead83622aa885f6735c094c (patch)
tree1e2995196fe2a844ef17398997aa6dbe79900cc4
parent95f71df31dc73d85df722b0e7d3a7eb1e0237e7f (diff)
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 <bsasonro@redhat.com>
-rw-r--r--xlators/storage/posix/src/posix-inode-fd-ops.c21
-rw-r--r--xlators/storage/posix/src/posix-messages.h4
2 files changed, 21 insertions, 4 deletions
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_ */