linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Zhihui Zhang <zzhsuny@gmail.com>, Chris Mason <clm@fb.com>,
	Theodore Ts'o <tytso@mit.edu>,
	swhiteho@redhat.com, mfasheh@suse.com,
	linux-fsdevel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] Remove I_WILL_FREE
Date: Tue, 5 Jan 2016 18:08:58 +0100	[thread overview]
Message-ID: <20160105170858.GC18604@quack.suse.cz> (raw)
In-Reply-To: <20160102051810.GI9938@ZenIV.linux.org.uk>

On Sat 02-01-16 05:18:11, Al Viro wrote:
> [akpm Cc'd]
> On Fri, Jan 01, 2016 at 10:12:54PM -0500, Zhihui Zhang wrote:
> > You are right, I was thinking from the perspective of I_WILL_FREE.
> > 
> > However, for the examples in fs-writeback.c and a few in
> > ext4/btrfs/inode.c, we can argue that they really should check
> > I_WILL_FREE as well. In theory, bad things can happen if they don't
> > because as soon as I_WILL_FREE is set, the inode is going to be
> > evicted. For example, in fs-writeback.c:
> > 
> >  471         spin_lock(&inode->i_lock);
> >  472         if (inode->i_state & (I_WB_SWITCH | I_FREEING) ||
> > 
> >                                         <-- Assume I_WILL_FREE is set
> > at this point.
> > 
> >  473             inode_to_wb(inode) == isw->new_wb) {
> >  474                 spin_unlock(&inode->i_lock);
> >  475                 goto out_free;
> >  476         }
> >  477         inode->i_state |= I_WB_SWITCH;
> >  478         spin_unlock(&inode->i_lock);
> >  479
> >  480         ihold(inode);    <--  This will cause a warning because of i_count.
> 
> Hmm...   That ihold() is actually a lot more recent than original
> introduction of I_WILL_FREE, but looking at the state of the tree
> back when it was originally introduced...  I'm trying to recall
> what made us go for a separate flag, but so far I've got nothing
> definite.  Hell knows - it had been 10 years ago, and I have a gap
> from late 2004 to September 2005 in mailboxes, so those are no help
> either...  I _think_ it got discussed with akpm, maybe he would be
> able to help reconstructing what happened.
> 
> It looks like you are right regarding the current state of the tree, but
> I really wonder if there's something subtle that got missed during
> one of rewrites in those ten years...  OTOH, it's quite possible that there
> had been no good reason for using a separate flag from the very beginning.

Just for record, I don't see a reason for distinguishing between I_FREEING
and I_WILL_FREE either. There could have been some difference back then
when pdflush was still grabbing inode references to writeback inodes and
there was no other explicit writeback barrier when evicting inodes (these
days we have inode_wait_for_writeback() in evict()). But it's all just
guessing.

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

      parent reply	other threads:[~2016-01-05 17:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-02  1:52 [PATCH] Remove I_WILL_FREE Zhihui Zhang
2016-01-02  2:31 ` Al Viro
2016-01-02  3:12   ` Zhihui Zhang
2016-01-02  5:18     ` Al Viro
2016-01-02 15:54       ` Zhihui Zhang
2016-01-05 17:08       ` Jan Kara [this message]

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=20160105170858.GC18604@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=clm@fb.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mfasheh@suse.com \
    --cc=swhiteho@redhat.com \
    --cc=tytso@mit.edu \
    --cc=viro@ZenIV.linux.org.uk \
    --cc=zzhsuny@gmail.com \
    /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).