From b4597a92ccfebf362c63977bc4bada7b65e28753 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: 1159840 Signed-off-by: vmallika Reviewed-on: http://review.gluster.org/9039 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- tests/basic/uss.t | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'tests/basic/uss.t') diff --git a/tests/basic/uss.t b/tests/basic/uss.t index 56cb757514d..f86c19d981e 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 @@ -148,9 +154,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 @@ -200,8 +206,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 @@ -246,9 +252,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