@@ -33,6 +33,7 @@
#include <linux/task_io_accounting_ops.h>
#include <linux/falloc.h>
#include <linux/uaccess.h>
+#include <linux/delay.h>
#include "internal.h"
struct bdev_inode {
@@ -1875,6 +1876,8 @@ static void __blkdev_put(struct block_device
*bdev, fmode_t mode, int for_part)
sync_blockdev(bdev);
kill_bdev(bdev);
+ /* Allow time for writeback thread to clear I_DIRTY flags */
+ mdelay(200);
bdev_write_inode(bdev);
/*
* Detaching bdev inode from its wb in __destroy_inode()
@@ -28,6 +28,7 @@
#include <linux/tracepoint.h>
#include <linux/device.h>
#include <linux/memcontrol.h>
+#include <linux/delay.h>
#include "internal.h"
/*
@@ -1585,6 +1586,10 @@ static long writeback_sb_inodes(struct super_block *sb,
cond_resched();
}
+ /* Allow __blkdev_put() to run inode_detach_wb() */
+ if (inode->i_ino == 0)
+ mdelay(200);
+
/*
* Requeue @inode if still dirty. Be careful as @inode may
* have been switched to another wb in the meantime.
new file mode 100755
@@ -0,0 +1,10 @@
+#!/bin/bash
+set -ex
+
+echo 100 > /proc/sys/vm/dirty_expire_centisecs
+echo 100 > /proc/sys/vm/dirty_writeback_centisecs
+
+mount /dev/sdb /mnt/sdb
+sleep 0.9
+echo 10 > /proc/sys/vm/dirty_writeback_centisecs
+umount /dev/sdb