Date: Mon, 24 Jul 1995 15:35:04 +0100 (BST) From: Doug Rabson <dfr@render.com> To: Matt Dillon <dillon@blob.best.net> Cc: bugs@freebsd.org Subject: Re: Here's a new one: /bin/mv truncates destination if dest is NFS Message-ID: <Pine.BSF.3.91.950724153357.12542G-100000@minnow.render.com> In-Reply-To: <199507221649.JAA11816@blob.best.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 22 Jul 1995, Matt Dillon wrote:
> Here's another one... /bin/mv truncates the destination file if
> the destination is an NFS filesytem.
>
> * Create a 24254 byte file
> * as root, chgrp the file to a group the user has no permissions on
> * as the user, /bin/mv file dest
>
> where dest is on an NFS mount.
>
> What happens is that the fchown() that /bin/mv does blows away the
> last dirty buffer from the filecopy (which used 8K chunks) that /bin/mv
> did, so the output file winds up being only 16K long!!
>
> This only occurs when fchown() fails due to not being able to transfer
> the group permissions to the destination file, i.e. when you get:
>
> mv2: /home/au/z: set owner/group: Operation not permitted
>
> If I put a sleep() in just before the fchown() and manually /bin/sync
> after the file is written but before the fchown(), the file size comes
> out properly.
I just fixed this in -current. You can either get a new copy of
nfs_vnops.c or apply this patch:
Index: nfs_vnops.c
===================================================================
RCS file: /home/ncvs/src/sys/nfs/nfs_vnops.c,v
retrieving revision 1.20
diff -c -r1.20 nfs_vnops.c
*** 1.20 1995/07/13 17:55:12
--- nfs_vnops.c 1995/07/24 11:52:16
***************
*** 620,626 ****
return (error);
error = nfs_setattrrpc(vp, vap, ap->a_cred, ap->a_p);
if (error) {
! np->n_size = np->n_vattr.va_size = tsize;
vnode_pager_setsize(vp, (u_long)np->n_size);
}
return (error);
--- 620,627 ----
return (error);
error = nfs_setattrrpc(vp, vap, ap->a_cred, ap->a_p);
if (error) {
! if (vap->va_size != VNOVAL)
! np->n_size = np->n_vattr.va_size = tsize;
vnode_pager_setsize(vp, (u_long)np->n_size);
}
return (error);
--
Doug Rabson, Microsoft RenderMorphics Ltd. Mail: dfr@render.com
Phone: +44 171 251 4411
FAX: +44 171 251 0939
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.950724153357.12542G-100000>
