From owner-freebsd-fs@FreeBSD.ORG Tue May 18 17:11:15 2004 Return-Path: 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 89DDF16A4D0 for ; Tue, 18 May 2004 17:11:15 -0700 (PDT) Received: from gw.catspoiler.org (217-ip-163.nccn.net [209.79.217.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1F1DC43D2D for ; Tue, 18 May 2004 17:11:15 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.12.9p2/8.12.9) with ESMTP id i4IN8L7E021763; Tue, 18 May 2004 16:08:26 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Message-Id: <200405182308.i4IN8L7E021763@gw.catspoiler.org> Date: Tue, 18 May 2004 16:08:21 -0700 (PDT) From: Don Lewis To: julian@elischer.org In-Reply-To: MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii cc: freebsd-fs@FreeBSD.org cc: Nikita@Namesys.COM cc: mi+mx@aldan.algebra.com Subject: Re: QMail and SoftUpdates X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2004 00:11:15 -0000 On 18 May, Julian Elischer wrote: > > > On Mon, 17 May 2004, Don Lewis wrote: > >> On 17 May, Nikita Danilov wrote: >> > Xin LI writes: >> > > On Mon, May 17, 2004 at 01:18:15PM -0400, Mikhail Teterin wrote: >> > > > The link at >> > > > >> > > > http://cr.yp.to/qmail/faq/reliability.html#filesystems >> > > > >> > > > claims, using SoftUpdates for mailqueue is dangerous. Is that still >> > > > true? Thanks! >> > > >> > > Yes, it is dangerous. Same is true for any journalling file systems, >> > > which essentially does the same thing: delayed write of data/metadata. >> > > >> > > Delayed write will make it possible for the Operating System to group >> > > several writes together and write them once, or at least, in a better >> > > order in order to improve performance. However, for the mail case, once >> > > it responds "250", then the remote peer is allowed to remove the message >> > > from its queue. If the system crashes, and the data was not written into >> > > disk, then your message is lost. >> > >> > Unless mail-server did fsync(2) which is guaranteed to return only after >> > data reached stable storage. If file-system doesn't provide such >> > guarantee it's broken, if mail server doesn't call fsync, or >> > fdatasync---it is. Even without any journalling involved. >> >> Based on the information I found using Google, it appears that qmail >> relies on link(2) being synchronous to let it know that a queued message >> is safely on the disk with a known file name before it issues the "250" >> response. I believe this was true without softupdates, but with >> softupdates enabled it is definitely not true. >> > > An fsync will sync ALL directory entries pointing to the file I haven't looked at how qmail works, but my suspicion is that it fsync()s the file and then creates a link (and probably unlinks the old name) to mark the queue file as valid and is not partially written. I think this would work with softupdates if the file were fsync()ed again after the link() call. I won't comment about why this change is unlikely to make it into the code.