]> git.openfabrics.org - ~shefty/rdma-dev.git/blobdiff - fs/inode.c
mm: fix assertion mapping->nrpages == 0 in end_writeback()
[~shefty/rdma-dev.git] / fs / inode.c
index 0f7e88a7803f39e52b778eb30652654d7d61d2d1..43566d17d1b85643820f0c943f35f866869b9a80 100644 (file)
@@ -423,7 +423,14 @@ EXPORT_SYMBOL(remove_inode_hash);
 void end_writeback(struct inode *inode)
 {
        might_sleep();
+       /*
+        * We have to cycle tree_lock here because reclaim can be still in the
+        * process of removing the last page (in __delete_from_page_cache())
+        * and we must not free mapping under it.
+        */
+       spin_lock_irq(&inode->i_data.tree_lock);
        BUG_ON(inode->i_data.nrpages);
+       spin_unlock_irq(&inode->i_data.tree_lock);
        BUG_ON(!list_empty(&inode->i_data.private_list));
        BUG_ON(!(inode->i_state & I_FREEING));
        BUG_ON(inode->i_state & I_CLEAR);