From 041d31e90b6000643e8c06a6d82520e3f2cc3b9a Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Wed, 29 Jul 2015 14:27:07 +0530 Subject: features/shard: Return ENOTSUP as opposed to ENOTCONN in unimplemented fops Change-Id: Idba1070b11c5c1de26ef57e6843c93c105b8b8a5 BUG: 1270694 Signed-off-by: Krutika Dhananjay Reviewed-on: http://review.gluster.org/12340 Tested-by: NetBSD Build System Tested-by: Gluster Build System Reviewed-by: Pranith Kumar Karampuri --- xlators/features/shard/src/shard-messages.h | 9 ++++++++- xlators/features/shard/src/shard.c | 12 +++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/xlators/features/shard/src/shard-messages.h b/xlators/features/shard/src/shard-messages.h index 8fe31cccc53..be019a7ca5e 100644 --- a/xlators/features/shard/src/shard-messages.h +++ b/xlators/features/shard/src/shard-messages.h @@ -40,7 +40,7 @@ */ #define GLFS_COMP_BASE_SHARD GLFS_MSGID_COMP_SHARD -#define GLFS_NUM_MESSAGES 16 +#define GLFS_NUM_MESSAGES 17 #define GLFS_MSGID_END (GLFS_COMP_BASE_SHARD + GLFS_NUM_MESSAGES + 1) #define glfs_msg_start_x GLFS_COMP_BASE_SHARD, "Invalid: Start of messages" @@ -166,5 +166,12 @@ */ #define SHARD_MSG_UPDATE_FILE_SIZE_FAILED (GLFS_COMP_BASE_SHARD + 16) +/*! + * @messageid 133017 + * @diagnosis The operation invoked is not supported. + * @recommendedaction Use other syscalls to write to the file. +*/ +#define SHARD_MSG_FOP_NOT_SUPPORTED (GLFS_COMP_BASE_SHARD + 17) + #define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages" #endif /* !_SHARD_MESSAGES_H_ */ diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c index 6e688427fb4..f5ac76d974a 100644 --- a/xlators/features/shard/src/shard.c +++ b/xlators/features/shard/src/shard.c @@ -4291,7 +4291,9 @@ shard_fallocate (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t keep_size, off_t offset, size_t len, dict_t *xdata) { /* TBD */ - SHARD_STACK_UNWIND (fallocate, frame, -1, ENOTCONN, NULL, NULL, NULL); + gf_msg (this->name, GF_LOG_INFO, ENOTSUP, SHARD_MSG_FOP_NOT_SUPPORTED, + "fallocate called on %s.", uuid_utoa (fd->inode->gfid)); + SHARD_STACK_UNWIND (fallocate, frame, -1, ENOTSUP, NULL, NULL, NULL); return 0; } @@ -4300,7 +4302,9 @@ shard_discard (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, size_t len, dict_t *xdata) { /* TBD */ - SHARD_STACK_UNWIND (discard, frame, -1, ENOTCONN, NULL, NULL, NULL); + gf_msg (this->name, GF_LOG_INFO, ENOTSUP, SHARD_MSG_FOP_NOT_SUPPORTED, + "discard called on %s.", uuid_utoa (fd->inode->gfid)); + SHARD_STACK_UNWIND (discard, frame, -1, ENOTSUP, NULL, NULL, NULL); return 0; } @@ -4309,7 +4313,9 @@ shard_zerofill (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, off_t len, dict_t *xdata) { /* TBD */ - SHARD_STACK_UNWIND (zerofill, frame, -1, ENOTCONN, NULL, NULL, NULL); + gf_msg (this->name, GF_LOG_INFO, ENOTSUP, SHARD_MSG_FOP_NOT_SUPPORTED, + "zerofill called on %s.", uuid_utoa (fd->inode->gfid)); + SHARD_STACK_UNWIND (zerofill, frame, -1, ENOTSUP, NULL, NULL, NULL); return 0; } -- cgit