From owner-freebsd-current@freebsd.org Fri Jun 21 22:50:08 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 7AAEB15C23BA for ; Fri, 21 Jun 2019 22:50:08 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) (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 B02C984DD2 for ; Fri, 21 Jun 2019 22:50:07 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x834.google.com with SMTP id p15so8617215qtl.3 for ; Fri, 21 Jun 2019 15:50:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=l8DI9rn0EbF3jBJfXBuJ0WXRRQHTyxQvN7K4tQPxfnI=; b=B2bSMnnXU3ezk3rmIgiwnMLyefGeg6rK8xQR16qU0eblxzcYLfYgUoav9g8JXw4Naf Cvzfvx8+P4pvWztWny1jhxgz6vZIDmZMKUOkRDPsB5eisoVEP+6BenYWDV5ekdqUHskZ EMXCRTNTPfG29jVXSQhyMSEbjo3ILYiCzo6v2wCE6yM5Z5GdGvDtnFmTfgMorosWl+w6 zdeck/S5GeSH9SN8GvaE5b5jhm43EtcLRkqUkpc8rNLF1pgNMAcmv+PBaD539BxQ7oMZ nAF5kmfzMQrUB5XIK8n42tJ7UlUXpwAuHR+T2nXP0oGrgEPZgYn0/2uDXRmLpI8dwn1f FoIg== 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; bh=l8DI9rn0EbF3jBJfXBuJ0WXRRQHTyxQvN7K4tQPxfnI=; b=j4nSnyRsCkyU2EGt1E/DwkZ3VU+3rRP/omYI02pNcCarLH7pP2U7O11q/XXnlhO/KC CxbFfsIQgeKH0si0gENvTAB0gIgDqte/eTbPSkNioBFdQ6lJi22Fjk3wnlpX6LW0ihRY jewkPPhMA4zTPvdI41m6rLL0n0wF0zD7vqlQdZZN1x9yHuONO1ErhkC51Tnm/fOSyPtK FPuVgARdyLEC8qHF6agHfpDSkcJVGavU2m4/xDhQoCZTocRgdQ5qZgAje/eb1aOWRpH8 NySqpapeFKTaMtRbNX1BwaxRU4yPuJRY2trcnnRpSvUEs4Q6Mae+ZFhOtGaL4M90GoO1 q67A== X-Gm-Message-State: APjAAAXzNzjBlMMh4lgoVz45BYcvZiaEf+McE060Ce5rkFwh6c4X0YC7 aRbbyScSC0w2So2UreW3WzdT6lJTBMFqCJTWXCiIoA== X-Google-Smtp-Source: APXvYqyQKR9OgJeFL7CFtHjl7ftPYgo8nbeV9mZdMtMNGPHI4U8uUrTMYSdYI+TuqLvB2Ou6JFF3/uZJbPa27MAop74= X-Received: by 2002:aed:3e1d:: with SMTP id l29mr106155909qtf.175.1561157407133; Fri, 21 Jun 2019 15:50:07 -0700 (PDT) MIME-Version: 1.0 References: <17B3F210-5101-449F-AE06-326F890C3C01@samsco.org> In-Reply-To: <17B3F210-5101-449F-AE06-326F890C3C01@samsco.org> From: Warner Losh Date: Fri, 21 Jun 2019 15:49:33 -0700 Message-ID: Subject: Re: Reducing UFS corruption from unclean shutdowns? To: Scott Long Cc: "Conrad E. Meyer" , Alan Somers , FreeBSD Current X-Rspamd-Queue-Id: B02C984DD2 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=B2bSMnnX X-Spamd-Result: default: False [-5.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; IP_SCORE(-3.00)[ip: (-9.48), ipnet: 2607:f8b0::/32(-3.15), asn: 15169(-2.33), country: US(-0.06)]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; MX_GOOD(-0.01)[cached: ALT1.aspmx.l.google.com]; RCVD_IN_DNSWL_NONE(0.00)[4.3.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.98)[-0.985,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; SUBJECT_ENDS_QUESTION(1.00)[]; MIME_TRACE(0.00)[0:+,1:+]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_LAST(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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:50:08 -0000 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 > wrote: > >>> 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 l= ot > > 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 lying > 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 and > 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 might be an issue. I fixed an issue in nvme on shutdown like this, but panic should trigger that code... Warner Scott > > > >