From 369fa575a1089b472c39a3843c56f694e1f7ad6f Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Wed, 30 Nov 2016 17:44:29 -0500 Subject: storage/posix: log the error when locking the export directory fails posix xlator tries to prevent external unmount of the brick export directory by locking it. It locks the export directory by opening it (i.e. doing a opendir). But if opendir fails it errors out resulting in the brick process going down. The error due to which opendir failed is not logged. Change-Id: I28648382b7f0b88fb1aeb36152e5ab5d812374c9 BUG: 1401095 Signed-off-by: Raghavendra Bhat Reviewed-on: http://review.gluster.org/16018 Smoke: Gluster Build System Tested-by: Vijay Bellur NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/storage/posix/src/posix.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'xlators') diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 7abd2955fbb..36626a49745 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -6814,6 +6814,7 @@ init (xlator_t *this) gf_boolean_t tmp_bool = 0; int ret = 0; int op_ret = -1; + int op_errno = 0; ssize_t size = -1; uuid_t old_uuid = {0,}; uuid_t dict_uuid = {0,}; @@ -7169,8 +7170,11 @@ init (xlator_t *this) _private->mount_lock = sys_opendir (dir_data->data); if (!_private->mount_lock) { ret = -1; - gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_DIR_OPERATION_FAILED, - "Could not lock brick directory"); + op_errno = errno; + gf_msg (this->name, GF_LOG_ERROR, 0, + P_MSG_DIR_OPERATION_FAILED, + "Could not lock brick directory (%s)", + strerror (op_errno)); goto out; } #ifndef GF_DARWIN_HOST_OS -- cgit