From 28f561b1855d118202de3a6d454d688c1ccb9e6e Mon Sep 17 00:00:00 2001 From: Mohammed Rafi KC Date: Mon, 21 Dec 2015 14:18:26 +0530 Subject: tier/unlink: open fd for special file for fdstat DUring unlink of a file, dht request stat to see whether the file is under migration or not. But in posix_unlink currently we are opening for regular files. so the fdstat for special files are failing with EBAD backport of> >Change-Id: Ic0678e42e7701c3dffb91d98272e664b0fc646b5 >BUG: 1293256 >Signed-off-by: Mohammed Rafi KC >Reviewed-on: http://review.gluster.org/13034 >Reviewed-by: Raghavendra G >Reviewed-by: Susant Palai >Tested-by: NetBSD Build System >Reviewed-by: Dan Lambright >Tested-by: Dan Lambright Change-Id: Ibad6e97cb052f779520968f0dce15b6fa78a5e1a BUG: 1295360 Signed-off-by: Mohammed Rafi KC Reviewed-on: http://review.gluster.org/13164 Smoke: Gluster Build System CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: Dan Lambright --- xlators/storage/posix/src/posix.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'xlators') diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 27885b8f8c5..a539410bbc2 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -1764,17 +1764,16 @@ posix_unlink (call_frame_t *frame, xlator_t *this, fdstat_requested = 1; } - if (priv->background_unlink || fdstat_requested) { - if (IA_ISREG (loc->inode->ia_type)) { - fd = open (real_path, O_RDONLY); - if (fd == -1) { - op_ret = -1; - op_errno = errno; - gf_msg (this->name, GF_LOG_ERROR, errno, - P_MSG_OPEN_FAILED, - "open of %s failed", real_path); - goto out; - } + if (fdstat_requested || + (priv->background_unlink && IA_ISREG (loc->inode->ia_type))) { + fd = open (real_path, O_RDONLY); + if (fd == -1) { + op_ret = -1; + op_errno = errno; + gf_msg (this->name, GF_LOG_ERROR, errno, + P_MSG_OPEN_FAILED, + "open of %s failed", real_path); + goto out; } } -- cgit