diff options
| -rwxr-xr-x | tests/features/worm.t | 7 | ||||
| -rw-r--r-- | xlators/features/read-only/src/worm.c | 11 | 
2 files changed, 8 insertions, 10 deletions
diff --git a/tests/features/worm.t b/tests/features/worm.t index f8f05065918..c725f5858ec 100755 --- a/tests/features/worm.t +++ b/tests/features/worm.t @@ -57,6 +57,13 @@ TEST rm -f $M0/file2  sleep 10  TEST rm -f $M0/file1 +## Test for state transition over write. +TEST `echo "worm 1" > $M0/file3` +sleep 5 +TEST `echo "worm 2" >> $M0/file3` +EXPECT 'worm 1' cat $M0/file3 +TEST ! rm -f $M0/file3 +  TEST $CLI volume stop $V0  EXPECT 'Stopped' volinfo_field $V0 'Status' 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)  | 
