Commit 71a1f72c authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fix writeback for dirty ramdisk blockdev inodes

Once the blockdev inode for /dev/ram0 is dirtied we have a memory-backed
inode on the blockdev superblock's s_dirty list.

sync_sb_inodes() sees the memory-backed inode on the superblock and assumes
that all the other inodes on the superblock are also memory-backed.  This is
not true for the blockdev superblock!  We forget to write out dirty pages
against the following blockdevs.

Fix this by just leaving the inode dirty and moving on to inspect the other
blockdev inodes on sb->s_io.

(This is a little inefficient: an alternative is to leave dirtied
memory-backed inodes on inode_in_use, so nobody ever even considers them for
writeout.  But that introduces an inconsistency and is a bit kludgey).
parent d6266c68
......@@ -260,8 +260,21 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
struct address_space *mapping = inode->i_mapping;
struct backing_dev_info *bdi = mapping->backing_dev_info;
if (bdi->memory_backed)
if (bdi->memory_backed) {
if (sb == blockdev_superblock) {
/*
* Dirty memory-backed blockdev: the ramdisk
* driver does this.
*/
list_move(&inode->i_list, &sb->s_dirty);
continue;
}
/*
* Assume that all inodes on this superblock are memory
* backed. Skip the superblock.
*/
break;
}
if (wbc->nonblocking && bdi_write_congested(bdi)) {
wbc->encountered_congestion = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment