bdi: Fix warnings in __mark_inode_dirty for /dev/zero and friends
commit692ebd17c2905313fff3c504c249c6a0faad16ec
authorJan Kara <jack@suse.cz>
Tue, 21 Sep 2010 09:51:01 +0000 (21 11:51 +0200)
committerJens Axboe <jaxboe@fusionio.com>
Wed, 22 Sep 2010 07:48:47 +0000 (22 09:48 +0200)
tree656c80512505d5b117bd01e25d66d88d7cfe9851
parent371d217ee1ff8b418b8f73fb2a34990f951ec2d4
bdi: Fix warnings in __mark_inode_dirty for /dev/zero and friends

Inodes of devices such as /dev/zero can get dirty for example via
utime(2) syscall or due to atime update. Backing device of such inodes
(zero_bdi, etc.) is however unable to handle dirty inodes and thus
__mark_inode_dirty complains.  In fact, inode should be rather dirtied
against backing device of the filesystem holding it. This is generally a
good rule except for filesystems such as 'bdev' or 'mtd_inodefs'. Inodes
in these pseudofilesystems are referenced from ordinary filesystem
inodes and carry mapping with real data of the device. Thus for these
inodes we have to use inode->i_mapping->backing_dev_info as we did so
far. We distinguish these filesystems by checking whether sb->s_bdi
points to a non-trivial backing device or not.

Example: Assume we have an ext3 filesystem on /dev/sda1 mounted on /.
There's a device inode A described by a path "/dev/sdb" on this
filesystem. This inode will be dirtied against backing device "8:0"
after this patch. bdev filesystem contains block device inode B coupled
with our inode A. When someone modifies a page of /dev/sdb, it's B that
gets dirtied and the dirtying happens against the backing device "8:16".
Thus both inodes get filed to a correct bdi list.

Cc: stable@kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
fs/fs-writeback.c