linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* __set_page_dirty_nobuffers superfluous check
@ 2004-08-13 18:05 Marcelo Tosatti
  2004-08-14  6:46 ` Hugh Dickins
  0 siblings, 1 reply; 4+ messages in thread
From: Marcelo Tosatti @ 2004-08-13 18:05 UTC (permalink / raw)
  To: linux-mm

Hi,

While wandering through mm/page-writeback.c I noticed
__set_page_dirty_nobuffers does:

int __set_page_dirty_nobuffers(struct page *page)
{
        int ret = 0;
                                                                                         
        if (!TestSetPageDirty(page)) {
                struct address_space *mapping = page_mapping(page);
                                                                                         
                if (mapping) {
                        spin_lock_irq(&mapping->tree_lock);
                        mapping = page_mapping(page);
                        if (page_mapping(page)) { /* Race with truncate? */
                                BUG_ON(page_mapping(page) != mapping);    <------------------
                                if (!mapping->backing_dev_info->memory_backed)
                                        inc_page_state(nr_dirty);
                                radix_tree_tag_set(&mapping->page_tree,
                                        page_index(page), PAGECACHE_TAG_DIRTY);
                        }

How could the mapping ever change if we have tree_lock?

Its basically a check which assumes there might be 
buggy page->mapping writers who do so without the lock, yes?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-08-16 12:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-13 18:05 __set_page_dirty_nobuffers superfluous check Marcelo Tosatti
2004-08-14  6:46 ` Hugh Dickins
2004-08-14 13:37   ` Marcelo Tosatti
2004-08-16 12:37     ` Hugh Dickins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox