linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/namei.c: Hard link and rename should check same device instead of same mount
@ 2016-03-16 13:05 Jordi Pujol Palomer
  2016-03-16 14:25 ` Al Viro
  0 siblings, 1 reply; 5+ messages in thread
From: Jordi Pujol Palomer @ 2016-03-16 13:05 UTC (permalink / raw)
  To: Linux-Fsdevel

[-- 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;

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-03-21 13:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-16 13:05 [PATCH] fs/namei.c: Hard link and rename should check same device instead of same mount Jordi Pujol Palomer
2016-03-16 14:25 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).