Bug 1437763 - File-level WORM allows ftruncate() on read-only files
Summary: File-level WORM allows ftruncate() on read-only files
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: unclassified
Version: 3.10
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Karthik U S
QA Contact:
URL:
Whiteboard: worm
Depends On: 1438810
Blocks: 1439112 glusterfs-3.10.2
TreeView+ depends on / blocked
 
Reported: 2017-03-31 06:17 UTC by Geunmoon Oh
Modified: 2020-02-10 16:42 UTC (History)
4 users (show)

Fixed In Version: glusterfs-3.10.2
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1438810 1439112 (view as bug list)
Environment:
Last Closed: 2017-05-31 20:47:07 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github #123 0 None None None 2020-02-17 04:49:41 UTC

Description Geunmoon Oh 2017-03-31 06:17:22 UTC
Description of problem:

file is truncated on File level WORM volume.

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


How reproducible:


Steps to Reproduce:
1. create worm volume (File Level)
$ gluster volume create vol_repl gm0604:/home/glu_test
$ gluster volume set vol_repl features.worm-file-level "on"
$ gluster volume set vol_repl features.worm "off"
$ gluster volume set vol_repl features.auto-commit-period 1
$ gluster volume set vol_repl features.retention-mode relax
$ gluster volume start vol_repl
$ mount -t glusterfs -o worm gm0604:/vol_repl /home/glu_gate

Volume Name: vol_repl
Type: Distribute
Volume ID: 603d32ef-9290-423d-8a66-20776d4ef252
Status: Started
Snapshot Count: 0
Number of Bricks: 1
Transport-type: tcp
Bricks:
Brick1: gm0604:/home/glu_test
Options Reconfigured:
nfs.disable: on
performance.readdir-ahead: on
transport.address-family: inet
features.worm-file-level: on
features.worm: off
features.auto-commit-period: 1
features.retention-mode: relax

2. create file on WORM volume (File Level)
$ cd /home/glu_gate
$ ls -l / > test1
$ ls -l
total 2
-rw-r--r-- 1 root root 1786 Feb 17 09:16 test1

3. delete or overwrite a file on WORM volume (File Level)
$ rm test1
rm: remove regular file 'test1'? y
rm: cannot remove 'test1': Read-only file system
$ ls -l / > test1
ls: write error: Read-only file system
$ ls -l
total 0
-rw-r--r-- 1 root root 0 Feb 17 09:16 test1

Actual results:
- the file should not be changed.

Expected results:
- the file should not be truncated.

Additional info:

Comment 1 Geunmoon Oh 2017-03-31 06:38:28 UTC
i corrected some explanation.

Actual results:
- the file was truncated.

Related github issue:
https://github.com/gluster/glusterfs/issues/123

Comment 2 Worker Ant 2017-04-05 09:17:45 UTC
REVIEW: https://review.gluster.org/16999 (features/worm: Adding implementation for ftruncate) posted (#1) for review on release-3.10 by Karthik U S (ksubrahm)

Comment 3 Worker Ant 2017-04-13 15:37:26 UTC
COMMIT: https://review.gluster.org/16999 committed in release-3.10 by Shyamsundar Ranganathan (srangana) 
------
commit 0090727aea9dfcfdd06debadeb5cf9377adca64f
Author: karthik-us <ksubrahm>
Date:   Tue Apr 4 18:57:32 2017 +0530

    features/worm: Adding implementation for ftruncate
    
    Problem:
    Since the ftruncate fop was not handled in the worm feature, when
    truncate and write was happening on a worm-retained/worm file, it was
    giving the EROFS error but truncating the file, which is not correct.
    
    > Change-Id: I1a7e904655210d78bce9e01652ac56f3783b5aed
    > BUG: 1438810
    > Signed-off-by: karthik-us <ksubrahm>
    > Reviewed-on: https://review.gluster.org/16995
    > NetBSD-regression: NetBSD Build System <jenkins.org>
    > Reviewed-by: Niels de Vos <ndevos>
    > CentOS-regression: Gluster Build System <jenkins.org>
    > Reviewed-by: Ravishankar N <ravishankar>
    > Smoke: Gluster Build System <jenkins.org>
    > Reviewed-by: Amar Tumballi <amarts>
    > Reviewed-by: Raghavendra Talur <rtalur>
    (cherry picked from commit c5a4a77848024d2adf8cd4f35d550ba90c174fc7)
    
    Change-Id: I815049d37d95597021e11b1e3d25d56bb83623c4
    BUG: 1437763
    Signed-off-by: karthik-us <ksubrahm>
    Reviewed-on: https://review.gluster.org/16999
    Smoke: Gluster Build System <jenkins.org>
    NetBSD-regression: NetBSD Build System <jenkins.org>
    CentOS-regression: Gluster Build System <jenkins.org>
    Reviewed-by: Ravishankar N <ravishankar>
    Reviewed-by: jiffin tony Thottan <jthottan>
    Reviewed-by: Shyamsundar Ranganathan <srangana>

Comment 4 Raghavendra Talur 2017-05-31 20:47:07 UTC
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-3.10.2, please open a new bug report.


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