linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Andrew Morton <akpm@osdl.org>
Cc: dedekind@infradead.org, miklos@szeredi.hu,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] VFS bugfix: two read_inode() calles without clear_inode() call between
Date: Thu, 05 May 2005 10:10:40 +0100	[thread overview]
Message-ID: <1115284240.12012.416.camel@baythorne.infradead.org> (raw)
In-Reply-To: <20050504145811.63e9bb10.akpm@osdl.org>

On Wed, 2005-05-04 at 14:58 -0700, Andrew Morton wrote:
> That doesn't really settle the question of whether the callers are broken,
> whether they are doing something which the VFS really should support and
> what need to be done to the VFS to support it properly.

Filesystems exported by NFS _will_ get iget() called for recently-
deleted inodes. JFFS2 and (I believe) NTFS also do internal things which
end up having the same effect.

The premise is simple: regardless of who calls iget() and when they do
it, the VFS should not call the filesystem's read_inode() method twice
consecutively for the same inode without ever calling clear_inode() or
delete_inode() in between.

That's what __wait_on_freeing_inode() was introduced for -- so we can
make sure the clear_inode() call actually happened before we call
read_inode() again for the same inode. Unfortunately there is still a
code path where we can get it wrong, and that's what Artem is fixing.

> Looking at the proposed patch: what happens if an inode is on its way to
> dispose_list() and someone tries to do an iget() on it?  I don't think I_LOCK
> is set, so __wait_on_freeing_inode() will no longer provide this guarantee:

> /*
>  * If we try to find an inode in the inode hash while it is being deleted, we
>  * have to wait until the filesystem completes its deletion before reporting
>  * that it isn't found.  This is because iget will immediately call
>  * ->read_inode, and we want to be sure that evidence of the deletion is found
>  * by ->read_inode.

That comment isn't true any more. Look at what __wait_on_freeing_inode()
actually does, and observe the fact that all its callers actually loop
and start again after calling it. 

The current implementation of __wait_on_freeing_inode() waits until it
_might_ have changed, not until it _has_ changed. That's why it's OK for
it just to be a yield() or a wait on a bit_waitqueue.

I'm not convinced I _like_ that implementation, mind you -- it's changed
since I last looked at it. But I don't see that there's anything
strictly broken about it.

-- 
dwmw2



  reply	other threads:[~2005-05-05  9:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-27 13:15 [PATCH] VFS bugfix: two read_inode() calles without clear_inode() call between Artem B. Bityuckiy
2005-04-27 13:42 ` Jan Harkes
2005-04-27 14:22 ` Miklos Szeredi
2005-04-27 15:57 ` Miklos Szeredi
2005-04-27 16:19   ` Artem B. Bityuckiy
     [not found]     ` <E1DQqZu-0002Rf-00@dorka.pomaz.szeredi.hu>
2005-04-28  7:32       ` Artem B. Bityuckiy
2005-04-28  7:34         ` Andrew Morton
2005-05-04 12:17           ` Artem B. Bityuckiy
2005-05-04 20:04             ` Andrew Morton
2005-05-04 21:35               ` David Woodhouse
2005-05-04 21:58                 ` Andrew Morton
2005-05-05  9:10                   ` David Woodhouse [this message]
2005-05-05 16:18                     ` Miklos Szeredi
2005-05-06 11:08                       ` David Woodhouse
2005-06-13 14:45               ` Synchronous FAT Artem B. Bityuckiy
2005-06-14  1:06                 ` Coywolf Qi Hunt
2005-06-14 12:16                   ` Artem B. Bityuckiy
2005-06-15  1:19                     ` Coywolf Qi Hunt
2005-04-28  7:41         ` [PATCH] VFS bugfix: two read_inode() calles without clear_inode() call between Miklos Szeredi
2005-04-28  7:47           ` Artem B. Bityuckiy
  -- strict thread matches above, loose matches on Subject: below --
2005-04-19 12:38 Artem B. Bityuckiy

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=1115284240.12012.416.camel@baythorne.infradead.org \
    --to=dwmw2@infradead.org \
    --cc=akpm@osdl.org \
    --cc=dedekind@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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).