From owner-freebsd-stable Sat May 25 0:59: 4 2002 Delivered-To: freebsd-stable@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id 3634D37B406 for ; Sat, 25 May 2002 00:59:01 -0700 (PDT) Received: from apollo.backplane.com (localhost [127.0.0.1]) by apollo.backplane.com (8.12.3/8.12.3) with ESMTP id g4P7wIU1061954; Sat, 25 May 2002 00:59:01 -0700 (PDT) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.12.3/8.12.3/Submit) id g4P7wIHP061953; Sat, 25 May 2002 00:58:18 -0700 (PDT) Date: Sat, 25 May 2002 00:58:18 -0700 (PDT) From: Matthew Dillon Message-Id: <200205250758.g4P7wIHP061953@apollo.backplane.com> To: Eugene Grosbein Cc: stable@FreeBSD.ORG Subject: Re: NFS problem with 4.6-PRERELEASE: SIGBUG in Apache References: <3CEE5094.EFF31B42@grosbein.pp.ru> <200205242137.g4OLbFmi058923@apollo.backplane.com> <20020525102224.A43047@svzserv.kemerovo.su> <200205250250.g4P2oSdA060174@apollo.backplane.com> <3CEF1E41.841937F4@svzserv.kemerovo.su> <200205250740.g4P7ee6P061752@apollo.backplane.com> <3CEF42CC.74C2B50C@svzserv.kemerovo.su> Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG : :How one can write reliable application using mmap :if plain read from file after successful mmap can destroy an application? : :Eugene Grosbein I don't understand. Reading from a file will not screw up an application. It's changing a file out from under mmap() ... specifically, changing the *size* of the file which can potentially cause an application using mmap() on the file to seg-fault if it attempts to read an area in the mmap() that is beyond the post-truncation file EOF. This has always been true and will occur with a local filesystem as well as with NFS. The major issue with NFS vs a local filesystem is that the since NFS is a stateless protocol, deleting a file on the server can cause clients with open file descriptors to the deleted file to get I/O errors on those descriptors (or seg faults if they happen to be mmap()'d). On a local filesystem the file doesn't actually go away until the last open descriptor is closed. So when updating files which might be mmap()'d over NFS, you have to be careful not to delete or truncate a file which may be in-use. -Matt Matthew Dillon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message