From owner-cvs-src@FreeBSD.ORG Sun Jun 12 12:25:17 2005 Return-Path: X-Original-To: cvs-src@freebsd.org Delivered-To: cvs-src@freebsd.org Received: from green.homeunix.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 4600516A41C; Sun, 12 Jun 2005 12:25:17 +0000 (GMT) (envelope-from green@green.homeunix.org) Received: from green.homeunix.org (green@localhost [127.0.0.1]) by green.homeunix.org (8.13.3/8.13.1) with ESMTP id j5CCPGGf063878; Sun, 12 Jun 2005 08:25:16 -0400 (EDT) (envelope-from green@green.homeunix.org) Received: (from green@localhost) by green.homeunix.org (8.13.3/8.13.1/Submit) id j5CCPGSN063877; Sun, 12 Jun 2005 08:25:16 -0400 (EDT) (envelope-from green) Date: Sun, 12 Jun 2005 08:25:16 -0400 From: Brian Fundakowski Feldman To: Daniel Eischen Message-ID: <20050612122516.GG66188@green.homeunix.org> References: <20050612100708.GK17867@elvis.mu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i Cc: cvs-src@freebsd.org, Alfred Perlstein , src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/nfsclient nfs_bio.c nfs_vfsops.c nfsargs.h nfsmount.h src/sys/sys buf.h bufobj.h src/sys/kern vfs_bio.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Jun 2005 12:25:17 -0000 On Sun, Jun 12, 2005 at 06:30:49AM -0400, Daniel Eischen wrote: > On Sun, 12 Jun 2005, Alfred Perlstein wrote: > > > * Brian Fundakowski Feldman [050612 01:26] wrote: > > > On Sun, Jun 12, 2005 at 01:08:33AM -0700, Alfred Perlstein wrote: > > > > > > > > Seriously, have you tested what happens to a libc_r app that > > > > opens an nfs file F_SYNC? My guess is that it's not pretty. > > > > > > This code path is related to O_NONBLOCK, not O_FSYNC. O_FSYNC is > > > synonymous with the slow fallback path that large transactional block > > > now takes, rather than deadlocking. O_NONBLOCK really means that > > > whatever they do, they are required to check for EAGAIN. > > > > To make it perfectly clear. > > > > If an application linked against libc_r opens a file with O_FSYNC. > > Libc_r will set O_NONBLOCK (it does so for each open(2)) > > A write on that descriptor will return EAGAIN (to libc_r) > > Libc_r will then attempt to select(2) on this decriptor, which > > will return "ready" (as do all select(2)'s on disk files) > > > > The question is: > > > > Will Libc_r then busy spin? > > Yes, for the most part. > > > If so, how many other apps might get screwed just sometimes (over > > nfs) because only _half_ of this "solution" is implemented? > > > > Or is my thinking on this wrong? > > I think I agree with Alfred. > > If select() returns ready, then you should be able to write > some part of your buffer. Also, anyone using a file descriptor > in non-blocking mode should expect short writes and loop until > the entire buffer has been written. > > >From my understanding, disk I/O has always returned ready, then > blocked in the kernel if necessary. I think that if we are going > to start honoring non-blocking mode for disk I/O (or NFS, whatever), > it should be done fully. That means you allow short writes when > select() returns ready, and select() doesn't return ready if no > data can be written. That's a good point. I wasn't more than vaguely aware of libc_r's continued existance and usage of such things. Fixing select(3) to match up would be easiest, right? Short writes are definitely not allowed for a non-socket, though. -- Brian Fundakowski Feldman \'[ FreeBSD ]''''''''''\ <> green@FreeBSD.org \ The Power to Serve! \ Opinions expressed are my own. \,,,,,,,,,,,,,,,,,,,,,,\