mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
ovl: redirect on rename-dir
Current code returns EXDEV when a directory would need to be copied up to move. We could copy up the directory tree in this case, but there's another, simpler solution: point to old lower directory from moved upper directory. This is achieved with a "trusted.overlay.redirect" xattr storing the path relative to the root of the overlay. After such attribute has been set, the directory can be moved without further actions required. This is a backward incompatible feature, old kernels won't be able to correctly mount an overlay containing redirected directories. Signed-off-by: Miklos Szeredi <[email protected]>
This commit is contained in:
parent
02b69b284c
commit
a6c6065511
7 changed files with 195 additions and 30 deletions
|
|
@ -130,6 +130,23 @@ directory.
|
|||
Readdir on directories that are not merged is simply handled by the
|
||||
underlying directory (upper or lower).
|
||||
|
||||
renaming directories
|
||||
--------------------
|
||||
|
||||
When renaming a directory that is on the lower layer or merged (i.e. the
|
||||
directory was not created on the upper layer to start with) overlayfs can
|
||||
handle it in two different ways:
|
||||
|
||||
1) return EXDEV error: this error is returned by rename(2) when trying to
|
||||
move a file or directory across filesystem boundaries. Hence
|
||||
applications are usually prepared to hande this error (mv(1) for example
|
||||
recursively copies the directory tree). This is the default behavior.
|
||||
|
||||
2) If the "redirect_dir" feature is enabled, then the directory will be
|
||||
copied up (but not the contents). Then the "trusted.overlay.redirect"
|
||||
extended attribute is set to the path of the original location from the
|
||||
root of the overlay. Finally the directory is moved to the new
|
||||
location.
|
||||
|
||||
Non-directories
|
||||
---------------
|
||||
|
|
@ -189,8 +206,8 @@ If a file with multiple hard links is copied up, then this will
|
|||
"break" the link. Changes will not be propagated to other names
|
||||
referring to the same inode.
|
||||
|
||||
Directory trees are not copied up. If rename(2) is performed on a directory
|
||||
which is on the lower layer or is merged, then -EXDEV will be returned.
|
||||
Unless "redirect_dir" feature is enabled, rename(2) on a lower or merged
|
||||
directory will fail with EXDEV.
|
||||
|
||||
Changes to underlying filesystems
|
||||
---------------------------------
|
||||
|
|
|
|||
Loading…
Reference in a new issue