MAINTAINERS: pass on hwpoison maintainership to Naoya Horiguchi
[pandora-kernel.git] / mm / filemap.c
index 000a220..021056c 100644 (file)
@@ -257,9 +257,11 @@ static int filemap_check_errors(struct address_space *mapping)
 {
        int ret = 0;
        /* Check for outstanding write errors */
-       if (test_and_clear_bit(AS_ENOSPC, &mapping->flags))
+       if (test_bit(AS_ENOSPC, &mapping->flags) &&
+           test_and_clear_bit(AS_ENOSPC, &mapping->flags))
                ret = -ENOSPC;
-       if (test_and_clear_bit(AS_EIO, &mapping->flags))
+       if (test_bit(AS_EIO, &mapping->flags) &&
+           test_and_clear_bit(AS_EIO, &mapping->flags))
                ret = -EIO;
        return ret;
 }
@@ -740,7 +742,7 @@ void unlock_page(struct page *page)
 {
        VM_BUG_ON_PAGE(!PageLocked(page), page);
        clear_bit_unlock(PG_locked, &page->flags);
-       smp_mb__after_clear_bit();
+       smp_mb__after_atomic();
        wake_up_page(page, PG_locked);
 }
 EXPORT_SYMBOL(unlock_page);
@@ -757,7 +759,7 @@ void end_page_writeback(struct page *page)
        if (!test_clear_page_writeback(page))
                BUG();
 
-       smp_mb__after_clear_bit();
+       smp_mb__after_atomic();
        wake_up_page(page, PG_writeback);
 }
 EXPORT_SYMBOL(end_page_writeback);