summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/features/read-only/src/read-only.c3
-rw-r--r--xlators/features/read-only/src/worm.c8
2 files changed, 8 insertions, 3 deletions
diff --git a/xlators/features/read-only/src/read-only.c b/xlators/features/read-only/src/read-only.c
index d72b2c8fd2b..207b2b1a1d6 100644
--- a/xlators/features/read-only/src/read-only.c
+++ b/xlators/features/read-only/src/read-only.c
@@ -46,9 +46,10 @@ init (xlator_t *this)
if (!priv)
goto out;
+ this->private = priv;
+
GF_OPTION_INIT ("read-only", priv->readonly_or_worm_enabled, bool, out);
- this->private = priv;
ret = 0;
out:
return ret;
diff --git a/xlators/features/read-only/src/worm.c b/xlators/features/read-only/src/worm.c
index d37a930c1fc..088dd5a1b23 100644
--- a/xlators/features/read-only/src/worm.c
+++ b/xlators/features/read-only/src/worm.c
@@ -434,9 +434,12 @@ worm_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
op_errno = gf_worm_state_transition (this, _gf_true, fd, GF_FOP_WRITE);
out:
- if (op_errno)
+ if (op_errno) {
+ if (op_errno < 0)
+ op_errno = EROFS;
STACK_UNWIND_STRICT (writev, frame, -1, op_errno, NULL, NULL,
NULL);
+ }
else
STACK_WIND_TAIL (frame, FIRST_CHILD (this),
FIRST_CHILD (this)->fops->writev,
@@ -535,6 +538,8 @@ init (xlator_t *this)
goto out;
}
+ this->private = priv;
+
GF_OPTION_INIT ("worm", priv->readonly_or_worm_enabled,
bool, out);
GF_OPTION_INIT ("worm-file-level", priv->worm_file, bool, out);
@@ -545,7 +550,6 @@ init (xlator_t *this)
GF_OPTION_INIT ("worm-files-deletable", priv->worm_files_deletable,
bool, out);
- this->private = priv;
ret = 0;
out:
return ret;