Commit c76aaef0 authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds

[PATCH] __set_page_dirty_nobuffers mappings

Marcelo noticed that the BUG_ON in __set_page_dirty_nobuffers doesn't make
much sense: it lost its way in 2.6.7, amidst so many page_mappings!

It's supposed to be checking that, although page->mapping may suddenly go NULL
from truncation, and although tmpfs swizzles page_mapping(page) between tmpfs
inode address_space and swapper_space, there's sufficient stabilization while
here in __set_page_dirty_nobuffers that the mapping after we locked
mapping->tree_lock is the same as the mapping before we locked
mapping->tree_lock i.e.  the lock we hold is the right one.
Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent fef60c1b
...@@ -580,12 +580,13 @@ int __set_page_dirty_nobuffers(struct page *page) ...@@ -580,12 +580,13 @@ int __set_page_dirty_nobuffers(struct page *page)
if (!TestSetPageDirty(page)) { if (!TestSetPageDirty(page)) {
struct address_space *mapping = page_mapping(page); struct address_space *mapping = page_mapping(page);
struct address_space *mapping2;
if (mapping) { if (mapping) {
spin_lock_irq(&mapping->tree_lock); spin_lock_irq(&mapping->tree_lock);
mapping = page_mapping(page); mapping2 = page_mapping(page);
if (page_mapping(page)) { /* Race with truncate? */ if (mapping2) { /* Race with truncate? */
BUG_ON(page_mapping(page) != mapping); BUG_ON(mapping2 != mapping);
if (!mapping->backing_dev_info->memory_backed) if (!mapping->backing_dev_info->memory_backed)
inc_page_state(nr_dirty); inc_page_state(nr_dirty);
radix_tree_tag_set(&mapping->page_tree, radix_tree_tag_set(&mapping->page_tree,
......
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