Patch "Btrfs: igrab inode in writepage" has been added to the 3.10-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
Btrfs: igrab inode in writepage
to the 3.10-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
btrfs-igrab-inode-in-writepage.patch
and it can be found in the queue-3.10 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
be7bd730841e69fe8f70120098596f648cd1f3ffMon Sep 17 00:00:00 2001
From: Josef Bacik <[email protected]>
Date: Thu, 22 Oct 2015 15:05:09 -0400
Subject: Btrfs: igrab inode in writepage
From: Josef Bacik <[email protected]>
commit be7bd730841e69fe8f70120098596f648cd1f3ff upstream.
We hit this panic on a few of our boxes this week where we have an ordered_extent with an NULL inode. We do an igrab() of the inode in writepages, but weren't doing it in writepage which can be called directly from the VM on dirty pages. If the inode has been unlinked then we could have I_FREEING set which means igrab() would return NULL and we get this panic. Fix this by trying to igrab in btrfs_writepage, and if it returns NULL then just redirty the page and return AOP_WRITEPAGE_ACTIVATE; so the VM knows it wasn't successful. Thanks,
--- fs/btrfs/inode.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
fs/btrfs/inode.c +15 -2
@@ -7477,15 +7477,28 @@ int btrfs_readpage(struct file *file, ststatic int btrfs_writepage (struct page *page,struct writeback_control *wbc) {struct extent_io_tree *tree; - +struct inode *inode = page->mapping->host; +int ret;if (current->flags &PF_MEMALLOC ) {redirty_page_for_writepage (wbc, page);unlock_page (page);return 0 ; } + +/* +* If we are under memory pressure we will call this directly from the +* VM, we need to make sure we have the inode referenced for the ordered +* extent. If not just return like we didn't do anything. +*/ +if (!igrab (inode)) { +redirty_page_for_writepage (wbc, page); +return AOP_WRITEPAGE_ACTIVATE ; + } tree = &BTRFS_I (page->mapping->host)->io_tree; -return extent_write_full_page (tree, page, btrfs_get_extent, wbc); + ret =extent_write_full_page (tree, page, btrfs_get_extent, wbc); +btrfs_add_delayed_iput (inode); +return ret; } static int btrfs_writepages(struct address_space *mapping,
Patches currently in stable-queue which might be from [email protected] are
queue-3.10/btrfs-igrab-inode-in-writepage.patch