From owner-freebsd-hackers Thu Mar 12 20:31:17 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id UAA18131 for freebsd-hackers-outgoing; Thu, 12 Mar 1998 20:31:17 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from Kitten.mcs.com (Kitten.mcs.com [192.160.127.90]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id UAA18084 for ; Thu, 12 Mar 1998 20:31:04 -0800 (PST) (envelope-from karl@Mercury.mcs.net) Received: from Mercury.mcs.net (karl@Mercury.mcs.net [192.160.127.80]) by Kitten.mcs.com (8.8.7/8.8.2) with ESMTP id WAA01277 for ; Thu, 12 Mar 1998 22:31:02 -0600 (CST) Received: (from karl@localhost) by Mercury.mcs.net (8.8.7/8.8.2) id WAA15375; Thu, 12 Mar 1998 22:31:02 -0600 (CST) Message-ID: <19980312223102.50360@mcs.net> Date: Thu, 12 Mar 1998 22:31:02 -0600 From: Karl Denninger To: hackers@FreeBSD.ORG Subject: Odd problem we're seeing here Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.84 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I'm seeing an interesting problem here. Assuming two writers to an NFS file from the SAME machine. Writer #1 has opened the file O_RDWR and intends to do a set of random operations on it. Writer #2 has opened the file O_WRONLY|O_APPEND and intends only to add to the end of the file. Writer #1 gets an flock on the file, and does things to the file. He might even do an ftruncate at some point to roll back the contents. Writer #2, in the meantime, attempts to get an flock on the file and (correctly) blocks, waiting for Writer #1 to finish. Writer #1 gets done, and releases his lock. Writer #2 *SOMETIMES DOES NOT WRITE TO THE CORRECT (END OF FILE) PLACE*. This is difficult to reproduce, but it can be done. It appears that the O_APPEND isn't causing the implied lseek(....., 0, SEEK_END) to be done before each write in this situation. I'm trying to nail this one down. The latest patches to the NFS code appear to make this happen more often than it did before, but it did occasionally happen even before the patches. This NEVER happens on locally mounted files, but occasionally happens on NFS mounted files. Yes, I know flock is local to the machine it is executed on. That's ok; the two processes ARE running on the same machine. -CURRENT from a couple of days ago.... -- -- Karl Denninger (karl@MCS.Net)| MCSNet - Serving Chicagoland and Wisconsin http://www.mcs.net/ | T1's from $600 monthly / All Lines K56Flex/DOV | NEW! Corporate ISDN Prices dropped by up to 50%! Voice: [+1 312 803-MCS1 x219]| EXCLUSIVE NEW FEATURE ON ALL PERSONAL ACCOUNTS Fax: [+1 312 803-4929] | *SPAMBLOCK* Technology now included at no cost To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message