summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkarthik-us <ksubrahm@redhat.com>2016-06-13 08:23:06 +0530
committerNiels de Vos <ndevos@redhat.com>2016-06-13 06:32:16 -0700
commitf8e8a6ea010d230c7128e628532bbaaf1e8378c3 (patch)
tree9232fbae112a0c15018e45135a4fade95e77537f
parent02d3f5e68be6adb42359eb03de4801b27dc2a12e (diff)
features/worm: fixed issue with write FOP for normal files
The write FOPs on normal files were being blocked after the recent change. It should fail only for the WORM and WORM-Retained files, and should pass for a normal file. Using auto-commit period to check for dormant files instead of retention period. Backport of http://review.gluster.org/#/c/14619/ > Change-Id: I30f82d4de2ea2c59c1eb7b4449ba6a60e568cfd5 > BUG: 1342259 > Signed-off-by: karthik-us <ksubrahm@redhat.com> Change-Id: I9c4ad589dd82cd33eecf207d9ed810a9d01f0f46 BUG: 1345713 Signed-off-by: karthik-us <ksubrahm@redhat.com> Reviewed-on: http://review.gluster.org/14705 Smoke: Gluster Build System <jenkins@build.gluster.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Niels de Vos <ndevos@redhat.com>
-rw-r--r--xlators/features/read-only/src/worm-helper.c4
-rw-r--r--xlators/features/read-only/src/worm.c5
2 files changed, 5 insertions, 4 deletions
diff --git a/xlators/features/read-only/src/worm-helper.c b/xlators/features/read-only/src/worm-helper.c
index 692899d9379..81a167e3c63 100644
--- a/xlators/features/read-only/src/worm-helper.c
+++ b/xlators/features/read-only/src/worm-helper.c
@@ -305,7 +305,6 @@ gf_worm_state_transition (xlator_t *this, gf_boolean_t fop_with_fd,
int op_errno = EROFS;
int ret = -1;
uint64_t com_period = 0;
- uint64_t ret_period = 0;
uint64_t start_time = 0;
dict_t *dict = NULL;
worm_reten_state_t reten_state = {0,};
@@ -356,8 +355,7 @@ gf_worm_state_transition (xlator_t *this, gf_boolean_t fop_with_fd,
}
if (ret == -1 && (time (NULL) - start_time) >= com_period) {
- ret_period = priv->reten_period;
- if ((time (NULL) - stbuf.ia_mtime) >= ret_period) {
+ if ((time (NULL) - stbuf.ia_mtime) >= com_period) {
ret = worm_set_state(this, fop_with_fd, file_ptr,
&reten_state, &stbuf);
if (ret) {
diff --git a/xlators/features/read-only/src/worm.c b/xlators/features/read-only/src/worm.c
index ad06f46a4e4..3e32d65dbac 100644
--- a/xlators/features/read-only/src/worm.c
+++ b/xlators/features/read-only/src/worm.c
@@ -370,8 +370,11 @@ worm_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
goto out;
}
ret = worm_get_state (this, _gf_true, fd, &reten_state);
- if (ret)
+ if (ret) {
+ if (ret == -1)
+ op_errno = 0;
goto out;
+ }
if (!reten_state.worm)
op_errno = 0;