From 4edea128916eb76ec94fde90407eb70af6493337 Mon Sep 17 00:00:00 2001 From: Vishal Pandey Date: Tue, 24 Oct 2017 14:26:45 +0530 Subject: write once read many: file appendable in worm state Issue: A new file is appendable even when file level worm is 1. Fix: Do a state transition in writev function in worm.c file. Steps To Test: 1- Activate file level worm. 2- Create a new file. 3- Leave file dormant for auto commit period. 4- Try and append some content to the file. 5- check the file if new content has been appended or not. 6- check if file has been transitioned to Worm Retention state. Change-Id: I52d50ad888cb0c39ad54be9352ccb07d48b8d71a BUG: 1505807 Signed-off-by: Vishal Pandey --- xlators/features/read-only/src/worm.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'xlators') diff --git a/xlators/features/read-only/src/worm.c b/xlators/features/read-only/src/worm.c index 2e930c38ce3..9d034a5cf4c 100644 --- a/xlators/features/read-only/src/worm.c +++ b/xlators/features/read-only/src/worm.c @@ -403,10 +403,8 @@ worm_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, int32_t count, off_t offset, uint32_t flags, struct iobref *iobref, dict_t *xdata) { - worm_reten_state_t reten_state = {0,}; read_only_priv_t *priv = NULL; int op_errno = EROFS; - int ret = -1; priv = this->private; GF_ASSERT (priv); @@ -418,14 +416,7 @@ worm_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, op_errno = 0; goto out; } - ret = worm_get_state (this, _gf_true, fd, &reten_state); - if (ret) { - if (ret == -1) - op_errno = 0; - goto out; - } - if (!reten_state.worm) - op_errno = 0; + op_errno = gf_worm_state_transition (this, _gf_true, fd, GF_FOP_WRITE); out: if (op_errno) -- cgit