From: Tejun Heo <tj@kernel.org>
To: Jan Kara <jack@suse.cz>
Cc: Tahsin Erdogan <tahsin@google.com>, Jens Axboe <axboe@kernel.dk>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Jan Kara <jack@suse.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] writeback: inode cgroup wb switch should skip inode with zero i_count
Date: Wed, 15 Jun 2016 10:55:13 -0400 [thread overview]
Message-ID: <20160615145513.GA24102@mtj.duckdns.org> (raw)
In-Reply-To: <20160615122640.GC1607@quack2.suse.cz>
Hello, Jan.
On Wed, Jun 15, 2016 at 02:26:40PM +0200, Jan Kara wrote:
> Ugh, this looks ugly. Inode with i_count == 0 without I_FREEING set is
> sitting in inode LRU list. It may get reused at which point it would be
> actually good if it switched WB to the good one, no?
Yes, that'd be better but the switching is heuristics driven best
effort thing anyway, so occasionally failing to switch isn't critical.
> Since we actually hold i_lock and have checked the inode is not being
> freed, we can just use __iget() to grab the inode reference. That avoids
> the warning and fixes the race as well. Something like:
>
> diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
> index 989a2ce..b44ede0 100644
> --- a/fs/fs-writeback.c
> +++ b/fs/fs-writeback.c
> @@ -478,14 +478,15 @@ static void inode_switch_wbs(struct inode *inode, int new_wb_id)
> goto out_free;
> }
> inode->i_state |= I_WB_SWITCH;
> + __iget(inode);
> spin_unlock(&inode->i_lock);
>
> - ihold(inode);
> isw->inode = inode;
>
> atomic_inc(&isw_nr_in_flight);
That said, the above looks better.
Thanks!
--
tejun
next prev parent reply other threads:[~2016-06-15 14:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-13 22:37 [PATCH] writeback: inode cgroup wb switch should skip inode with zero i_count Tahsin Erdogan
2016-06-15 12:26 ` Jan Kara
2016-06-15 14:55 ` Tejun Heo [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-06-09 2:59 Tahsin Erdogan
2016-06-13 22:11 ` Tejun Heo
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=20160615145513.GA24102@mtj.duckdns.org \
--to=tj@kernel.org \
--cc=axboe@kernel.dk \
--cc=jack@suse.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tahsin@google.com \
--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).