summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohammed Rafi KC <rkavunga@redhat.com>2015-12-21 14:18:26 +0530
committerDan Lambright <dlambrig@redhat.com>2015-12-21 09:16:30 -0800
commit7237f8f0d72743d2522b7db1be928c5016713c59 (patch)
treec9460232690696002243076a84c7d6abb4f88269
parent3a094f1de03b3da8cdff650c14e46aab87e1905b (diff)
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 Change-Id: Ic0678e42e7701c3dffb91d98272e664b0fc646b5 BUG: 1293256 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/13034 Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Reviewed-by: Susant Palai <spalai@redhat.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Dan Lambright <dlambrig@redhat.com> Tested-by: Dan Lambright <dlambrig@redhat.com>
-rw-r--r--xlators/storage/posix/src/posix.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 6eca2b6fd8f..7bdd69d3a0d 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -1735,17 +1735,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;
}
}