From owner-freebsd-bugs Mon Jul 24 08:26:06 1995 Return-Path: bugs-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.11/8.6.6) id IAA23110 for bugs-outgoing; Mon, 24 Jul 1995 08:26:06 -0700 Received: from minnow.render.com (render.demon.co.uk [158.152.30.118]) by freefall.cdrom.com (8.6.11/8.6.6) with ESMTP id IAA23102 for ; Mon, 24 Jul 1995 08:25:52 -0700 Received: (from dfr@localhost) by minnow.render.com (8.6.9/8.6.9) id PAA13715; Mon, 24 Jul 1995 15:35:05 +0100 Date: Mon, 24 Jul 1995 15:35:04 +0100 (BST) From: Doug Rabson To: Matt Dillon cc: bugs@freebsd.org Subject: Re: Here's a new one: /bin/mv truncates destination if dest is NFS In-Reply-To: <199507221649.JAA11816@blob.best.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: bugs-owner@freebsd.org Precedence: bulk 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