Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Feb 1998 16:58:32 -0500
From:      John Robert LoVerso <loverso@opengroup.org>
To:        afs@FreeBSD.ORG, jkh@FreeBSD.ORG
Subject:   NFS-to-AFS translater and 2.2.5 "mv"
Message-ID:  <199802222158.QAA10655@freebase.camb.opengroup.org>

next in thread | raw e-mail | index | archive | help
I still run my FreeBSD machines against the AFS/NFS translator and
have come up across a problem with FreeBSD's latest version of "mv".
I'd love to make this whole problem go away by using AFS directory and
no longer needing the translator, but...

The translator, in adapting AFS ACLs, does some wierd things.  One
of them is that if you "chmod 0" a file, you lose all access to it
via the translator.  I don't defend this behavior, but that is what
I'm stuck with.

This has been no problem until I installed 2.2-STABLE, dating past 2.2.5.
In an NFS mounted AFS directory, I would do:

	freebase:~ 67 j$ ls -l d
	ls: d: No such file or directory
	freebase:~ 66 j$ mv /tmp/d .
	mv: ./d: Permission denied
	freebase:~ 67 j$ ls -l d
	ls: d: Permission denied

On a machine with AFS, the same file would be listed as:

	mule:~ 64 j$ l d
	----------   1 loverso  osf            0 Feb 21 17:15 d

Seeing that, I peeked at the CVS tree for mv and found:

RELENG_2_2_5_RELEASE: 1.8.2.1
RELENG_2_2_2_RELEASE: 1.8

----------------------------
revision 1.8
date: 1996/03/01 06:14:13;  author: wosch;  state: Exp;  lines: +0 -0
branches:  1.8.2;
delete unused label endarg
correct indent of last new code
fix usage string, option -f before option -i (alphabetic order)
----------------------------
revision 1.8.2.1
date: 1997/08/25 08:33:11;  author: jkh;  state: Exp;  lines: +31 -13
MFC:  cosmetic tweaks + error reporting mods.


Sometime between 2.2.2 and 2.2.5, "mv" was changed.  The crux of the change is
in fastcopy(), when "mv" is copying regular files between different filesystems:

<       if ((to_fd =
<           open(to, O_CREAT | O_TRUNC | O_WRONLY, sbp->st_mode)) < 0) {
-----
>       while ((to_fd =
>           open(to, O_CREAT | O_EXCL | O_TRUNC | O_WRONLY, 0)) < 0) {

That is, the new file is now created with mode 0, and afterwards, it is
fchmod()'d to the correct value.

I can only imagine that this change was made to close a possible race
condition in when moving files.  Note, however, that starting the new file
with a mode of 0 only happens when "mv" is in the midst of copying a file.
"cp", at least as of 2.2-980219, does NOT do this.  So, if it isn't needed
for "cp", why is it needed for "mv" when copying a file?

(One possible answer is that a similar change for "cp" exists in the "current"
branch and it hasn't been pushed to "stable"; I did not check).


So, can anyone:

- tell me they've got a working AFS client side
- tell me why "mv" has been thus changed

Meanwhile, I've backed out the change in "mv" so that I can continue using
my machines on a daily basis.

John

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802222158.QAA10655>