mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kirill Tkhai <ktkhai@virtuozzo.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: Commit "new primitive: discard_new_inode()" introduces a problem
Date: Thu, 2 Aug 2018 10:43:21 +0300	[thread overview]
Message-ID: <2df86b53-3db4-6ca8-2b81-8b4d8fd78628@virtuozzo.com> (raw)
In-Reply-To: <20180801163408.GR30522@ZenIV.linux.org.uk>

On 01.08.2018 19:34, Al Viro wrote:
> On Wed, Aug 01, 2018 at 07:19:35PM +0300, Kirill Tkhai wrote:
>> On 01.08.2018 19:16, Al Viro wrote:
>>> On Wed, Aug 01, 2018 at 05:11:51PM +0100, Al Viro wrote:
>>>> On Wed, Aug 01, 2018 at 06:43:56PM +0300, Kirill Tkhai wrote:
>>>>> #git status
>>>>> HEAD detached at 22dc9a168272
>>>>
>>>> Wait a sec - just that commit?  With discard_new_inode() not even
>>>> used anywhere?  Then any of those -ENOMEM is disguised ERR_PTR(-ESTALE)
>>>> from find_inode()/find_inode_fast(), i.e. an inode found by
>>>> iget5_locked() (your /etc is on ext4) with I_CREATING still set.
>>>
>>> iget_locked(), that is.
> 
> OK, I see what's going on there.  See if this fixes the problem:
> 
> diff --git a/fs/dcache.c b/fs/dcache.c
> index 0e8e5de3c48a..b11f566bcd66 100644
> --- a/fs/dcache.c
> +++ b/fs/dcache.c
> @@ -1892,7 +1892,7 @@ void d_instantiate_new(struct dentry *entry, struct inode *inode)
>  	spin_lock(&inode->i_lock);
>  	__d_instantiate(entry, inode);
>  	WARN_ON(!(inode->i_state & I_NEW));
> -	inode->i_state &= ~I_NEW;
> +	inode->i_state &= ~I_NEW & ~I_CREATING;
>  	smp_mb();
>  	wake_up_bit(&inode->i_state, __I_NEW);
>  	spin_unlock(&inode->i_lock);

Yeah, this fixes the problem.

Tested-by: Kirill Tkhai <ktkhai@virtuozzo.com>

  parent reply	other threads:[~2018-08-02  7:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-01 14:43 Kirill Tkhai
2018-08-01 15:19 ` Al Viro
2018-08-01 15:43   ` Kirill Tkhai
2018-08-01 16:11     ` Al Viro
2018-08-01 16:16       ` Al Viro
2018-08-01 16:19         ` Kirill Tkhai
2018-08-01 16:34           ` Al Viro
2018-08-02  3:14             ` Rafael David Tinoco
2018-08-02  7:43             ` Kirill Tkhai [this message]
2018-08-01 16:27         ` Al Viro
2018-08-02  2:36           ` Rafael David Tinoco

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=2df86b53-3db4-6ca8-2b81-8b4d8fd78628@virtuozzo.com \
    --to=ktkhai@virtuozzo.com \
    --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

all inboxes | Powered by JetHome®