Make sure rootless mounts support the userxattr flag

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh 2021-04-05 15:58:45 -04:00
parent 6d7a4b560f
commit f243ef010d
No known key found for this signature in database
GPG Key ID: A2DF901DABE2C028
1 changed files with 4 additions and 0 deletions

View File

@ -550,6 +550,10 @@ func supportsOverlay(home string, homeMagic graphdriver.FsMagic, rootUID, rootGI
// Check that overlay supports selinux labels as well.
flags = label.FormatMountLabel(flags, selinuxLabelTest)
}
if unshare.IsRootless() {
flags = fmt.Sprintf("%s,userxattr", flags)
}
if len(flags) < unix.Getpagesize() {
err := unix.Mount("overlay", mergedDir, "overlay", 0, flags)
if err == nil {