Skip to content

Commit e716e58

Browse files
committed
BUG REPORT:bug in gc: inconsistent valid blocks
1 parent 62c9ed8 commit e716e58

File tree

9 files changed

+123
-0
lines changed

9 files changed

+123
-0
lines changed

fs/hmfs/build.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
if [ "$1" == "hmfs" ]
4+
then
5+
insmod ./hmfs.ko
6+
sudo mount -t hmfs -o physaddr=0x4B000000,init=100M none ~/mount_hmfs/
7+
elif [ "$1" == "nohmfs" ]
8+
then
9+
umount ~/mount_hmfs
10+
rmmod hmfs
11+
fi

fs/hmfs/test/create.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
num_file=2048
4+
5+
#create testing files, they will be orphan files later
6+
for ((i=0; i<$num_file; i++)); do
7+
touch ~/mount_hmfs/orphan_$i.txt
8+
echo "this is a test file" > ~/mount_hmfs/orphan_$i.txt
9+
done
10+
11+
echo "$num_file files created..."

fs/hmfs/test/delete.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
num_file=2048
4+
for ((i=0; i<$num_file; i++)); do
5+
#remove the file will create an orhan file
6+
rm ~/mount_hmfs/orphan_$i.txt
7+
done
8+
9+
echo "$num_file files deleted..."
10+
11+
#check the cmi info
12+
. ./info.sh "cmi"
13+
14+
#sync the file to enforce doing checkpoint
15+
sync

fs/hmfs/test/hold_file_open.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/python3
2+
from os.path import expanduser
3+
4+
5+
home = expanduser('~')
6+
file_list = []
7+
for i in range(2048):
8+
with open(home + "/mount_hmfs/orphan_{:d}.txt".format(i), 'w') as file:
9+
file_list.append(file)
10+
file.write("ssssssssssssssssssss")
11+
12+
#hold files
13+
while True:
14+
pass

fs/hmfs/test/info.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
hmfs_debug_dir=/sys/kernel/debug/hmfs/1258291200/info
4+
echo "$1" > ${hmfs_debug_dir} & cat ${hmfs_debug_dir}

fs/hmfs/test/mount_f2fs.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# create a 100M file
4+
dd if=/dev/zero of=/opt/dev0-backstore bs=1M count=100
5+
6+
# create the loopback block device
7+
mknod /dev/fake-dev0 b 7 200
8+
9+
losetup /dev/fake-dev0 /opt/dev0-backstore
10+
mount -t f2fs /dev/fake-dev0 ~/mount_f2fs/

fs/hmfs/test/open.c

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
4+
int main(void)
5+
{
6+
FILE* fps[2048];
7+
char filename[100];
8+
for (int i = 0; i < 2048; i++) {
9+
sprintf(filename, "/home/wgtdkp/mount_hmfs/orphan_%d.txt", i);
10+
printf("%s\n", filename);
11+
fps[i] = fopen(filename, "r");
12+
if (!fps[i])
13+
printf("error!\n");
14+
}
15+
while (1) {}
16+
return 0;
17+
}

fs/hmfs/test/orphan_test.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
num_file=2048
4+
cd ~/mount_hmfs/
5+
6+
#create testing files, they will be orphan files later
7+
for ((i=0; i<$num_file; i++)); do
8+
touch orphan_$i.txt
9+
echo "this is a test file" > orphan_$i.txt
10+
done
11+
12+
echo ${num_file} "file created"
13+
14+
#python3 $HOME/hmfs/fs/hmfs/test/hold_file_open.py &
15+
16+
#for ((i=0; i<$num_file; i++)); do
17+
#remove the file will create an orhan file
18+
# rm orphan_$i.txt
19+
#done
20+
21+
#cd $HOME/hmfs/fs/hmfs/test/
22+
#check the cmi info
23+
#. ./info.sh "cmi"
24+
25+
#sync the file to enforce doing checkpoint
26+
#sync
27+
28+
29+
30+
31+

fs/hmfs/test/reproduce.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
cd $HOME/hmfs/fs/hmfs/test/
4+
5+
. ./create.sh
6+
. ./delete.sh
7+
. ./create.sh
8+
. ./delete.sh
9+
. ./create.sh
10+
. ./delete.sh

0 commit comments

Comments
 (0)