From: "zhangyi (F)" <yi.zhang@huawei.com>
To: Amir Goldstein <amir73il@gmail.com>, Miklos Szeredi <miklos@szeredi.hu>
Cc: "linux-unionfs@vger.kernel.org" <linux-unionfs@vger.kernel.org>,
fstests <fstests@vger.kernel.org>, Eryu Guan <eguan@redhat.com>,
"Darrick J. Wong" <darrick.wong@oracle.com>,
Miao Xie <miaoxie@huawei.com>, Vivek Goyal <vgoyal@redhat.com>
Subject: Re: [PATCH v2 01/18] overlay: implement fsck utility
Date: Fri, 15 Dec 2017 12:18:54 +0800 [thread overview]
Message-ID: <45752c08-11eb-33ad-b226-56a2d6de838d@huawei.com> (raw)
In-Reply-To: <CAOQ4uxh-4kKPLHDXHJux2_tM35frxxNWmPEZcDu2EQ2n+yYkKA@mail.gmail.com>
On 2017/12/14 22:33, Amir Goldstein Wrote:
> On Thu, Dec 14, 2017 at 4:13 PM, Miklos Szeredi <miklos@szeredi.hu> wrote:
>> On Thu, Dec 14, 2017 at 7:47 AM, zhangyi (F) <yi.zhang@huawei.com> wrote:
>>> fsck.overlay
>>> ============
>>>
>>> fsck.overlay is used to check and optionally repair underlying
>>> directories of overlay-filesystem.
>>
>> Thanks for working on this.
>>
>>
>>>
>>> Check the following points:
>>>
>>> Whiteouts
>>> ---------
>>>
>>> A whiteout is a character device with 0/0 device number. It is used to
>>> record the removed files or directories, When a whiteout is found in a
>>> directory, there should be at least one directory or file with the same
>>> name in any of the corresponding lower layers. If not exist, the whiteout
>>> will be treated as orphan whiteout and remove.
>>
>> Okay.
>>
>>>
>>> Opaque directories
>>> ------------------
>>>
>>> An opaque directory is a directory with "trusted.overlay.opaque" xattr
>>> valued "y". There are two legal situations of making opaque directory: 1)
>>> create directory over whiteout 2) creat directory in merged directory. If an
>>> opaque directory is found, corresponding matching name in lower layers might
>>> exist or parent directory might merged, If not, the opaque xattr will be
>>> treated as invalid and remove.
>>
>> Current version of overlay fs doesn't bother with removing opaque
>> attribute. So not sure fsck.overlay should care. Or at least is
>> should be an optional thing and not worth warning about, since it's
>> perfectly normal.
>>
>>
>>>
>>> Redirect directories
>>> --------------------
>>>
>>> An redirect directory is a directory with "trusted.overlay.redirect"
>>> xattr valued to the path of the original location from the root of the
>>> overlay. It is only used when renaming a directory and "redirect dir"
>>> feature is enabled. If an redirect directory is found, the following
>>> must be met:
>>>
>>> 1) The directory store in redirect xattr should exist in one of lower
>>> layers.
>>
>> Okay.
>>
>>> 2) The origin directory should be redirected only once in one layer,
>>> which mean there is only one redirect xattr point to this origin directory in
>>> the specified layer.
>>> 3) A whiteout or an opaque directory with the same name to origin should
>>> exist in the same directory as the redirect directory.
>>>
>>> If not, 1) The redirect xattr is invalid and need to remove 2) One of
>>> the redirect xattr is redundant but not sure which one is, ask user 3)
>>> Create a whiteout device or set opaque xattr to an existing directory if the
>>> parent directory was meregd or remove xattr if not.
>>
>> Hmm, in this case also should ask the user, as it's not clear that the
>> "new" copy resulting from removal of whiteout on upper is the wanted
>> one or the "old" renamed copy.
>>
>>
>>>
>>> Usage
>>> =====
>>>
>>> 1. Ensure overlay filesystem is not mounted based on directories which
>>> need to check.
>>>
>>> 2. Run fsck.overlay program:
>>> Usage:
>>> fsck.overlay [-l lowerdir] [-u upperdir] [-w workdir] [-avhV]
>>>
>>> Options:
>>> -l, --lowerdir=LOWERDIR specify lower directories of overlayfs,
>>> multiple lower use ':' as separator.
>>> -u, --upperdir=UPPERDIR specify upper directory of overlayfs
>>> -w, --workdir=WORKDIR specify work directory of overlayfs
>>
>> Not sure what other fsck do, but I'd feel more logical to have the
>> same -olowerdir=..., etc. notation as for mount.
>>
>
> Other fsck do not have this problem.
> They only need blockdev as input.
> Which leads me to an idea I have been wondering about for the overlayfs
> utilities - a specification file, e.g.:
>
> # create dirs and write their path to a spec file:
> mkfs.overlay -ometacopy=on,lowerdir=... myovl.spec
> # mount overlay using mount.overlay helper:
> mount -t overlay myovl.spec /ovl
> # fsck with just one configuration that is consistent with mkfs and mount:
> fsck.overlay -n myovl.spec
>
> The specification file can also determine the backward incompatible
> features of the overlay, for example, if user sets -metacopy=on during mkfs
> mount.overlay helper will refuse to mount with kernel that does not
> support metacopy. The reason we CAN do that with spec file is because spec
> file determines that overlay was born with metacopy feature enabled.
> It is not the same an overlay that was once mounted with metacopy=on and
> then we don't allow it to mount with an old kernel.
>
Maybe we also need another tool like "tune2fs.overlay" to let users to add or
remove features when they update kernel. :)
Thanks,
Yi.
> This method could delegate the entire feature compatibility to userspace
> mount helper.
>
> Another nice thing about mount.overlay helper is that it could abstarct
> away the move from mount() to mount2() when the time comes and then
> users can keep using existing tools but won't have the existing limit on
> number of lowerdirs.
>
> Thoughts?
>
> Amir.
>
> .
>
next prev parent reply other threads:[~2017-12-15 4:19 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-14 6:47 [PATCH v2 00/18] overlay: implement fsck.overlay utility zhangyi (F)
2017-12-14 6:47 ` [PATCH v2 01/18] overlay: implement fsck utility zhangyi (F)
2017-12-14 14:13 ` Miklos Szeredi
2017-12-14 14:33 ` Amir Goldstein
2017-12-14 14:47 ` Miklos Szeredi
2017-12-14 15:03 ` Amir Goldstein
2017-12-14 15:10 ` Miklos Szeredi
2017-12-14 15:18 ` Amir Goldstein
2017-12-14 15:48 ` Miklos Szeredi
2017-12-14 16:03 ` Vivek Goyal
2017-12-14 16:29 ` Amir Goldstein
2017-12-15 14:18 ` Miklos Szeredi
2017-12-15 14:44 ` Amir Goldstein
2017-12-15 16:06 ` Miklos Szeredi
2017-12-15 16:14 ` Miklos Szeredi
2017-12-15 15:16 ` Vivek Goyal
2017-12-15 16:17 ` Miklos Szeredi
2017-12-14 15:21 ` Vivek Goyal
2017-12-14 15:43 ` Amir Goldstein
2017-12-14 16:12 ` Vivek Goyal
2017-12-15 4:18 ` zhangyi (F) [this message]
2017-12-15 3:35 ` zhangyi (F)
2017-12-15 7:45 ` Amir Goldstein
2017-12-15 9:13 ` zhangyi (F)
2017-12-14 6:47 ` [PATCH v2 02/18] fsck.overlay: fix uninitialized variable zhangyi (F)
2017-12-14 9:15 ` Amir Goldstein
2017-12-14 6:47 ` [PATCH v2 03/18] fsck.overlay: add -n -p and -y options zhangyi (F)
2017-12-14 6:47 ` [PATCH v2 04/18] fsck.overlay: add path package and split helper zhangyi (F)
2017-12-14 6:47 ` [PATCH v2 05/18] fsck.overlay: convert path parse to use helper function zhangyi (F)
2017-12-14 6:47 ` [PATCH v2 06/18] fsck.overlay: open lowerdirs in advance zhangyi (F)
2017-12-14 6:47 ` [PATCH v2 07/18] fsck.overlay: check lowers use relative path zhangyi (F)
2017-12-14 6:47 ` [PATCH v2 08/18] fsck.overlay: fix spelling mistakes zhangyi (F)
2017-12-14 9:13 ` Amir Goldstein
2017-12-14 6:47 ` [PATCH v2 09/18] fsck.overlay: add counter of checked objects zhangyi (F)
2017-12-14 6:47 ` [PATCH v2 10/18] fsck.overlay: fix verbose flag zhangyi (F)
2017-12-14 6:47 ` [PATCH v2 11/18] fsck.overlay: add ovl_ask_invalid helper zhangyi (F)
2017-12-14 6:47 ` [PATCH v2 12/18] fsck.overlay: remove duplicate redirect xattr in yes mode zhangyi (F)
2017-12-14 6:47 ` [PATCH v2 13/18] fsck.overlay: handle missing case of redirecte directory zhangyi (F)
2017-12-14 6:47 ` [PATCH v2 14/18] fsck.overlay: correct copyright and License zhangyi (F)
2017-12-14 9:09 ` Amir Goldstein
2017-12-14 6:47 ` [PATCH v2 15/18] fsck.overlay: fix word mistake zhangyi (F)
2017-12-14 6:47 ` [PATCH v2 16/18] fsck.overlay: remove test cases zhangyi (F)
2017-12-14 9:11 ` Amir Goldstein
2017-12-14 6:47 ` [PATCH v2 17/18] fsck.overlay: not enforce overlayfs is offline in 'no changes' mode zhangyi (F)
2017-12-14 6:47 ` [PATCH v2 18/18] fsck.overlay: use relative path when checking lowers zhangyi (F)
2017-12-14 9:27 ` [PATCH v2 00/18] overlay: implement fsck.overlay utility Amir Goldstein
2017-12-14 10:43 ` zhangyi (F)
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=45752c08-11eb-33ad-b226-56a2d6de838d@huawei.com \
--to=yi.zhang@huawei.com \
--cc=amir73il@gmail.com \
--cc=darrick.wong@oracle.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=vgoyal@redhat.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