From owner-freebsd-fs Sat Oct 12 16:30:24 2002 Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 776BC37B401 for ; Sat, 12 Oct 2002 16:30:23 -0700 (PDT) Received: from isilon.com (isilon.com [65.101.129.58]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0B40743EAC for ; Sat, 12 Oct 2002 16:30:23 -0700 (PDT) (envelope-from pete@isilon.com) Received: from localhost (localhost [127.0.0.1]) by isilon.com (8.12.2/8.11.1) with ESMTP id g9CNUM3C082128 for ; Sat, 12 Oct 2002 16:30:22 -0700 (PDT) (envelope-from pete@isilon.com) Date: Sat, 12 Oct 2002 16:30:22 -0700 (PDT) From: Peter Godman To: freebsd-fs@freebsd.org Subject: ufs_update and waitfor flag Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org An application running on my system is doing basically: fd = open(file) read(fd, ...) fsync(fd) close(fd) My root filesystem is mounted sync,noatime, but this sequence of operations still results in a bwrite during fsync in ufs_update. This seems to be the result of the following code in ufs_update: int ffs_update(vp, waitfor) struct vnode *vp; int waitfor; { struct fs *fs; struct buf *bp; struct inode *ip; int error; ufs_itimes(vp); ip = VTOI(vp); /* vvvvvvvvvvvv ?? */ if ((ip->i_flag & IN_MODIFIED) == 0 && waitfor == 0) return (0); ip->i_flag &= ~(IN_LAZYMOD | IN_MODIFIED); ... The relevant part here is the "waitfor == 0" in the bailout check. Though the flags on the inode do not indicate that the inode is modified, the fact that we wish to wait for the operation to complete results a write happening here that otherwise wouldn't have. Do other people read this code the same way? Is this desired or expected behaviour? What would happen if I commented out the check for waitfor == 0 at this point? Anyone know why this check is there? Most likely I will modify the application in question, but would like to know whether this code should change too. Thanks! Peter Godman To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message