summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2017-04-13 11:38:08 +0530
committerVijay Bellur <vbellur@redhat.com>2017-04-18 14:35:12 -0400
commitc1e61fd5dfd118830e896a45d398a2041006d74e (patch)
tree6cfc0c09aa4c9f785cdfcfbb96f1169b9ec3da77
parent761e2dc0432d3723e0f8cbb1cf192ad386addb08 (diff)
worm: add check for internal processes in ftruncate()
The patch fixes the recently seen issues with worm_sh.t test. RCA: - $ git log --oneline xlators/features/read-only/src/worm.c 1b01bdc worm: allow Self-heal-Daemon to perform some operations c5a4a77 features/worm: Adding implementation for ftruncate - These two patches were merged in reverse order of their submission, and hence the check added for internal processes got missed in new fop 'ftruncate()'. The worm_sh.t passed the tests as while that patch got submitted there was no ftruncate() in worm xlator. Change-Id: I81a8a45fa2679917a2c859c4f5224a2c3edbc784 BUG: 1423413 Signed-off-by: Amar Tumballi <amarts@redhat.com> Reviewed-on: https://review.gluster.org/17048 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Zhou Zhengping <johnzzpcrystal@gmail.com> Reviewed-by: David Spisla <david.spisla@iternity.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--tests/features/worm_sh.t2
-rw-r--r--xlators/features/read-only/src/worm.c2
2 files changed, 1 insertions, 3 deletions
diff --git a/tests/features/worm_sh.t b/tests/features/worm_sh.t
index 76e751b235d..da7afc084b2 100644
--- a/tests/features/worm_sh.t
+++ b/tests/features/worm_sh.t
@@ -73,5 +73,3 @@ EXPECT "qwerty" get_text_xattr user.test $B0/${V0}1/file3
EXPECT "qwerty" get_text_xattr user.test $B0/${V0}0/file3
cleanup;
-#G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=000000
-#G_TESTDEF_TEST_STATUS_CENTOS6=BAD_TEST,BUG=000000
diff --git a/xlators/features/read-only/src/worm.c b/xlators/features/read-only/src/worm.c
index 9a956ccd873..0f481ec766a 100644
--- a/xlators/features/read-only/src/worm.c
+++ b/xlators/features/read-only/src/worm.c
@@ -200,7 +200,7 @@ worm_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
GF_ASSERT (priv);
if (is_readonly_or_worm_enabled (this))
goto out;
- if (!priv->worm_file) {
+ if (!priv->worm_file || (frame->root->pid < 0)) {
op_errno = 0;
goto out;
}