From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from imap.thunk.org ([74.207.234.97]:36864 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752499AbeDLV6A (ORCPT ); Thu, 12 Apr 2018 17:58:00 -0400 Date: Thu, 12 Apr 2018 17:57:56 -0400 From: "Theodore Y. Ts'o" To: Andres Freund Cc: Jeff Layton , Matthew Wilcox , Andreas Dilger , 20180410184356.GD3563@thunk.org, Ext4 Developers List , Linux FS Devel , "Joshua D. Drake" Subject: Re: fsync() errors is unsafe and risks data loss Message-ID: <20180412215756.GX2801@thunk.org> References: <20180410220726.vunhvwuzxi5bm6e5@alap3.anarazel.de> <190CF56C-C03D-4504-8B35-5DB479801513@dilger.ca> <20180412021752.2wykkutkmzh4ikbf@alap3.anarazel.de> <20180412030248.GA8509@bombadil.infradead.org> <1523531354.4532.21.camel@redhat.com> <20180412202457.zszz7zl2pcdba35e@alap3.anarazel.de> <1523568474.7617.20.camel@redhat.com> <20180412215319.jvltbf32gbobrzvz@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180412215319.jvltbf32gbobrzvz@alap3.anarazel.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, Apr 12, 2018 at 02:53:19PM -0700, Andres Freund wrote: > > > > > > Isn't beautiful to script, but it's also not absolutely terrible. > > ext4 seems to have something roughly like that > (/sys/fs/ext4/$dev/errors_count), and by my reading it already seems to > be incremented from the necessary places. This is only for file system inconsistencies noticed by the kernel. We don't bump that count for data block I/O errors. The same idea could be used on a block device level. It would be pretty simple to maintain a counter for I/O errors, and when the last error was detected on a particular device. You could evne break out and track read errors and write errors eparately if that would be useful. If you don't care what block was bad, but just that _some_ I/O error had happened, a counter is definitely the simplest approach, and less hair to implemnet and use than something like a netlink channel or scraping dmesg.... - Ted