Skip to contentSkip to conversation

ext4/048: Fix hangup due to no free inodes

PATCH In review Ojaswin Mujoo 2 participants 4 messages Oct 28, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext4/048: Fix hangup due to no free inodes

We currently mkfs a 128MB filesystem, which gives use ~2048 free inodes on 64k blocksize. The test then keeps adding new files to a directory to trigger an htree split. For 64k this takes more than the total free inodes, which causes touch to return -ENOSPC. This leads to the while loop in induce_node_split() to never finish.

To fix this:
1. Format a 1G FS which gives us atleast 16K inodes to work with.
2. _fail if there's any error while trying to induce node split, so we dont get stuck in loop

Fixes 466ddbfd1151 ("ext4: add test for ext4_dir_entry2 wipe")
---
 tests/ext4/048 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tests/ext4/048 +6 -1
index 2031c8c8..6343ff3a 100755
@@ -69,6 +69,11 @@ induce_node_split() {
 	while [[ "$(stat --printf="%s" $testdir)" == "$dir_size" ]]; do
 		file_num=$(($file_num + 1))
 		touch $testdir/test"$(printf "%04d" $file_num)"
+		local ret=$?
+		if [[ $ret -ne 0 ]]
+		then
+			_fail "ERROR induce_node_split(): $ret"
+		fi
 	done
 	_scratch_unmount >> $seqres.full 2>&1
 }
@@ -81,7 +86,7 @@ test_file1="test0001"
 test_file2="test0002"
 test_file3="test0003"
 
-_scratch_mkfs_sized $((128 * 1024 * 1024)) >> $seqres.full 2>&1
+_scratch_mkfs_sized $((1 * 1024 * 1024 * 1024)) >> $seqres.full 2>&1
 
 # create scratch dir for testing
 # create some files with no name a substr of another name so we can grep later
Signature · 1 line
2.51.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Ojaswin Mujoo

We currently mkfs a 128MB filesystem, which gives use ~2048 free inodes on 64k blocksize. The test then keeps adding new files to a directory to trigger an htree split. For 64k this takes more than the total free inodes, which causes touch to return -ENOSPC. This leads to the while loop in induce_node_split() to never finish.

Quoted 8 lines

To fix this:
1. Format a 1G FS which gives us atleast 16K inodes to work with.
2. _fail if there's any error while trying to induce node split, so we dont get stuck in loop

Fixes 466ddbfd1151 ("ext4: add test for ext4_dir_entry2 wipe")

---

Yeah, I also hit this issue when testing LBS — file creation kept failing without breaking out of the loop, which resulted in the test case spinning endlessly.

Looks good to me. Feel free to add:

Quoted 28 lines
 tests/ext4/048 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tests/ext4/048 +6 -1
index 2031c8c8..6343ff3a 100755
@@ -69,6 +69,11 @@ induce_node_split() {
 	while [[ "$(stat --printf="%s" $testdir)" == "$dir_size" ]]; do
 		file_num=$(($file_num + 1))
 		touch $testdir/test"$(printf "%04d" $file_num)"
+		local ret=$?
+		if [[ $ret -ne 0 ]]
+		then
+			_fail "ERROR induce_node_split(): $ret"
+		fi
 	done
 	_scratch_unmount >> $seqres.full 2>&1
 }
@@ -81,7 +86,7 @@ test_file1="test0001"
 test_file2="test0002"
 test_file3="test0003"
 
-_scratch_mkfs_sized $((128 * 1024 * 1024)) >> $seqres.full 2>&1
+_scratch_mkfs_sized $((1 * 1024 * 1024 * 1024)) >> $seqres.full 2>&1
 
 # create scratch dir for testing
 # create some files with no name a substr of another name so we can grep later
#2 lore raw
Quoted 16 lines · Baokun Li
Quoted 6 lines · Ojaswin Mujoo

We currently mkfs a 128MB filesystem, which gives use ~2048 free inodes on 64k blocksize. The test then keeps adding new files to a directory to trigger an htree split. For 64k this takes more than the total free inodes, which causes touch to return -ENOSPC. This leads to the while loop in induce_node_split() to never finish.

Quoted 8 lines

To fix this:
1. Format a 1G FS which gives us atleast 16K inodes to work with.
2. _fail if there's any error while trying to induce node split, so we dont get stuck in loop

Fixes 466ddbfd1151 ("ext4: add test for ext4_dir_entry2 wipe")

---

Quoted 7 lines

Yeah, I also hit this issue when testing LBS — file creation kept failing without breaking out of the loop, which resulted in the test case spinning endlessly.

Looks good to me. Feel free to add:

Hi Baokun, I was planning to CC you since I thought you might've hit it, but missed it while sending the mail.

Thanks for the review :)

Regards,
ojaswin

Quoted 31 lines
Quoted 29 lines
 tests/ext4/048 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tests/ext4/048 +6 -1
index 2031c8c8..6343ff3a 100755
@@ -69,6 +69,11 @@ induce_node_split() {
 	while [[ "$(stat --printf="%s" $testdir)" == "$dir_size" ]]; do
 		file_num=$(($file_num + 1))
 		touch $testdir/test"$(printf "%04d" $file_num)"
+		local ret=$?
+		if [[ $ret -ne 0 ]]
+		then
+			_fail "ERROR induce_node_split(): $ret"
+		fi
 	done
 	_scratch_unmount >> $seqres.full 2>&1
 }
@@ -81,7 +86,7 @@ test_file1="test0001"
 test_file2="test0002"
 test_file3="test0003"
 
-_scratch_mkfs_sized $((128 * 1024 * 1024)) >> $seqres.full 2>&1
+_scratch_mkfs_sized $((1 * 1024 * 1024 * 1024)) >> $seqres.full 2>&1
 
 # create scratch dir for testing
 # create some files with no name a substr of another name so we can grep later
#3 lore raw
Quoted 20 lines · Ojaswin Mujoo
Quoted 19 lines · Baokun Li
Quoted 6 lines · Ojaswin Mujoo

We currently mkfs a 128MB filesystem, which gives use ~2048 free inodes on 64k blocksize. The test then keeps adding new files to a directory to trigger an htree split. For 64k this takes more than the total free inodes, which causes touch to return -ENOSPC. This leads to the while loop in induce_node_split() to never finish.

Quoted 8 lines

To fix this:
1. Format a 1G FS which gives us atleast 16K inodes to work with.
2. _fail if there's any error while trying to induce node split, so we dont get stuck in loop

Fixes 466ddbfd1151 ("ext4: add test for ext4_dir_entry2 wipe")

---

Yeah, I also hit this issue when testing LBS — file creation kept failing without breaking out of the loop, which resulted in the test case spinning endlessly.

Quoted 5 lines
Quoted 3 lines

Looks good to me. Feel free to add:

Hi Baokun, I was planning to CC you since I thought you might've hit it, but missed it while sending the mail.

No worries, the mailing list can see it as well.

Thanks for testing and fixing this. 🤝

Cheers,
Baokun