Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce deref cmd #11

Merged
merged 10 commits into from Aug 17, 2020
Merged

Introduce deref cmd #11

merged 10 commits into from Aug 17, 2020

Conversation

amir73il
Copy link
Contributor

deref - copy changes from upperdir to uppernew while unfolding redirect directories and metacopy regular files, so that new upperdir is compatible with legacy overlayfs driver.

@kmxz
Copy link
Owner

kmxz commented Aug 14, 2020

Thanks for the PR! I'll take a look quickly.

Copy link
Owner

@kmxz kmxz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the massive improvements!

I'm not very familiar with the updates in OverlayFS, so I'm not confident in proofreading the logic. But the code surely looks great. I'll definitely merge it.

logic.c Outdated Show resolved Hide resolved
main.c Outdated Show resolved Hide resolved
sh.c Outdated Show resolved Hide resolved
diff treats redirect dir as opaque -
- lower files under redirect dir listed as deleted
- upper dir listed as added

vaccum also treats redirect dir as opaque -
- it must not delete redirect upper dir becaue we do not
  know how to follow redirect to lower

merge with redirect dir is complicated and not supported -
- we abort merge when detecting a redirect dir to avoid
  deleting files under the redirected dir

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Data of metacopy upper is identical to lower by definition
unless upper is redirected, so diff and vacuum work.

merge is more complicated, so it is aborted if an upper metacopy
is found.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Comforms to the output format of 'diff -qr --no-dereference'.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Expected output of 'overlay diff' is comitted as diff.saved.
Expected output of 'overlay diff -v' is comitted as verbose.saved.
Expected output of 'overlay diff -b' is generated with 'diff -qr'.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
It is not a real metacopy because it is missing the origin xattr,
but for the diff tests it is sufficient.

In the test data set, the victim file was unmodified, only permission
bits changed, so diff results remain the same.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
"fake" that lower removed_dir was actually renamed and not removed,
so all its children can be found under renamed_dir.

The diff output results of diff and diff -b have an extra line for
added directory /renamed_dir.

The diff output of diff -v should have the children of renamed_dir,
but overlay tools does not support listing redirected dir's childeren,
so it also has that single added directory /renamed_dir.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Instead of using full paths in script, use paths relative to $LOWERDIR
and $UPPERDIR variables.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
For layers modifying scripts 'vaccuum' and 'merge' allow specifying
command line arguments -L <newlower> and -U <newupper>.

If those arguments are specified, the script will make a backup copy of
lowerdir and/or upperdir and will make modifications to the backup copy
instead of modifying the original.

If niether upperdir nor lowerdir are going to be modified, relax the
check for mounted overlayfs.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
copy changes from upperdir to a new upperdir unfolding redirect and metacopy
to get a portable overlay upperdir layer.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
@kmxz kmxz merged commit 77bf3f7 into kmxz:master Aug 17, 2020
@kmxz
Copy link
Owner

kmxz commented Aug 17, 2020

Merged. Much appreciation for the great contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants