Commit 371d217e authored by Jan Kara's avatar Jan Kara Committed by Jens Axboe

char: Mark /dev/zero and /dev/kmem as not capable of writeback

These devices don't do any writeback but their device inodes still can get
dirty so mark bdi appropriately so that bdi code does the right thing and files
inodes to lists of bdi carrying the device inodes.

Cc: stable@kernel.org
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarJens Axboe <jaxboe@fusionio.com>
parent 976e48f8
...@@ -788,10 +788,11 @@ static const struct file_operations zero_fops = { ...@@ -788,10 +788,11 @@ static const struct file_operations zero_fops = {
/* /*
* capabilities for /dev/zero * capabilities for /dev/zero
* - permits private mappings, "copies" are taken of the source of zeros * - permits private mappings, "copies" are taken of the source of zeros
* - no writeback happens
*/ */
static struct backing_dev_info zero_bdi = { static struct backing_dev_info zero_bdi = {
.name = "char/mem", .name = "char/mem",
.capabilities = BDI_CAP_MAP_COPY, .capabilities = BDI_CAP_MAP_COPY | BDI_CAP_NO_ACCT_AND_WRITEBACK,
}; };
static const struct file_operations full_fops = { static const struct file_operations full_fops = {
......
...@@ -40,7 +40,9 @@ struct backing_dev_info directly_mappable_cdev_bdi = { ...@@ -40,7 +40,9 @@ struct backing_dev_info directly_mappable_cdev_bdi = {
#endif #endif
/* permit direct mmap, for read, write or exec */ /* permit direct mmap, for read, write or exec */
BDI_CAP_MAP_DIRECT | BDI_CAP_MAP_DIRECT |
BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP), BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP |
/* no writeback happens */
BDI_CAP_NO_ACCT_AND_WRITEBACK),
}; };
static struct kobj_map *cdev_map; static struct kobj_map *cdev_map;
......
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