Re: Commit "new primitive: discard_new_inode()" introduces a problem

From: Rafael David Tinoco
Date: Wed Aug 01 2018 - 22:37:01 EST


On Wed, Aug 01, 2018 at 05:27:39PM +0100, Al Viro wrote:
> On Wed, Aug 01, 2018 at 05:16:48PM +0100, 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.
> >
> > > And that is set only by insert_inode_locked()/insert_inode_locked4(),
> > > and only until unlock_new_inode().
> > >
> > > Could you slap WARN_ON(1) before these return ERR_PTR(-ESTALE) in
> > > find_inode{,_fast}() and see if that's what's getting triggered?
>
> ... and I still can't reproduce it here - exact same tree, same .config,
> same reproducer. The only difference is that it's a gcc-5 build, but
> I can do gcc-6 as well; doubt that it'll change anything.

I bisected an issue with our functional tests to this commit also.

LTP started failing for -next for tests depending on remounts to RO.

Link: https://bugs.linaro.org/show_bug.cgi?id=3957

Reproducer:

# testfile = ext4 filesystem

mount ./testfile /mnt
rm -f /mnt/read-only
touch /mnt/read-only
mount -o remount,ro /mnt
ls /mnt
$ ls /mnt
ls: cannot access '/mnt/read-only': Cannot allocate memory

Could not reproduce with xfs.

More information on investigation:

https://bugs.linaro.org/show_bug.cgi?id=3957#c3
https://bugs.linaro.org/show_bug.cgi?id=3957#c4

Trace of a failing acct (thought originally related):

https://bugs.linaro.org/show_bug.cgi?id=3957#c5
do_filp_open() -> path_openat() -> do_last() -> lookup_open()
(check ext4_lookup() and beyond)

I'm testing your patch right now. Will inform soon.

-Rafael