diff options
author | Andrew Morton <akpm@osdl.org> | 2006-03-24 06:18:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-24 10:33:26 -0500 |
commit | 4741c9fd36b3bcadd37238321c469049da94a4b9 (patch) | |
tree | 4b3031b04cdbf2d3c5a4fcc1965ed857f1cf0ce4 | |
parent | fa5a734e406b53761fcc5ee22366006f71112c2d (diff) |
[PATCH] set_page_dirty() return value fixes
We need set_page_dirty() to return true if it actually transitioned the page
from a clean to dirty state. This wasn't right in a couple of places. Do a
kernel-wide audit, fix things up.
This leaves open the possibility of returning a negative errno from
set_page_dirty() sometime in the future. But we don't do that at present.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | arch/cris/arch-v32/drivers/cryptocop.c | 2 | ||||
-rw-r--r-- | drivers/block/rd.c | 3 | ||||
-rw-r--r-- | fs/buffer.c | 2 | ||||
-rw-r--r-- | include/linux/fs.h | 2 | ||||
-rw-r--r-- | mm/page-writeback.c | 11 |
5 files changed, 11 insertions, 9 deletions
diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c index 501fa52d8d3a..c59ee28a35f4 100644 --- a/arch/cris/arch-v32/drivers/cryptocop.c +++ b/arch/cris/arch-v32/drivers/cryptocop.c | |||
@@ -2944,7 +2944,7 @@ static int cryptocop_ioctl_process(struct inode *inode, struct file *filp, unsig | |||
2944 | int spdl_err; | 2944 | int spdl_err; |
2945 | /* Mark output pages dirty. */ | 2945 | /* Mark output pages dirty. */ |
2946 | spdl_err = set_page_dirty_lock(outpages[i]); | 2946 | spdl_err = set_page_dirty_lock(outpages[i]); |
2947 | DEBUG(if (spdl_err)printk("cryptocop_ioctl_process: set_page_dirty_lock returned %d\n", spdl_err)); | 2947 | DEBUG(if (spdl_err < 0)printk("cryptocop_ioctl_process: set_page_dirty_lock returned %d\n", spdl_err)); |
2948 | } | 2948 | } |
2949 | for (i = 0; i < nooutpages; i++){ | 2949 | for (i = 0; i < nooutpages; i++){ |
2950 | put_page(outpages[i]); | 2950 | put_page(outpages[i]); |
diff --git a/drivers/block/rd.c b/drivers/block/rd.c index 1c54f46d3f70..940bfd7951e5 100644 --- a/drivers/block/rd.c +++ b/drivers/block/rd.c | |||
@@ -186,7 +186,8 @@ static int ramdisk_writepages(struct address_space *mapping, | |||
186 | */ | 186 | */ |
187 | static int ramdisk_set_page_dirty(struct page *page) | 187 | static int ramdisk_set_page_dirty(struct page *page) |
188 | { | 188 | { |
189 | SetPageDirty(page); | 189 | if (!TestSetPageDirty(page)) |
190 | return 1; | ||
190 | return 0; | 191 | return 0; |
191 | } | 192 | } |
192 | 193 | ||
diff --git a/fs/buffer.c b/fs/buffer.c index 11ca6eb46a33..24262ea8cc50 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -865,8 +865,8 @@ int __set_page_dirty_buffers(struct page *page) | |||
865 | } | 865 | } |
866 | write_unlock_irq(&mapping->tree_lock); | 866 | write_unlock_irq(&mapping->tree_lock); |
867 | __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); | 867 | __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); |
868 | return 1; | ||
868 | } | 869 | } |
869 | |||
870 | return 0; | 870 | return 0; |
871 | } | 871 | } |
872 | EXPORT_SYMBOL(__set_page_dirty_buffers); | 872 | EXPORT_SYMBOL(__set_page_dirty_buffers); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 0ad70c1e5e55..092cfaee0cd2 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -350,7 +350,7 @@ struct address_space_operations { | |||
350 | /* Write back some dirty pages from this mapping. */ | 350 | /* Write back some dirty pages from this mapping. */ |
351 | int (*writepages)(struct address_space *, struct writeback_control *); | 351 | int (*writepages)(struct address_space *, struct writeback_control *); |
352 | 352 | ||
353 | /* Set a page dirty */ | 353 | /* Set a page dirty. Return true if this dirtied it */ |
354 | int (*set_page_dirty)(struct page *page); | 354 | int (*set_page_dirty)(struct page *page); |
355 | 355 | ||
356 | int (*readpages)(struct file *filp, struct address_space *mapping, | 356 | int (*readpages)(struct file *filp, struct address_space *mapping, |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index c67ddc464721..893d7677579e 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -628,8 +628,6 @@ EXPORT_SYMBOL(write_one_page); | |||
628 | */ | 628 | */ |
629 | int __set_page_dirty_nobuffers(struct page *page) | 629 | int __set_page_dirty_nobuffers(struct page *page) |
630 | { | 630 | { |
631 | int ret = 0; | ||
632 | |||
633 | if (!TestSetPageDirty(page)) { | 631 | if (!TestSetPageDirty(page)) { |
634 | struct address_space *mapping = page_mapping(page); | 632 | struct address_space *mapping = page_mapping(page); |
635 | struct address_space *mapping2; | 633 | struct address_space *mapping2; |
@@ -651,8 +649,9 @@ int __set_page_dirty_nobuffers(struct page *page) | |||
651 | I_DIRTY_PAGES); | 649 | I_DIRTY_PAGES); |
652 | } | 650 | } |
653 | } | 651 | } |
652 | return 1; | ||
654 | } | 653 | } |
655 | return ret; | 654 | return 0; |
656 | } | 655 | } |
657 | EXPORT_SYMBOL(__set_page_dirty_nobuffers); | 656 | EXPORT_SYMBOL(__set_page_dirty_nobuffers); |
658 | 657 | ||
@@ -682,8 +681,10 @@ int fastcall set_page_dirty(struct page *page) | |||
682 | return (*spd)(page); | 681 | return (*spd)(page); |
683 | return __set_page_dirty_buffers(page); | 682 | return __set_page_dirty_buffers(page); |
684 | } | 683 | } |
685 | if (!PageDirty(page)) | 684 | if (!PageDirty(page)) { |
686 | SetPageDirty(page); | 685 | if (!TestSetPageDirty(page)) |
686 | return 1; | ||
687 | } | ||
687 | return 0; | 688 | return 0; |
688 | } | 689 | } |
689 | EXPORT_SYMBOL(set_page_dirty); | 690 | EXPORT_SYMBOL(set_page_dirty); |