From fc67bb6e45da96aee381ca804d79c94d4e3a59a6 Mon Sep 17 00:00:00 2001 From: vmallika Date: Thu, 13 Nov 2014 15:13:39 +0530 Subject: uss/gluster: creating file/directories inside .snaps should fail with EROFS. When an attempt is made to create file/directories inside .snaps, it fails with wrong error message as "Stale file handle". It should fail with "Read-only file system" Change-Id: I3a812a0afc4762cbb71ab180b9394c866e576a66 BUG: 1175730 Signed-off-by: vmallika Reviewed-on: http://review.gluster.org/9039 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur Signed-off-by: Sachin Pandit Reviewed-on: http://review.gluster.org/9300 Reviewed-by: Raghavendra Bhat --- tests/basic/uss.t | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/basic/uss.t b/tests/basic/uss.t index 53a36cf4639..ff59a78ad87 100644 --- a/tests/basic/uss.t +++ b/tests/basic/uss.t @@ -6,6 +6,12 @@ . $(dirname $0)/../fileio.rc . $(dirname $0)/../nfs.rc +function check_readonly() +{ + $@ 2>&1 | grep -q 'Read-only file system' + return $? +} + cleanup; TEST init_n_bricks 3; @@ -86,8 +92,8 @@ TEST ! fd_open $fd1 'w' $M0/.snaps/snap1/file2; TEST ! stat $M0/.snaps/snap1/.snaps # creating new entries in snapshots should fail -TEST ! mkdir $M0/.snaps/new -TEST ! touch $M0/.snaps/snap2/other; +TEST check_readonly mkdir $M0/.snaps/new +TEST check_readonly touch $M0/.snaps/snap2/other; TEST fd3=`fd_available` TEST fd_open $fd3 'r' $M0/dir1/.snaps/snap3/foo1 @@ -146,9 +152,9 @@ TEST ! fd_open $fd1 'w' $N0/.snaps/snap1/file2; TEST ! stat $N0/.snaps/snap1/.stat -TEST ! mkdir $N0/.snaps/new +TEST check_readonly mkdir $N0/.snaps/new -TEST ! touch $N0/.snaps/snap2/other; +TEST check_readonly touch $N0/.snaps/snap2/other; TEST fd3=`fd_available` TEST fd_open $fd3 'r' $N0/dir1/.snaps/snap3/foo1 @@ -198,8 +204,8 @@ TEST ! fd_open $fd1 'w' $M0/.history/snap1/file2; TEST ! stat $M0/.history/snap1/.history # creating new entries in snapshots should fail -TEST ! mkdir $M0/.history/new -TEST ! touch $M0/.history/snap2/other; +TEST check_readonly mkdir $M0/.history/new +TEST check_readonly touch $M0/.history/snap2/other; TEST fd3=`fd_available` TEST fd_open $fd3 'r' $M0/dir1/.history/snap3/foo1 @@ -244,9 +250,9 @@ TEST ! fd_open $fd1 'w' $N0/.history/snap1/file2; TEST ! stat $N0/.history/snap1/.stat -TEST ! mkdir $N0/.history/new +TEST check_readonly mkdir $N0/.history/new -TEST ! touch $N0/.history/snap2/other; +TEST check_readonly touch $N0/.history/snap2/other; TEST fd3=`fd_available` TEST fd_open $fd3 'r' $N0/dir1/.history/snap3/foo1 -- cgit