diff options
author | SonaArora <aarorasona@gmail.com> | 2017-07-26 17:43:45 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2017-08-07 13:15:37 +0000 |
commit | ebc8237d8c445af208446c937f31aa311d1efb2c (patch) | |
tree | b92dc49351e7a5b503db2a768f5290917fdb61df /xlators | |
parent | 42c057a6d1a03dd2825a278393acb15d52220c8d (diff) |
read-only : currently read-only doesn't implement fallocate
PROBLEM STATEMENT: read-only should block fallocate call if its enabled,
else pass to next xlator. Implemented this functionality in read-only.
BUG: 1475300
Change-Id: I57c51eb4f1519ba75d7291eba49554e6ed4a25eb
Signed-off-by: SonaArora <aarorasona@gmail.com>
Reviewed-on: https://review.gluster.org/17879
Smoke: Gluster Build System <jenkins@build.gluster.org>
Tested-by: Karthik U S <ksubrahm@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Karthik U S <ksubrahm@redhat.com>
Reviewed-by: Ashish Pandey <aspandey@redhat.com>
Reviewed-by: Kotresh HR <khiremat@redhat.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/read-only/src/read-only-common.c | 15 | ||||
-rw-r--r-- | xlators/features/read-only/src/read-only-common.h | 4 | ||||
-rw-r--r-- | xlators/features/read-only/src/read-only.c | 1 |
3 files changed, 20 insertions, 0 deletions
diff --git a/xlators/features/read-only/src/read-only-common.c b/xlators/features/read-only/src/read-only-common.c index b4e4289356b..f4851a4be40 100644 --- a/xlators/features/read-only/src/read-only-common.c +++ b/xlators/features/read-only/src/read-only-common.c @@ -196,6 +196,21 @@ ro_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, dict_ return 0; } +int32_t +ro_fallocate (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode, + off_t offset, size_t len, dict_t *xdata) +{ + if (is_readonly_or_worm_enabled (frame, this)) + STACK_UNWIND_STRICT (fallocate, frame, -1, EROFS, NULL, NULL, + xdata); + else + STACK_WIND_TAIL (frame, FIRST_CHILD (this), + FIRST_CHILD(this)->fops->fallocate, fd, mode, + offset, len, xdata); + return 0; +} + + int ro_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, dev_t rdev, mode_t umask, dict_t *xdata) diff --git a/xlators/features/read-only/src/read-only-common.h b/xlators/features/read-only/src/read-only-common.h index 6d8c38faeb8..ec629bd5660 100644 --- a/xlators/features/read-only/src/read-only-common.h +++ b/xlators/features/read-only/src/read-only-common.h @@ -111,3 +111,7 @@ ro_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, int32_t ro_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, const char *name, dict_t *xdata); + +int32_t +ro_fallocate (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode, + off_t offset, size_t len, dict_t *xdata); diff --git a/xlators/features/read-only/src/read-only.c b/xlators/features/read-only/src/read-only.c index 8733a40abce..75d6d104d45 100644 --- a/xlators/features/read-only/src/read-only.c +++ b/xlators/features/read-only/src/read-only.c @@ -115,6 +115,7 @@ struct xlator_fops fops = { .entrylk = ro_entrylk, .fentrylk = ro_fentrylk, .lk = ro_lk, + .fallocate = ro_fallocate, }; struct xlator_cbks cbks = { |