From owner-freebsd-bugs Sat Aug 17 10:30:10 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 06F0B37B400 for ; Sat, 17 Aug 2002 10:30:04 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9BF1F43E3B for ; Sat, 17 Aug 2002 10:30:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g7HHU3JU031299 for ; Sat, 17 Aug 2002 10:30:03 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g7HHU23q031297; Sat, 17 Aug 2002 10:30:02 -0700 (PDT) Date: Sat, 17 Aug 2002 10:30:02 -0700 (PDT) Message-Id: <200208171730.g7HHU23q031297@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bruce Evans Subject: Re: kern/25777: atime not updated on exec Reply-To: Bruce Evans Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/25777; it has been noted by GNATS. From: Bruce Evans To: Jens Schweikhardt Cc: pdp@nl.demon.net, Subject: Re: kern/25777: atime not updated on exec Date: Sun, 18 Aug 2002 02:59:59 +1000 (EST) On Sat, 17 Aug 2002, Jens Schweikhardt wrote: > State-Changed-Why: > It is not clear if atime needs to be updated upon exec'ing a file. Er, this is clear. > Here's what the current IEEE Std 1003.1-2001 has to say: > > "File Times Update Look in the section on exec: 9746 Upon successful completion, the exec functions shall mark for update the st_atime field of the file. 9747 If an exec function failed but was able to locate the process image file, whether the st_atime field is 9748 marked for update is unspecified. Should the exec function succeed, the process image file shall 9749 be considered to have been opened with open( ). The corresponding close( ) shall be considered 9750 to occur at a time after this open, but before process termination or successful completion of a 9751 subsequent call to one of the exec functions, posix_spawn( ), or posix_spawnp( ). The argv[ ] and I tried to fix this many years ago, and fixed it enough to prevent NIST PCTS (a test suite for POSIX.1-1990 + FIPS.mumble) from reporting this bug, but dg didn't like the overheads for this and I didn't like them either for nfs. For ufs, the atime update is done using delayed writes, so I think it was efficient enough unless lots of _different_ files are exec'ed. I subsequently implemented lazy atime updates and these make the problem for ufs even smaller. The updates still have to be done sometime so accessing lots of _different_ files still causes lots of i/o. For nfs, atime updates at least used to involve an nfs transaction each. The nfs attribute cache may help here. Here is part of my old patch. It depends on other patches for VOP_SETTATR() and probably doesn't even compile now. %%% Index: kern_exec.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_exec.c,v retrieving revision 1.180 diff -u -2 -r1.180 kern_exec.c --- kern_exec.c 13 Aug 2002 06:55:28 -0000 1.180 +++ kern_exec.c 15 Aug 2002 14:07:51 -0000 @@ -547,4 +537,18 @@ pargs_drop(newargs); +#if 0 + if (!(ndp->ni_vp->v_mount->mnt_flag & MNT_NOATIME)) { + struct vattr vattr; + + VATTR_NULL(&vattr); + vfs_timestamp(&vattr.va_atime); + vattr.va_vaflags |= VA_EXECVE_ATIME; + VOP_LEASE(ndp->ni_vp, p, p->p_ucred, LEASE_WRITE); + vn_lock(ndp->ni_vp, LK_EXCLUSIVE | LK_RETRY, p); + (void) VOP_SETATTR(ndp->ni_vp, &vattr, p->p_ucred, p); + VOP_UNLOCK(ndp->ni_vp, 0, p); + } +#endif + exec_fail_dealloc: %%% The patch in the PR is not good since it assumes that all filesystems are ufs. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message