From owner-freebsd-questions@FreeBSD.ORG Tue Nov 22 07:46:30 2005 Return-Path: X-Original-To: questions@freebsd.org Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A320E16A49A for ; Tue, 22 Nov 2005 07:46:29 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0C62B43D68 for ; Tue, 22 Nov 2005 07:46:27 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.1/8.13.3) id jAM7jxUd026504; Tue, 22 Nov 2005 01:45:59 -0600 (CST) (envelope-from dan) Date: Tue, 22 Nov 2005 01:45:59 -0600 From: Dan Nelson To: Mikhail Teterin Message-ID: <20051122074559.GA6893@dan.emsphone.com> References: <200511211650.08260.mi+mx@aldan.algebra.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200511211650.08260.mi+mx@aldan.algebra.com> X-OS: FreeBSD 5.4-STABLE X-message-flag: Outlook Error User-Agent: Mutt/1.5.11 Cc: questions@freebsd.org Subject: Re: some files written via mmap end up corrupted X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Nov 2005 07:46:30 -0000 In the last episode (Nov 21), Mikhail Teterin said: > I must not be using the API properly :-( > > The writes to the mmap-ed area and then fsync-s the opened file, > munmaps it, and exits. > > Sometimes, the files end up corrupted at the end, however -- in about > 10% of cases. What kind of corruption are you seeing? Blocks of zeroes? Maybe you need to call msync() before unmapping the region? Or call munmap before fsync. > What am I doing wrong? Thanks! Can't tell that for sure without seeing the code :) -- Dan Nelson dnelson@allantgroup.com