From owner-freebsd-current@freebsd.org Fri Jun 21 22:52:04 2019 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5380215C2958 for ; Fri, 21 Jun 2019 22:52:04 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 442B485287; Fri, 21 Jun 2019 22:52:03 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lj1-f193.google.com with SMTP id i21so7337370ljj.3; Fri, 21 Jun 2019 15:52:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=kxatzZc3xA0KGXsfaeLyDg1gWQ4J74NPGmCOQKt8va8=; b=GbxDdQtO4nAww4+6isL1J8SZbKeMNEFrWke+8JV0JKXfX49ZQEyL26Zo66gF5mmybv zJvN3VWrMPUntEda17FvLk88ppw17u1wbe4DrZhS1aVFebMRbwhqihXtlc/aiwbkJhAd I99jTGEQ2AXCgWuSgrqFNP7wWwr9uagoU9abeEuVA5ZXDgjsBwuZNm+azQGGlkoaeQ7C CDeHbY5gaqPoNY8ykUSTTP37wVAASIqaI2UdvW8t45EbB1O46mq86RE1MHDAwmBRpvwA MMejeF80bajJHaB0or/4iRZkeDcvSS2M6307i8k+TDDUX/0+BX0i2I2xX28pzbB0NFSm qm1A== X-Gm-Message-State: APjAAAXDE4hMQNdJzePK4m4Cfqw/rX+wsWOJpwdWKTLnyCNKucbxNggN EvPl+WqgOzmfAEFO74nSbkwVqxHLwHywgCzE5Oo0SCwC X-Google-Smtp-Source: APXvYqz/V6LbYU3CIuD2mjCXO2VQvz5Ypw8gHp8AgebALPhytXzwmhIkidMX24aOVsPM5vz/xzIUNiqGZRIxz9Z1tng= X-Received: by 2002:a2e:81d8:: with SMTP id s24mr23008204ljg.37.1561157516005; Fri, 21 Jun 2019 15:51:56 -0700 (PDT) MIME-Version: 1.0 References: <17B3F210-5101-449F-AE06-326F890C3C01@samsco.org> In-Reply-To: From: Alan Somers Date: Fri, 21 Jun 2019 16:51:44 -0600 Message-ID: Subject: Re: Reducing UFS corruption from unclean shutdowns? To: Warner Losh Cc: Scott Long , "Conrad E. Meyer" , FreeBSD Current Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 442B485287 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 209.85.208.193 as permitted sender) smtp.mailfrom=asomers@gmail.com X-Spamd-Result: default: False [-3.22 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; IP_SCORE(-1.25)[ip: (-0.44), ipnet: 209.85.128.0/17(-3.44), asn: 15169(-2.33), country: US(-0.06)]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.96)[-0.961,0]; RCVD_IN_DNSWL_NONE(0.00)[193.208.85.209.list.dnswl.org : 127.0.5.0]; SUBJECT_ENDS_QUESTION(1.00)[]; FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[193.208.85.209.rep.mailspike.net : 127.0.0.17]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[asomers@freebsd.org,asomers@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Jun 2019 22:52:04 -0000 On Fri, Jun 21, 2019 at 4:50 PM Warner Losh wrote: > > > > On Fri, Jun 21, 2019, 3:44 PM Scott Long wrote: >> >> >> >> > On Jun 21, 2019, at 4:37 PM, Warner Losh wrote: >> > >> > On Fri, Jun 21, 2019, 3:33 PM Conrad Meyer wrote: >> > >> >> On Fri, Jun 21, 2019 at 2:55 PM Alan Somers wro= te: >> >>> I would've thought that immediately following a sync(8), the >> >>> filesystem would be consistent. Why do I still see errors after a >> >>> panic in files that were written before I sync()ed? >> >>> -Alan >> >> >> >> Hi Alan, >> >> >> >> Contra the name, sync(2) (sync(8)) isn't synchronous. It invokes >> >> VFS_SYNC() with MNT_NOWAIT across all mountpoints. >> >> >> > >> > Yes. Sync(2) just starts the I/O, but it may be delayed if there is a = lot >> > of dirty buffers. The other issue is that new buffers may be dirtied= =E2=80=A6 >> > >> >> Still, the point of SU and SU+J is that the filesystem should not be >> damaged and require active repair on reboot, whether or not a >> sync or fsync was done. There=E2=80=99s certainly issues with disk lyin= g >> about out of order writes, POSIX sematics of unlinked files, and the >> inherent design of UFS superblock updates, but the problems that >> Alan reported should still be looked at, they=E2=80=99re not expected an= d >> they undermine the usefulness of SU+J. > > > Yea. Ata write cache might cause it. But only once in a while and usually= only with power fail. Some drives / devices need a final flush, so that mi= ght be an issue. I fixed an issue in nvme on shutdown like this, but panic = should trigger that code... > > Warner No ATA write cache here. I'm using bhyve with a virtio disk.