diff options
author | Krutika Dhananjay <kdhananj@redhat.com> | 2018-08-02 21:48:34 +0530 |
---|---|---|
committer | Krutika Dhananjay <kdhananj@redhat.com> | 2018-08-14 13:49:42 +0000 |
commit | d46632247cbbeefb4798512e4426943f9768ecbf (patch) | |
tree | 1b32f90cc7ddd68eb63b932ca086c3e7720489f0 /tests/bugs/shard/unlinks-and-renames.t | |
parent | 76fcdc2a18311ece1ba0d2a191c9d3261637d41c (diff) |
features/shard: Fix crash and test case in RENAME fop
Setting the refresh flag in inode ctx in shard_rename_src_cbk()
is applicable only when the dst file exists and is sharded and
has a hard link > 1 at the time of rename.
But this piece of code is exercised even when dst doesn't exist.
In this case, the mount crashes because local->int_inodelk.loc.inode
is NULL.
Change-Id: Iaf85a5ee3dff8b01a76e11972f10f2bb9dcbd407
Updates: bz#1611692
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Diffstat (limited to 'tests/bugs/shard/unlinks-and-renames.t')
-rw-r--r-- | tests/bugs/shard/unlinks-and-renames.t | 96 |
1 files changed, 56 insertions, 40 deletions
diff --git a/tests/bugs/shard/unlinks-and-renames.t b/tests/bugs/shard/unlinks-and-renames.t index 6e5164f0b28..990ca69a8b1 100644 --- a/tests/bugs/shard/unlinks-and-renames.t +++ b/tests/bugs/shard/unlinks-and-renames.t @@ -31,9 +31,10 @@ TEST mkdir $M0/dir TEST touch $M0/dir/foo TEST touch $M0/dir/new -###################################### -##### Unlink with /.shard absent ##### -###################################### +########################################## +##### 01. Unlink with /.shard absent ##### +########################################## + TEST truncate -s 5M $M0/dir/foo TEST ! stat $B0/${V0}0/.shard TEST ! stat $B0/${V0}1/.shard @@ -45,9 +46,10 @@ TEST stat $B0/${V0}1/.shard/.remove_me EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_foo EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_foo -################################################## -##### Unlink of a sharded file without holes ##### -################################################## +###################################################### +##### 02. Unlink of a sharded file without holes ##### +###################################################### + # Create a 9M sharded file TEST dd if=/dev/zero of=$M0/dir/new bs=1024 count=9216 gfid_new=$(get_gfid_string $M0/dir/new) @@ -65,9 +67,10 @@ TEST ! stat $B0/${V0}1/dir/new EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_new EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_new -####################################### -##### Unlink with /.shard present ##### -####################################### +########################################### +##### 03. Unlink with /.shard present ##### +########################################### + TEST truncate -s 5M $M0/dir/foo gfid_foo=$(get_gfid_string $M0/dir/foo) # Ensure its shards are absent. @@ -81,9 +84,10 @@ TEST ! stat $M0/dir/foo EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_foo EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_foo -############################################################# -##### Unlink of a file with only one block (the zeroth) ##### -############################################################# +################################################################# +##### 04. Unlink of a file with only one block (the zeroth) ##### +################################################################# + TEST touch $M0/dir/foo gfid_foo=$(get_gfid_string $M0/dir/foo) TEST dd if=/dev/zero of=$M0/dir/foo bs=1024 count=1024 @@ -95,9 +99,10 @@ TEST ! stat $M0/dir/foo EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_foo EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_foo -#################################################### -##### Unlink of a sharded file with hard-links ##### -#################################################### +######################################################## +##### 05. Unlink of a sharded file with hard-links ##### +######################################################## + # Create a 9M sharded file TEST dd if=/dev/zero of=$M0/dir/original bs=1024 count=9216 gfid_original=$(get_gfid_string $M0/dir/original) @@ -154,9 +159,10 @@ TEST mkdir $M0/dir TEST touch $M0/dir/src TEST touch $M0/dir/dst -###################################### -##### Rename with /.shard absent ##### -###################################### +########################################## +##### 06. Rename with /.shard absent ##### +########################################## + TEST truncate -s 5M $M0/dir/dst gfid_dst=$(get_gfid_string $M0/dir/dst) TEST ! stat $B0/${V0}0/.shard @@ -172,9 +178,10 @@ TEST stat $B0/${V0}1/dir/dst EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_dst EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_dst -################################################## -##### Rename to a sharded file without holes ##### -################################################## +###################################################### +##### 07. Rename to a sharded file without holes ##### +###################################################### + TEST unlink $M0/dir/dst TEST touch $M0/dir/src # Create a 9M sharded file @@ -197,9 +204,10 @@ TEST stat $B0/${V0}1/dir/dst EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_dst EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_dst -################################################### -##### Rename of dst file with /.shard present ##### -################################################### +####################################################### +##### 08. Rename of dst file with /.shard present ##### +####################################################### + TEST unlink $M0/dir/dst TEST touch $M0/dir/src TEST truncate -s 5M $M0/dir/dst @@ -215,9 +223,10 @@ TEST stat $B0/${V0}1/dir/dst EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_dst EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_dst -############################################################### -##### Rename of dst file with only one block (the zeroth) ##### -############################################################### +################################################################### +##### 09. Rename of dst file with only one block (the zeroth) ##### +################################################################### + TEST unlink $M0/dir/dst TEST touch $M0/dir/src TEST dd if=/dev/zero of=$M0/dir/dst bs=1024 count=1024 @@ -233,9 +242,10 @@ TEST stat $B0/${V0}1/dir/dst EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_dst EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_dst -######################################################## -##### Rename to a dst sharded file with hard-links ##### -######################################################## +############################################################ +##### 10. Rename to a dst sharded file with hard-links ##### +############################################################ + TEST unlink $M0/dir/dst TEST touch $M0/dir/src # Create a 9M sharded file @@ -276,7 +286,10 @@ TEST ! stat $B0/${V0}1/dir/src2 EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}0/.shard/.remove_me/$gfid_dst EXPECT_WITHIN $FILE_COUNT_TIME 0 get_file_count $B0/${V0}1/.shard/.remove_me/$gfid_dst -# Rename with non-existent dst and a sharded src +############################################################## +##### 11. Rename with non-existent dst and a sharded src ##### +##############################################################l + TEST touch $M0/dir/src TEST dd if=/dev/zero of=$M0/dir/src bs=1024 count=9216 gfid_src=$(get_gfid_string $M0/dir/src) @@ -286,7 +299,7 @@ TEST stat $B0/${V0}1/.shard/$gfid_src.1 TEST stat $B0/${V0}0/.shard/$gfid_src.2 TEST stat $B0/${V0}1/.shard/$gfid_src.2 # Now rename src to the dst. -TEST mv $M0/dir/src $M0/dir/dst +TEST mv $M0/dir/src $M0/dir/dst2 TEST stat $B0/${V0}0/.shard/$gfid_src.1 TEST stat $B0/${V0}1/.shard/$gfid_src.1 @@ -295,23 +308,26 @@ TEST stat $B0/${V0}1/.shard/$gfid_src.2 TEST ! stat $M0/dir/src TEST ! stat $B0/${V0}0/dir/src TEST ! stat $B0/${V0}1/dir/src -TEST stat $M0/dir/dst -TEST stat $B0/${V0}0/dir/dst -TEST stat $B0/${V0}1/dir/dst +TEST stat $M0/dir/dst2 +TEST stat $B0/${V0}0/dir/dst2 +TEST stat $B0/${V0}1/dir/dst2 + +############################################################################# +##### 12. Rename with non-existent dst and a sharded src with no shards ##### +############################################################################# -# Rename with non-existent dst and a sharded src with no shards TEST touch $M0/dir/src TEST dd if=/dev/zero of=$M0/dir/src bs=1024 count=1024 gfid_src=$(get_gfid_string $M0/dir/src) TEST ! stat $B0/${V0}0/.shard/$gfid_src.1 TEST ! stat $B0/${V0}1/.shard/$gfid_src.1 # Now rename src to the dst. -TEST mv $M0/dir/src $M0/dir/dst +TEST mv $M0/dir/src $M0/dir/dst1 TEST ! stat $M0/dir/src TEST ! stat $B0/${V0}0/dir/src TEST ! stat $B0/${V0}1/dir/src -TEST stat $M0/dir/dst -TEST stat $B0/${V0}0/dir/dst -TEST stat $B0/${V0}1/dir/dst +TEST stat $M0/dir/dst1 +TEST stat $B0/${V0}0/dir/dst1 +TEST stat $B0/${V0}1/dir/dst1 cleanup |