Bug 1487504 - files are appendable on file-based worm volume
Summary: files are appendable on file-based worm volume
Keywords:
Status: CLOSED EOL
Alias: None
Product: GlusterFS
Classification: Community
Component: unclassified
Version: 3.11
Hardware: Unspecified
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Vishal Pandey
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-09-01 06:09 UTC by Jurgen Reij
Modified: 2017-11-21 05:59 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1505807 (view as bug list)
Environment:
Last Closed: 2017-11-21 05:59:22 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)
sosreport client (7.40 MB, application/x-xz)
2017-09-01 06:27 UTC, Jurgen Reij
no flags Details
sosreport server (7.55 MB, application/x-xz)
2017-09-01 06:27 UTC, Jurgen Reij
no flags Details

Description Jurgen Reij 2017-09-01 06:09:15 UTC
Description of problem:
it is possible to append a file in immutable and undeletable state on a file-based worm volume

Version-Release number of selected component (if applicable):
3.11.2

How reproducible:
[vagrant@client1 share]$ date && echo "testfile" >> testfile
Wed Aug 30 09:03:51 CEST 2017
[vagrant@client1 share]$ date && rm testfile
Wed Aug 30 09:04:07 CEST 2017
rm: cannot remove ‘testfile’: Read-only file system
[vagrant@client1 share]$ date && echo "testfile" >> testfile
Wed Aug 30 09:04:12 CEST 2017
[vagrant@client1 share]$ date && echo "testfile" >> testfile
Wed Aug 30 09:05:17 CEST 2017
[vagrant@client1 share]$ date && rm testfile
Wed Aug 30 09:05:21 CEST 2017
[vagrant@client1 share]$



Steps to Reproduce:
1.create volume. enable file-based worm
2.features.worm-file-level: on
features.default-retention-period: 60
features.auto-commit-period: 5
3.follows steps in "how reproducible"

Actual results:
the file was appended

Expected results:
it should not be possible to append files in immutable undeletable state 


Additional info:

Comment 1 Jurgen Reij 2017-09-01 06:27:04 UTC
Created attachment 1320841 [details]
sosreport client

Comment 2 Jurgen Reij 2017-09-01 06:27:47 UTC
Created attachment 1320842 [details]
sosreport server

Comment 3 Karthik U S 2017-09-06 07:16:15 UTC
It is not appending any content to the worm-retained file. The problem here is when we do an append write we do not print the EROFS error. If you check the actual contents of the file after the append write it won't be changed.
Try appending some new contents instead of doing
echo "testfile" >> testfile
which is same as the original content of the file. If you see the brick logs it will show the EROFS error message for the append writes.

If you can see the new contents appended to the worm-retained/worm file, please let me know.

Comment 4 Jurgen Reij 2017-09-28 09:40:46 UTC
Karthik,

See my results:

[vagrant@client1 share]$ date && echo "test1" >> testfile
Thu Sep 28 11:38:57 CEST 2017
[vagrant@client1 share]$ date && echo "test2" >> testfile
Thu Sep 28 11:39:10 CEST 2017
[vagrant@client1 share]$ cat testfile
test1
test2

Comment 5 Karthik U S 2017-09-28 10:20:37 UTC
Hi Jurgen Reij,

Current code does not have the state transition mechanism in the write code path. This is a bug and we have a dependency on some other thing for this. Once that is fixed we will do transition in the write path as well, so the next writes will be blocked.
Let me try to explain the scenario in your test. First you created the testfile. After 13 seconds you are trying to do append write, and expect it to be blocked since the auto-commit-period is 10secs. Since it is an append write, and not link, unlink, rename, or truncate (the only 4 fops which does the state transition in the current code), it won't check for the state transition  and does the next write. So the content gets updated.
Instead of checking only the date, check the stat of the file. The atime will point to a future value after state transition to worm-retained state which will then be equal to the "time at which transition happened + the retention period". In normal state it will allow append write.

We will fix the behaviour so write fops will also do the state transition.

Comment 6 Worker Ant 2017-10-24 09:15:24 UTC
REVIEW: https://review.gluster.org/18560 (write once read many: file appendable in worm state) posted (#1) for review on master by Vishal Pandey (vpandey)

Comment 7 Worker Ant 2017-10-24 09:40:20 UTC
REVIEW: https://review.gluster.org/18560 (write once read many: file appendable in worm state) posted (#2) for review on master by Vishal Pandey (vpandey)

Comment 8 Karthik U S 2017-11-21 05:59:22 UTC
This issue is fixed in mainline by https://review.gluster.org/#/c/18560/ and will be available in the next release. Since version 3.11 is EOL closing this bug.


Note You need to log in before you can comment on or make changes to this bug.