public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jordi Pujol Palomer <jordipujolp@gmail.com>
To: Linux-Fsdevel <linux-fsdevel@vger.kernel.org>
Subject: [PATCH] fs/namei.c: Hard link and rename should check same device instead of same mount
Date: Wed, 16 Mar 2016 14:05:14 +0100	[thread overview]
Message-ID: <20160316140514.778db799@localdomain> (raw)

[-- Attachment #1: Type: text/plain, Size: 395 bytes --]

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

[-- Attachment #2: fs-hard-link-check-same-device-instead-of-same-mount.patch --]
[-- Type: text/x-patch, Size: 503 bytes --]

Signed-off-by: Jordi Pujol Palomer <jordipujolp@gmail.com>
---
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))

[-- Attachment #3: fs-rename-check-same-device-instead-of-same-mount.patch --]
[-- Type: text/x-patch, Size: 452 bytes --]

Signed-off-by: Jordi Pujol Palomer <jordipujolp@gmail.com>
---
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;

             reply	other threads:[~2016-03-16 13:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-16 13:05 Jordi Pujol Palomer [this message]
2016-03-16 14:25 ` [PATCH] fs/namei.c: Hard link and rename should check same device instead of same mount Al Viro
2016-03-20 18:06   ` Jordi Pujol Palomer
2016-03-20 18:22     ` Al Viro
2016-03-21 13:35       ` Jordi Pujol Palomer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160316140514.778db799@localdomain \
    --to=jordipujolp@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox