From: Dave Chinner <david@fromorbit.com>
To: Jan Kara <jack@suse.cz>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
Al Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: The bug of iput() removal from flusher thread?
Date: Wed, 21 Nov 2012 13:44:05 +1100 [thread overview]
Message-ID: <20121121024405.GN2591@dastard> (raw)
In-Reply-To: <20121121014851.GH10507@quack.suse.cz>
On Wed, Nov 21, 2012 at 02:48:51AM +0100, Jan Kara wrote:
>
> diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
> index 51ea267..3e3422f 100644
> --- a/fs/fs-writeback.c
> +++ b/fs/fs-writeback.c
> @@ -228,6 +228,8 @@ static void requeue_io(struct inode *inode, struct bdi_writeback *wb)
> static void inode_sync_complete(struct inode *inode)
> {
> inode->i_state &= ~I_SYNC;
> + /* If inode is clean an unused, put it into LRU now... */
> + inode_add_lru(inode);
> /* Waiters must see I_SYNC cleared before being woken up */
> smp_mb();
> wake_up_bit(&inode->i_state, __I_SYNC);
> diff --git a/fs/inode.c b/fs/inode.c
> index b03c719..8f6396f 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -408,6 +408,19 @@ static void inode_lru_list_add(struct inode *inode)
> spin_unlock(&inode->i_sb->s_inode_lru_lock);
> }
>
> +/*
> + * Add inode to LRU if needed (inode is unused and clean).
> + *
> + * Needs inode->i_lock held.
> + */
> +void inode_add_lru(struct inode *inode)
> +{
> + if (!(inode->i_state & (I_DIRTY | I_FREEING | I_SYNC)) &&
> + !atomic_read(&inode->i_count) && inode->i_sb->s_flags & MS_ACTIVE)
> + inode_lru_list_add(inode);
Needs to avoid I_WILL_FREE as well. There's no point putting it on
the LRU if we are writing from iput_final()....
Otherwise looks OK.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2012-11-21 2:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-17 8:42 The bug of iput() removal from flusher thread? OGAWA Hirofumi
2012-11-19 8:56 ` OGAWA Hirofumi
2012-11-19 14:51 ` Jan Kara
2012-11-19 19:41 ` Jan Kara
2012-11-19 20:51 ` OGAWA Hirofumi
2012-11-19 21:24 ` Jan Kara
2012-11-19 21:53 ` OGAWA Hirofumi
2012-11-21 1:11 ` Jan Kara
2012-11-21 1:48 ` Jan Kara
2012-11-21 2:44 ` Dave Chinner [this message]
2012-11-21 17:08 ` Jan Kara
2012-11-21 8:05 ` Andrew Morton
2012-11-21 8:22 ` Dave Chinner
2012-11-20 22:37 ` Dave Chinner
2012-11-21 1:30 ` Jan Kara
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=20121121024405.GN2591@dastard \
--to=david@fromorbit.com \
--cc=hirofumi@mail.parknet.co.jp \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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).