* Move across mount,sb
@ 2007-03-15 1:20 Jan Engelhardt
2007-03-15 1:46 ` Al Viro
0 siblings, 1 reply; 2+ messages in thread
From: Jan Engelhardt @ 2007-03-15 1:20 UTC (permalink / raw)
To: linux-fsdevel
Hello,
touch /tmp/foo;
mount /tmp /mnt --bind;
strace -e rename mv /tmp/foo /mnt/bar
Ideally, I would expect, that since /tmp and /mnt are the same
filesystem, that the move operation would complete without _copying_ the
file. But strace returns
rename("/tmp/foo", "/mnt/bar") = -1 EXDEV (Invalid cross-device link)
The piece of code identified is fs/namei.c:2578:do_rename()
error = -EXDEV;
if (oldnd.mnt != newnd.mnt)
goto exit2;
Why is EXDEV returned when _vfs mountpoints_ are crossed? Should not it
be more like the following?
error = -EXDEV;
if (oldnd.mnt->mnt_sb != newnd.mnt->mnt_sb)
goto exit2;
Jan
--
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Move across mount,sb
2007-03-15 1:20 Move across mount,sb Jan Engelhardt
@ 2007-03-15 1:46 ` Al Viro
0 siblings, 0 replies; 2+ messages in thread
From: Al Viro @ 2007-03-15 1:46 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: linux-fsdevel
On Thu, Mar 15, 2007 at 02:20:25AM +0100, Jan Engelhardt wrote:
> Why is EXDEV returned when _vfs mountpoints_ are crossed? Should not it
> be more like the following?
>
> error = -EXDEV;
> if (oldnd.mnt->mnt_sb != newnd.mnt->mnt_sb)
> goto exit2;
>
No. This is absolutely deliberate - mountpoint creates a boundary and
such boundaries are very useful for restricting modifications of filesystem.
IOW, it's not a bug and it applies to other operations as well (link(), for
example).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-03-15 1:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-15 1:20 Move across mount,sb Jan Engelhardt
2007-03-15 1:46 ` Al Viro
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).