From: Miklos Szeredi <miklos@szeredi.hu>
To: Amir Goldstein <amir73il@gmail.com>
Cc: overlayfs <linux-unionfs@vger.kernel.org>,
Eryu Guan <guaneryu@gmail.com>
Subject: Re: [PATCH] ovl: skip stale entries in merge dir cache iteration
Date: Wed, 21 Jul 2021 15:08:07 +0200 [thread overview]
Message-ID: <CAJfpegsi-VmwvQbdMnfMOCGb5s43hrXJOPAdjCQC8X6RQwZAGQ@mail.gmail.com> (raw)
In-Reply-To: <CAOQ4uximehHRdZMR-=n-QUjBdsdD7+GXYmnn11=9eE8UznuFVg@mail.gmail.com>
On Tue, 20 Jul 2021 at 18:17, Amir Goldstein <amir73il@gmail.com> wrote:
>
> On Tue, Jul 20, 2021 at 5:55 PM Amir Goldstein <amir73il@gmail.com> wrote:
> >
> > On Tue, Jul 20, 2021 at 10:18 AM Amir Goldstein <amir73il@gmail.com> wrote:
> > >
> > > On Tue, Jul 20, 2021 at 7:22 AM Miklos Szeredi <miklos@szeredi.hu> wrote:
> > > >
> > > > On Tue, 20 Jul 2021 at 06:19, Miklos Szeredi <miklos@szeredi.hu> wrote:
> > > > >
> > > > > On Mon, 19 Jul 2021 at 18:43, Amir Goldstein <amir73il@gmail.com> wrote:
> > > > > >
> > > > > > On Mon, Jul 19, 2021 at 6:24 PM Miklos Szeredi <miklos@szeredi.hu> wrote:
> > > > > > >
> > > > > > > On Fri, 4 Jun 2021 at 12:43, Amir Goldstein <amir73il@gmail.com> wrote:
> > > > > > > >
> > > > > > > > On Mon, Apr 26, 2021 at 6:20 PM Amir Goldstein <amir73il@gmail.com> wrote:
> > > > > > > > >
> > > > > > > > > On the first getdents call, ovl_iterate() populates the readdir cache
> > > > > > > > > with a list of entries, but for upper entries with origin lower inode,
> > > > > > > > > p->ino remains zero.
> > > > > > > > >
> > > > > > > > > Following getdents calls traverse the readdir cache list and call
> > > > > > > > > ovl_cache_update_ino() for entries with zero p->ino to lookup the entry
> > > > > > > > > in the overlay and return d_ino that is consistent with st_ino.
> > > > > > > > >
> > > > > > > > > If the upper file was unlinked between the first getdents call and the
> > > > > > > > > getdents call that lists the file entry, ovl_cache_update_ino() will not
> > > > > > > > > find the entry and fall back to setting d_ino to the upper real st_ino,
> > > > > > > > > which is inconsistent with how this object was presented to users.
> > > > > > > > >
> > > > > > > > > Instead of listing a stale entry with inconsistent d_ino, simply skip
> > > > > > > > > the stale entry, which is better for users.
> > > > > > > > >
> > > > > > > >
> > > > > > > > Miklos,
> > > > > > > >
> > > > > > > > I forgot to follow up on this patch.
> > > > > > > > Upstream xfstest overlay/077 is failing without this patch.
> > > > > > >
> > > > > > > Can't reproduce (on ext4/xfs and "-oxino=on").
> > > > > > >
> > > > > > > Is there some trick?
> > > > > >
> > > > > > Not sure. overlay/077 fails for me on v5.14.0-rc2 on ext4/xfs.
> > > > > >
> > > > > > QA output created by 077
> > > > > > +entry m100 has inconsistent d_ino (234 != 232)
> > > > > > +entry f100 has inconsistent d_ino (335 != 16777542)
> > > > > > Silence is golden
> > > > > >
> > > > > > Maybe you need to build src/t_dir_offset2?
> > > > >
> > > > > root@kvm:/opt/xfstests-dev# git log -1 --pretty=%h
> > > > > 10f6b231
> > > > > root@kvm:/opt/xfstests-dev# cat local.config
> > > > > export TEST_DEV=/dev/vdb1
> > > > > export TEST_DIR=/test
> > > > > export SCRATCH_DEV=/dev/vdb2
> > > > > export SCRATCH_MNT=/scratch
> > > > > export FSTYP=ext4
> > > > > export OVERLAY_MOUNT_OPTIONS="-o xino=on"
> > > > > root@kvm:/opt/xfstests-dev# make src/t_dir_offset2
> > > > > make: 'src/t_dir_offset2' is up to date.
> > > > > root@kvm:/opt/xfstests-dev# ./check -overlay overlay/077
> > > > > FSTYP -- overlay
> > > > > PLATFORM -- Linux/x86_64 kvm 5.14.0-rc2 #276 SMP Tue Jul 20
> > > > > 05:54:44 CEST 2021
> > > > > MKFS_OPTIONS -- /scratch
> > > > > MOUNT_OPTIONS -- -o xino=on /scratch /scratch/ovl-mnt
> > > > >
> > > > > overlay/077 1s ... 1s
> > > > > Ran: overlay/077
> > > > > Passed all 1 tests
> > > > >
> > > > > root@kvm:/opt/xfstests-dev# cat results/overlay/077.full
> > > > >
> > > > > Create file in pure upper dir:
> > > > > getdents at offset 0 returned 192 bytes
> > > > > created entry p0
> > > > > entry p0 found as expected
> > > > >
> > > > > Remove file in pure upper dir:
> > > > > getdents at offset 0 returned 192 bytes
> > > > > unlinked entry p100
> > > > > entry p100 not found as expected
> > > > >
> > > > > Create file in impure upper dir:
> > > > > getdents at offset 0 returned 192 bytes
> > > > > created entry o0
> > > > > entry o0 found as expected
> > > > >
> > > > > Remove file in impure upper dir:
> > > > > getdents at offset 0 returned 192 bytes
> > > > > unlinked entry o100
> > > > > entry o100 not found as expected
> > > > >
> > > > > Create file in merge dir:
> > > > > getdents at offset 0 returned 192 bytes
> > > > > created entry m0
> > > > > entry m0 found as expected
> > > > >
> > > > > Remove file in merge dir:
> > > > > getdents at offset 0 returned 192 bytes
> > > > > unlinked entry m100
> > > > > entry m100 not found as expected
> > > > >
> > > > > Create file in former merge dir:
> > > > > getdents at offset 0 returned 192 bytes
> > > > > created entry f0
> > > > > entry f0 found as expected
> > > > >
> > > > > Remove file in former merge dir:
> > > > > getdents at offset 0 returned 192 bytes
> > > > > unlinked entry f100
> > > > > entry f100 not found as expected
> > > > >
> > > > > Ideas for further debugging why this test isn't failing for v4.12-rc2?
> > > >
> > >
> > > It's not you, it's me ;-)
> > >
> > > The failure was lost during cleanup of t_dir_offset2 patches
> > > for submission and it is I who was running an older version
> > > of t_dir_offset2. Let me figure this out and get back to you
> > > with a working test.
> > >
> >
> > How about you try again with a version of the test that actually has
> > the check and the error print that I reported.... ;-)
> >
>
> P.S.1:
> xino=on is futile for this test as it uses all layers on same fs
>
> P.S.2:
> The attached patch to t_dir_offset2 only reproduces the first
> inconsistency I reported:
> entry m100 has inconsistent d_ino (234 != 232)
>
> The second inconsistency requires another small patch to overlay/077
> (attached). I will post both those patches once the kernel fix is in
> overlayfs-next.
Thanks.
Verified and pushed.
Miklos
prev parent reply other threads:[~2021-07-21 13:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-26 15:20 [PATCH] ovl: skip stale entries in merge dir cache iteration Amir Goldstein
2021-06-04 10:43 ` Amir Goldstein
2021-07-19 15:24 ` Miklos Szeredi
2021-07-19 16:43 ` Amir Goldstein
2021-07-20 4:19 ` Miklos Szeredi
2021-07-20 4:22 ` Miklos Szeredi
2021-07-20 7:18 ` Amir Goldstein
2021-07-20 14:55 ` Amir Goldstein
2021-07-20 16:17 ` Amir Goldstein
2021-07-21 13:08 ` Miklos Szeredi [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=CAJfpegsi-VmwvQbdMnfMOCGb5s43hrXJOPAdjCQC8X6RQwZAGQ@mail.gmail.com \
--to=miklos@szeredi.hu \
--cc=amir73il@gmail.com \
--cc=guaneryu@gmail.com \
--cc=linux-unionfs@vger.kernel.org \
/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).