linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Josef Bacik <jbacik@fb.com>
Cc: Jan Kara <jack@suse.cz>,
	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 12:34:19 +0200	[thread overview]
Message-ID: <20150617103419.GE1614@quack.suse.cz> (raw)
In-Reply-To: <558043E3.9070006@fb.com>

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!

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2015-06-17 10:34 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 [this message]
2015-06-17 17:55         ` Josef Bacik
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=20150617103419.GE1614@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=david@fromorbit.com \
    --cc=dchinner@redhat.com \
    --cc=hch@infradead.org \
    --cc=jbacik@fb.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).