summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2016-02-25 18:27:09 +0530
committerVijay Bellur <vbellur@redhat.com>2016-03-09 04:05:08 -0800
commitdc57965cca4c6820f65e69b1b9c9bf94a38218e6 (patch)
tree2a67d3f2e0e36100fb4970e3736dd90c30256ceb
parentba1a401e142ad8884f9d3f13c51f7d5b17d008fc (diff)
features/shard: Return ENOTSUP for unsupported fallocate flags
Backport of: http://review.gluster.org/13523 Basis: http://lists.gnu.org/archive/html/qemu-devel/2016-02/msg05101.html Change-Id: I681eb4d0c43c635cf96a2deab0996dec7a255fe5 BUG: 1299712 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/13652 Smoke: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Ravishankar N <ravishankar@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--libglusterfs/src/compat.h5
-rw-r--r--xlators/features/shard/src/shard.c8
2 files changed, 12 insertions, 1 deletions
diff --git a/libglusterfs/src/compat.h b/libglusterfs/src/compat.h
index 9f994db38c9..cb141e38aec 100644
--- a/libglusterfs/src/compat.h
+++ b/libglusterfs/src/compat.h
@@ -62,7 +62,9 @@
#ifndef FALLOC_FL_PUNCH_HOLE
#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */
#endif
-
+#ifndef FALLOC_FL_ZERO_RANGE
+#define FALLOC_FL_ZERO_RANGE 0x10 /* zeroes out range */
+#endif
#ifndef HAVE_LLISTXATTR
@@ -176,6 +178,7 @@ enum {
#define F_SETLKW64 F_SETLKW
#define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */
#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */
+#define FALLOC_FL_ZERO_RANGE 0x10 /* zeroes out range */
#ifndef _PATH_UMOUNT
#define _PATH_UMOUNT "/sbin/umount"
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c
index 857578fde2c..c7cced664ee 100644
--- a/xlators/features/shard/src/shard.c
+++ b/xlators/features/shard/src/shard.c
@@ -4590,9 +4590,17 @@ int
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)
{
+ if ((keep_size != 0) && (keep_size != FALLOC_FL_ZERO_RANGE) &&
+ (keep_size != (FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)))
+ goto out;
+
shard_common_inode_write_begin (frame, this, GF_FOP_FALLOCATE, fd, NULL,
0, offset, keep_size, len, NULL, xdata);
return 0;
+
+out:
+ SHARD_STACK_UNWIND (fallocate, frame, -1, ENOTSUP, NULL, NULL, NULL);
+ return 0;
}
int