All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fb.com>
To: Jan Kara <jack@suse.cz>
Cc: <linux-fsdevel@vger.kernel.org>, <kernel-team@fb.com>,
	<viro@ZenIV.linux.org.uk>, <hch@infradead.org>,
	<david@fromorbit.com>, Dave Chinner <dchinner@redhat.com>
Subject: Re: [PATCH 6/8] bdi: add a new writeback list for sync
Date: Wed, 17 Jun 2015 10:55:58 -0700	[thread overview]
Message-ID: <5581B4AE.9080106@fb.com> (raw)
In-Reply-To: <20150617103419.GE1614@quack.suse.cz>

On 06/17/2015 03:34 AM, Jan Kara wrote:
> On Tue 16-06-15 08:42:27, Josef Bacik wrote:
>>>>   /*
>>>> - * Wait for writeback on an inode to complete. Caller must have inode pinned.
>>>> + * Wait for writeback on an inode to complete during eviction. Caller must have
>>>> + * inode pinned.
>>>>    */
>>>>   void inode_wait_for_writeback(struct inode *inode)
>>>>   {
>>>> +	BUG_ON(!(inode->i_state & I_FREEING));
>>>> +
>>>>   	spin_lock(&inode->i_lock);
>>>>   	__inode_wait_for_writeback(inode);
>>>>   	spin_unlock(&inode->i_lock);
>>>> +
>>>> +	/*
>>>> +	 * bd_inode's will have already had the bdev free'd so don't bother
>>>> +	 * doing the bdi_clear_inode_writeback.
>>>> +	 */
>>>> +	if (!sb_is_blkdev_sb(inode->i_sb))
>>>> +		bdi_clear_inode_writeback(inode_to_bdi(inode), inode);
>>>>   }
>>>
>>> Why do we bother with not putting bdev inode back?
>>>
>>
>> My memory is rusty on this, but if the inode is the inode for a bdev
>> we will have already free'd the bdev at this point and we get a null
>> pointer deref, so this just skips that bit.
>
> Ah, the reason likely is that bdev->bd_disk is NULL (already cleaned up in
> __blkdev_put()) at this moment and thus bdev_get_queue() called from
> inode_to_bdi() will oops. Can you please add these details to the comment?
> It's a bit subtle...
>
> Also we shouldn't have any pages in the block device mapping anymore
> because of the work done in __blkdev_put() (and thus inode shouldn't be in
> the writeback list) but I'd be calmer if we asserted
> list_empty(&inode->i_wb_list). Can you please add that? Thanks!

Won't it trip if we never sync before we drop the device tho?  So we 
write some stuff to the block device, it gets written out, we then drop 
the device for whatever reason and boom, hit BUG_ON(&inode->i_wb_list) 
because we're still on the writeback list even though it doesn't matter 
because this disk is going away.  Just an untested theory, what do you 
think?  If it is possible I suppose I could just add the clear'ing bit 
for the bd inode to before we drop bd_disk if that would make you happy. 
  Thanks,

Josef


  reply	other threads:[~2015-06-17 17:56 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-11 19:41 [PATCH 0/7] super block scalabilit patches V3 Josef Bacik
2015-06-11 19:41 ` [PATCH 1/8] writeback: plug writeback at a high level Josef Bacik
2015-06-17 12:03   ` Christoph Hellwig
2015-06-11 19:41 ` [PATCH 2/8] inode: add hlist_fake to avoid the inode hash lock in evict Josef Bacik
2015-06-17 12:03   ` Christoph Hellwig
2015-06-11 19:41 ` [PATCH 3/8] inode: convert inode_sb_list_lock to per-sb Josef Bacik
2015-06-17 12:06   ` Christoph Hellwig
2015-06-11 19:41 ` [PATCH 4/8] sync: serialise per-superblock sync operations Josef Bacik
2015-06-17 12:06   ` Christoph Hellwig
2015-06-11 19:41 ` [PATCH 5/8] inode: rename i_wb_list to i_io_list Josef Bacik
2015-06-17 12:06   ` Christoph Hellwig
2015-06-11 19:41 ` [PATCH 6/8] bdi: add a new writeback list for sync Josef Bacik
2015-06-15 14:12   ` Jan Kara
2015-06-16 15:42     ` Josef Bacik
2015-06-17 10:34       ` Jan Kara
2015-06-17 17:55         ` Josef Bacik [this message]
2015-06-18  9:28           ` Jan Kara
2015-06-18 22:18   ` [PATCH 6/8 V4] " Josef Bacik
2015-06-19  8:38     ` Jan Kara
2015-06-11 19:41 ` [PATCH 7/8] writeback: periodically trim the writeback list Josef Bacik
2015-06-11 19:41 ` [PATCH 8/8] inode: don't softlockup when evicting inodes Josef Bacik
2015-06-15 14:16   ` Jan Kara
2015-06-11 20:50 ` [PATCH 0/7] super block scalabilit patches V3 Tejun Heo
2015-06-15 21:34 ` Dave Chinner
2015-06-22  2:26   ` [PATCH] sync: wait_sb_inodes() calls iput() with spinlock held (was Re: [PATCH 0/7] super block scalabilit patches V3) Dave Chinner
2015-06-22 16:21     ` Josef Bacik
2015-06-23 23:14     ` Josef Bacik
2015-06-24  0:35       ` Dave Chinner
  -- strict thread matches above, loose matches on Subject: below --
2015-06-24  3:23 [PATCH 0/8] super block scalability patches V4 Josef Bacik
2015-06-24  3:24 ` [PATCH 6/8] bdi: add a new writeback list for sync Josef Bacik
2015-12-09 18:40   ` Brian Foster
2015-12-10 10:08     ` Jan Kara
2015-12-11 14:37       ` Brian Foster
2015-03-20 17:14 [PATCH 0/8] Sync and VFS scalability improvements V2 Josef Bacik
2015-03-20 17:14 ` [PATCH 6/8] bdi: add a new writeback list for sync Josef Bacik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5581B4AE.9080106@fb.com \
    --to=jbacik@fb.com \
    --cc=david@fromorbit.com \
    --cc=dchinner@redhat.com \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=kernel-team@fb.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.