From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f44.google.com ([74.125.82.44]:38737 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752308AbcCPNFT (ORCPT ); Wed, 16 Mar 2016 09:05:19 -0400 Received: by mail-wm0-f44.google.com with SMTP id l68so71569472wml.1 for ; Wed, 16 Mar 2016 06:05:18 -0700 (PDT) Received: from localdomain (196.red-88-16-178.dynamicip.rima-tde.net. [88.16.178.196]) by smtp.gmail.com with ESMTPSA id i1sm2950948wjs.45.2016.03.16.06.05.17 for (version=TLSv1/SSLv3 cipher=OTHER); Wed, 16 Mar 2016 06:05:17 -0700 (PDT) Date: Wed, 16 Mar 2016 14:05:14 +0100 From: Jordi Pujol Palomer To: Linux-Fsdevel Subject: [PATCH] fs/namei.c: Hard link and rename should check same device instead of same mount Message-ID: <20160316140514.778db799@localdomain> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/B6ZV62ENFs.AnJM3D.os.Gb" Sender: linux-fsdevel-owner@vger.kernel.org List-ID: --MP_/B6ZV62ENFs.AnJM3D.os.Gb Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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=C3=A8cnic Industrial --MP_/B6ZV62ENFs.AnJM3D.os.Gb Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=fs-hard-link-check-same-device-instead-of-same-mount.patch Signed-off-by: Jordi Pujol Palomer --- 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)) --MP_/B6ZV62ENFs.AnJM3D.os.Gb Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=fs-rename-check-same-device-instead-of-same-mount.patch Signed-off-by: Jordi Pujol Palomer --- 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; --MP_/B6ZV62ENFs.AnJM3D.os.Gb--