Hello, Working on a Linux system that bind mounts some directories, have found frequent errors when moving files between directories that belong to different mount points but are on the same device. The two attached patches solve these problems on a local filesystem. Maybe we must test it on different configurations. Thanks, Jordi Pujol i Palomer Enginyer Tècnic Industrial
Signed-off-by: Jordi Pujol Palomer <jordipujolp@xxxxxxxxx> --- Subject: fs: Hard link must check same device instead of same mount Date: Wed, 16 Mar 2016 09:12:21 +0100 --- linux-4.5.0-a/fs/namei.c +++ linux-4.5.0-b/fs/namei.c 2016-03-15 22:15:03.275460823 +0100 @@ -4163,7 +4163,7 @@ retry: goto out; error = -EXDEV; - if (old_path.mnt != new_path.mnt) + if (old_path.dentry->d_sb->s_dev != new_path.dentry->d_sb->s_dev) goto out_dput; error = may_linkat(&old_path); if (unlikely(error))
Signed-off-by: Jordi Pujol Palomer <jordipujolp@xxxxxxxxx> --- Subject: fs: Rename must check same device instead of same mount Date: Wed, 16 Mar 2016 09:12:21 +0100 --- linux-4.5.0-a/fs/namei.c +++ linux-4.5.0-b/fs/namei.c 2016-03-15 22:15:03.275460823 +0100 @@ -4424,7 +4424,7 @@ retry: } error = -EXDEV; - if (old_path.mnt != new_path.mnt) + if (old_path.dentry->d_sb->s_dev != new_path.dentry->d_sb->s_dev) goto exit2; error = -EBUSY;