linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Theodore Ts'o <tytso@mit.edu>
Cc: "Kornievskaia, Olga" <Olga.Kornievskaia@netapp.com>,
	Leonid Fedorenchik <leonid.fedorenchik@paragon-software.com>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: help with understanding evict inode functionality
Date: Sat, 3 Oct 2015 23:01:36 -0700	[thread overview]
Message-ID: <20151004060136.GA19017@infradead.org> (raw)
In-Reply-To: <20151004022802.GB4442@thunk.org>

On Sat, Oct 03, 2015 at 10:28:02PM -0400, Theodore Ts'o wrote:
> evict_inode() is what happens when i_nlink *and* i_icount hits zero.
> So it is only then that the local disk file system can actually
> release the inode and blocks associated with that inode.

That's not true.  Evict is called when we want to remove an inode
from memory.  i_count needs to be zero for that, but i_nlink doesn't
as we don't cache inodes forever.  When we drop i_count and it reaches
zero iput_final() is called, which decides depending on ->drop_inode
to either evict the inode or keep it on the LRU.

> Hence, there is no point trying to worry about what hapens if the file
> is reopened again, since the original inode is *gone*.  You could
> create a new file with the same file name, but none of the resources
> associated with the old inode need to be preserved for the newly
> created file.

And this isn't quite true either - this particular struct inode instance
might not come back, but we need to synchronize against a racing iget
if i_nlink wasn't zero.  This is done with the I_FREEING bit and the
bit wake up on __I_NEW.

  reply	other threads:[~2015-10-04  6:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-02 13:57 help with understanding evict inode functionality Leonid Fedorenchik
2015-10-02 14:38 ` Kornievskaia, Olga
2015-10-04  2:28   ` Theodore Ts'o
2015-10-04  6:01     ` Christoph Hellwig [this message]
2015-10-04 22:37       ` Theodore Ts'o
2015-10-15  9:53   ` Jan Kara
  -- strict thread matches above, loose matches on Subject: below --
2015-10-01 22:54 Kornievskaia, Olga

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=20151004060136.GA19017@infradead.org \
    --to=hch@infradead.org \
    --cc=Olga.Kornievskaia@netapp.com \
    --cc=leonid.fedorenchik@paragon-software.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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).