[BUG] Oops in inode_to_bdi()
diff mbox

Message ID 54BFFEF3.1070809@fb.com
State New, archived
Headers show

Commit Message

Jens Axboe Jan. 21, 2015, 7:33 p.m. UTC
On 01/21/2015 12:29 PM, Christoph Hellwig wrote:
> On Wed, Jan 21, 2015 at 12:17:07PM -0700, Jens Axboe wrote:
>> Christoph,
>>
>> Ran into this one while testing. Looks like mapping->host is NULL, off
>> the shmem_writepage().
>
> Hmm.  Not sure how this can happen, but for a NULL inode we can
> always just return noop_backing_dev_info safely, I'll cook up a patch.

I got 8 of them in a row. Current kernel is running with the attached, 
just to see if I can reproduce it.

Comments

Jens Axboe Jan. 21, 2015, 8:04 p.m. UTC | #1
On 01/21/2015 12:33 PM, Jens Axboe wrote:
> On 01/21/2015 12:29 PM, Christoph Hellwig wrote:
>> On Wed, Jan 21, 2015 at 12:17:07PM -0700, Jens Axboe wrote:
>>> Christoph,
>>>
>>> Ran into this one while testing. Looks like mapping->host is NULL, off
>>> the shmem_writepage().
>>
>> Hmm.  Not sure how this can happen, but for a NULL inode we can
>> always just return noop_backing_dev_info safely, I'll cook up a patch.
>
> I got 8 of them in a row. Current kernel is running with the attached,
> just to see if I can reproduce it.

Works fine with the debug patch. Added a page dump for when we hit this:

page:ffffea0001afa680 count:2 mapcount:0 mapping:          (null) index:0x0
flags: 0x40000000000d0009(locked|uptodate|swapcache|reclaim|swapbacked)

I'll commit the NULL inode work-around.

Patch
diff mbox

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index a20b1145f4d5..4f03e33365e1 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -68,7 +68,12 @@  EXPORT_SYMBOL(writeback_in_progress);
 
 struct backing_dev_info *inode_to_bdi(struct inode *inode)
 {
-	struct super_block *sb = inode->i_sb;
+	struct super_block *sb;
+
+	if (WARN_ON(!inode))
+		return &noop_backing_dev_info;
+
+	sb = inode->i_sb;
 #ifdef CONFIG_BLOCK
 	if (sb_is_blkdev_sb(sb))
 		return blk_get_backing_dev_info(I_BDEV(inode));