public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: zhangyi <yizhang089@gmail.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: "zhangyi (F)" <yi.zhang@huawei.com>,
	overlayfs <linux-unionfs@vger.kernel.org>,
	fstests <fstests@vger.kernel.org>,
	Miklos Szeredi <miklos@szeredi.hu>, Eryu Guan <eguan@redhat.com>,
	Miao Xie <miaoxie@huawei.com>,
	yangerkun@huawei.com
Subject: Re: [PATCH xfstest v2 3/4] overlay: add fsck.overlay redirect directory test
Date: Sun, 31 Dec 2017 13:06:50 +0800	[thread overview]
Message-ID: <6b5ad224-5863-6eb9-fb2a-766bccc4c9c5@gmail.com> (raw)
In-Reply-To: <CAOQ4uxhmGo759uLV6Fvg1Pa2rNJ_sfskL_aPa8rDDZcPXTkwEQ@mail.gmail.com>

On 2017/12/30 17:35, Amir Goldstein Wrote:
> On Sat, Dec 30, 2017 at 6:06 AM, zhangyi (F) <yizhang089@gmail.com> wrote:
>> On 2017/12/28 20:37, Amir Goldstein Wrote:
>>
>>>> +# Test valid redirect xattr with general directory cover lower origin
>>>> +# target, should ask user this directory is merged or not by default
>>>> +# and do nothing in auto mode
>>>> +echo "+ Valid redirect(4)"
>>>> +mkdir $lowerdir/origin
>>>> +mkdir $upperdir/origin
>>>> +make_redirect_dir $upperdir/testdir "origin"
>>>> +
>>>> +_overlay_fsck_dirs $lowerdir $upperdir $workdir -p >> $seqres.full 2>&1
>>>> || \
>>>> +       _fail "fsck should not fail"
>>>> +check_redirect "origin" $upperdir/testdir
>>>> +$GETFATTR_PROG --absolute-names -d -m $OVL_OPAQUE_XATTR
>>>> $upperdir/testdir
>>>> +
>>>> +echo "n" > $tmp.input
>>> This approach seems a bit fragile to me.
>>> Maybe you will want to add some questions in the future.
>>> To me it makes better sense to check behavior of fsck -y is automated
>>> test,
>>> because some user who does not understand the questions is surely going
>>> to run fsck -y to fix problems.
>>>
>>>> +_overlay_fsck_dirs $lowerdir $upperdir $workdir <$tmp.input >>
>>>> $seqres.full 2>&1 || \
>>>> +       _fail "fsck should not fail"
>>>> +check_redirect "origin" $upperdir/testdir
>>>> +check_opaque $upperdir/origin
>>>> +rm -rf $lowerdir/* $upperdir/*
>>>> +
>> Hi Amir:
>>
>> Think about this again. IIUC, I think there is a consistency problem about
>> this case.
>> If we allow user to create a new directory in upper layer merge with lower
>> redirect origin target when overlay offline, we will see duplicate d_ino in
>> overlay filesystem after next mount, becasue current ovl_getattr() will get
>> the lower d_ino for both merged dir and redirect dir.
>>
>> eg:
>> mnt:         dira(ino=x)    dirb(ino=x)
>> upper:      *dira(ino=y)   dirb(ino=z, redirect=dirb)
>> lower:       dira(ino=x)
>>
>> *) User remove whiteout or opaque dir and then newly created when overlayfs
>> is offline.
>>
>> Furthermore, if user rename dira again, will lead to duplicate redirect
>> xattr directly.
>> So I think we should forbid user do this and check by fsck.overlay. Or
>> handle by overlay filesytem?  thought?
>>
> I am not sure I follow. Of course there is a consistency problem with
> allowing merge
> and redirect to same target. merge dir is just a private case of
> "redirect to .".
> merge+redirect is not different in any way than multiple redirect.
> All our discussion w.r.t the "Is merge dir?" question was revolving around the
> fact that either the merge dir or the redirected dir needs to be fixed.
Exactly,If user selsect the "merge" option(not opaque), we also should 
fix the
redirected dir which point to the same origin. Thanks!

> And duplicate d_ino is the *least* of the problem.
> With duplicate redirect, there can be many objects (all descendants)
> in the file system
> with the same st_dev;st_ino, which may have different data.
>
> This work in my queue is verifying multiple redirect/merge at lookup time,
> but *only* if directories where indexed to begin with.
> fsck.overlay will be needed to find and correct duplicate redirects
> and even merge
> dirs that were copied up without an index and fix the index (if
> -overify=on is given).
>
> There is a limitation of verify=on that it cannot use index to verify
> mulitple redirect
> from mid layers. This is where only fsck.overlay can be used.
OK, I can add this check and fix latter.  :)

Cheers,
Yi.

  reply	other threads:[~2017-12-31  5:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-28 11:49 [PATCH xfstest v2 0/4] overlay: add fsck.overlay basic tests zhangyi (F)
2017-12-28 11:49 ` [PATCH xfstest v2 1/4] overlay: add filesystem check helper zhangyi (F)
2017-12-28 12:12   ` Amir Goldstein
2017-12-28 11:49 ` [PATCH xfstest v2 2/4] overlay: add fsck.overlay whiteout test zhangyi (F)
2017-12-28 12:11   ` Amir Goldstein
2017-12-29  1:27     ` zhangyi (F)
2018-01-02 20:05   ` Vivek Goyal
2018-01-03  1:02     ` zhangyi (F)
2018-01-03 15:04   ` Vivek Goyal
2018-01-04  1:15     ` zhangyi (F)
2017-12-28 11:49 ` [PATCH xfstest v2 3/4] overlay: add fsck.overlay redirect directory test zhangyi (F)
2017-12-28 12:37   ` Amir Goldstein
2017-12-29  1:49     ` zhangyi (F)
2017-12-30  4:06     ` zhangyi (F)
2017-12-30  9:35       ` Amir Goldstein
2017-12-31  5:06         ` zhangyi [this message]
2017-12-28 11:49 ` [PATCH xfstest v2 4/4] overlay: add fsck.overlay impure xattr test zhangyi (F)
2017-12-28 12:43   ` Amir Goldstein

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=6b5ad224-5863-6eb9-fb2a-766bccc4c9c5@gmail.com \
    --to=yizhang089@gmail.com \
    --cc=amir73il@gmail.com \
    --cc=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miaoxie@huawei.com \
    --cc=miklos@szeredi.hu \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    /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