#!/bin/bash sysctl -w kernel.hung_task_timeout_secs=15 umount /root/temp mkfs.ext4 -F -b 4096 /dev/sda 100M mount /dev/sda /root/temp dd if=/dev/zero of=/root/temp/file bs=4K count=1 for i in {0..1100} do touch /root/temp/f_$i dd if=/dev/zero of=/root/temp/f_$i bs=4K count=1 dd if=/dev/zero of=/root/temp/f_$i bs=4K count=1 seek=2 dd if=/dev/zero of=/root/temp/f_$i bs=4K count=1 seek=4 dd if=/dev/zero of=/root/temp/f_$i bs=4K count=1 seek=6 done dd if=/dev/zero of=/root/temp/consumer bs=1M count=68 umount /root/temp mount -odiscard /dev/sda /root/temp for i in {0..1100} do dd if=/dev/zero of=/root/temp/f_$i bs=4K count=1 seek=8 & done sleep 1 dmesg -c > /dev/null wait sync & sleep 1 while true do res=`dmesg -c` if [[ "$res" =~ "wait free" ]] then echo "delete file" rm -f /root/temp/file break; elif [[ "$res" =~ "will hung" ]] then echo "will hung" break; fi sleep 1 done