* [PATCH] allow rename to "--bind"-mounted filesystem
@ 2003-01-18 23:34 Eric Lammerts
0 siblings, 0 replies; only message in thread
From: Eric Lammerts @ 2003-01-18 23:34 UTC (permalink / raw)
To: linux-kernel
Hi,
I just discovered that rename(2) does not allow you to rename a file within
the same filesystem if there is a "--bind" in the way. For example:
# mkdir mydir
# mount --bind . mydir
# touch myfile
# strace -erename perl -e 'rename "myfile", "mydir/myfile2"'
rename("myfile", "mydir/myfile2") = -1 EXDEV (Invalid cross-device link)
IMHO it should be possible to do a rename in this situation.
I propose to remove the check in do_rename() altogether. It shouldn't be
necessary, since there's also a check for a cross-device rename in
vfs_rename_dir() and vfs_rename_other().
Patch below has been tested.
Eric
--- linux-2.4.21-pre3/fs/namei.c.orig 2003-01-18 23:56:46.000000000 +0100
+++ linux-2.4.21-pre3/fs/namei.c 2003-01-18 23:57:30.000000000 +0100
@@ -1860,10 +1860,6 @@
if (error)
goto exit1;
- error = -EXDEV;
- if (oldnd.mnt != newnd.mnt)
- goto exit2;
-
old_dir = oldnd.dentry;
error = -EBUSY;
if (oldnd.last_type != LAST_NORM)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-01-18 23:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-18 23:34 [PATCH] allow rename to "--bind"-mounted filesystem Eric Lammerts
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®