Re: overlayfs 4.19: unable to make backup link: Invalid cross-device link

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 14, 2018 at 12:28 PM Maciej Zięba <maciekz82@xxxxxxxxx> wrote:
>
> Hi :)
>
> I'm not sure which part is relevant, so I'm sending the entire dmesg output as well as the docker messages. I hope it will be useful.
>

Thanks for the info!

Problem is ovl_set_redirect() inside ovl_link() is missing
ovl_override_creds().

Can you try the patch below?

Reason that unionmount-testsuite didn't catch this is because
it is run as root.

Vivek, Mark,

Either of you care to implement dropping privileges for the duration
of unionmount-testsuite test cases (in between mounts and unmounts)?

Thanks,
Amir.

---

diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index c6289147c787..82c129bfe58d 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -651,6 +651,18 @@ static int ovl_symlink(struct inode *dir, struct
dentry *dentry,
        return ovl_create_object(dentry, S_IFLNK, 0, link);
 }

+static int ovl_set_link_redirect(struct dentry *dentry)
+{
+       const struct cred *old_cred;
+       int err;
+
+       old_cred = ovl_override_creds(dentry->d_sb);
+       err = ovl_set_redirect(dentry, false);
+       revert_creds(old_cred);
+
+       return err;
+}
+
 static int ovl_link(struct dentry *old, struct inode *newdir,
                    struct dentry *new)
 {
@@ -670,7 +682,7 @@ static int ovl_link(struct dentry *old, struct
inode *newdir,
                goto out_drop_write;

        if (ovl_is_metacopy_dentry(old)) {
-               err = ovl_set_redirect(old, false);
+               err = ovl_set_link_redirect(old);
                if (err)
                        goto out_drop_write;
        }




[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux