mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Riesen <alexander.riesen@synopsys.COM>
To: viro@parcelfarce.linux.theplanet.co.uk
Cc: linux-kernel@vger.kernel.org, Eric Lammerts <eric@lammerts.org>
Subject: Fwd: allow rename to "--bind"-mounted filesystem
Date: Tue, 6 May 2003 12:04:35 +0200	[thread overview]
Message-ID: <20030506100435.GH890@riesen-pc.gr05.synopsys.com> (raw)

Hi,
i just came over this patch, and wondered why is it missing
in both 2.4 and 2.5 (the code in do_rename is identical in both
kernels).

Are such renames really not allowed, or was it just fixed differently?

-alex

----- Forwarded message from Eric Lammerts <eric@lammerts.org> -----

Date: 	Sun, 19 Jan 2003 00:34:59 +0100
Subject: [PATCH] allow rename to "--bind"-mounted filesystem 
From: Eric Lammerts <eric@lammerts.org>
To: linux-kernel@vger.kernel.org
Message-ID: <20030118233459.GA18011@ally.lammerts.org>
X-Mailing-List: 	linux-kernel@vger.kernel.org


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)

             reply	other threads:[~2003-05-06  9:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-06 10:04 Alex Riesen [this message]
2003-05-06 14:30 ` viro
2003-05-06 14:34   ` Alex Riesen
2003-05-06 15:02     ` viro
2003-05-06 15:09       ` Alex Riesen
2003-05-06 16:13         ` Carl-Daniel Hailfinger

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=20030506100435.GH890@riesen-pc.gr05.synopsys.com \
    --to=alexander.riesen@synopsys.com \
    --cc=eric@lammerts.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@parcelfarce.linux.theplanet.co.uk \
    /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

Powered by JetHome