From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F573C2BA83 for ; Fri, 7 Feb 2020 22:05:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6419D217BA for ; Fri, 7 Feb 2020 22:05:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581113132; bh=qlcWDRwEnzvcPfmtvySQ7gNQ1Rf4CjYVACOTUXhbijw=; h=Subject:From:To:Cc:Date:In-Reply-To:References:List-ID:From; b=md2WCz8MEzvZkg+mau++fpEAoMNLEt2Ve8K5R7x6i0KYI5HmepoiufcYXALA4vw4V xph1WMSEc+eSJhSG89duCv3npK28VAG3xC1n9elNz5ZZIeuxr3EsrXACA/aBBVmCcv JZ1INhHpQ/OTwayQY21VuDa7nShkNq6Z1yQ22rmA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727546AbgBGWFb (ORCPT ); Fri, 7 Feb 2020 17:05:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:47798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727075AbgBGWFb (ORCPT ); Fri, 7 Feb 2020 17:05:31 -0500 Received: from tleilax.poochiereds.net (68-20-15-154.lightspeed.rlghnc.sbcglobal.net [68.20.15.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B458021775; Fri, 7 Feb 2020 22:05:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581113130; bh=qlcWDRwEnzvcPfmtvySQ7gNQ1Rf4CjYVACOTUXhbijw=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=tOaqLFmViNHtLJ0btaMSz2O23itaYUjpdi7DO/FH7kX+FopxjY6pERxhD1s2MgkcJ 81RiotUbuzIsf4uat0ulWeRNmTSzO7IhTsrQWlQJQmJzcC49f2fwxLJUehisWrqbz8 EWID0NKm/xXKgL3NTngEVcyDtCrEO5Hv7mjgl3qs= Message-ID: <220e015c525650588f24d17f549cd0a87ec518fd.camel@kernel.org> Subject: Re: [PATCH v3 0/3] vfs: have syncfs() return error when there are writeback errors From: Jeff Layton To: Andres Freund , Dave Chinner Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, willy@infradead.org, dhowells@redhat.com, hch@infradead.org, jack@suse.cz, akpm@linux-foundation.org Date: Fri, 07 Feb 2020 17:05:28 -0500 In-Reply-To: <20200207212012.7jrivg2bvuvvful5@alap3.anarazel.de> References: <20200207170423.377931-1-jlayton@kernel.org> <20200207205243.GP20628@dread.disaster.area> <20200207212012.7jrivg2bvuvvful5@alap3.anarazel.de> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.3 (3.34.3-1.fc31) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2020-02-07 at 13:20 -0800, Andres Freund wrote: > Hi, > > On 2020-02-08 07:52:43 +1100, Dave Chinner wrote: > > On Fri, Feb 07, 2020 at 12:04:20PM -0500, Jeff Layton wrote: > > > You're probably wondering -- Where are v1 and v2 sets? > > > The basic idea is to track writeback errors at the superblock level, > > > so that we can quickly and easily check whether something bad happened > > > without having to fsync each file individually. syncfs is then changed > > > to reliably report writeback errors, and a new ioctl is added to allow > > > userland to get at the current errseq_t value w/o having to sync out > > > anything. > > > > So what, exactly, can userspace do with this error? It has no idea > > at all what file the writeback failure occurred on or even > > what files syncfs() even acted on so there's no obvious error > > recovery that it could perform on reception of such an error. > > Depends on the application. For e.g. postgres it'd to be to reset > in-memory contents and perform WAL replay from the last checkpoint. Due > to various reasons* it's very hard for us (without major performance > and/or reliability impact) to fully guarantee that by the time we fsync > specific files we do so on an old enough fd to guarantee that we'd see > the an error triggered by background writeback. But keeping track of > all potential filesystems data resides on (with one fd open permanently > for each) and then syncfs()ing them at checkpoint time is quite doable. > > *I can go into details, but it's probably not interesting enough > Do applications (specifically postgresql) need the ability to check whether there have been writeback errors on a filesystem w/o blocking on a syncfs() call? I thought that you had mentioned a specific usecase for that, but if you're actually ok with syncfs() then we can drop that part altogether. > > > > - This adds a new generic fs ioctl to allow userland to scrape the > > > current superblock's errseq_t value. It may be best to present this > > > to userland via fsinfo() instead (once that's merged). I'm fine with > > > dropping the last patch for now and reworking it for fsinfo if so. > > > > What, exactly, is this useful for? Why would we consider exposing > > an internal implementation detail to userspace like this? > > There is, as far as I can tell, so far no way but scraping the kernel > log to figure out if there have been data loss errors on a > machine/fs. Even besides app specific reactions like outlined above, > just generally being able to alert whenever there error count increases > seems extremely useful. I'm not sure it makes sense to expose the > errseq_t bits straight though - seems like it'd enshrine them in > userspace ABI too much? > Yeah, if we do end up keeping it, I'm leaning toward making this fetchable via fsinfo() (once that's merged). If we do that, then we'll split this into a struct with two fields -- the most recent errno and an opaque token that you can keep to tell whether new errors have been recorded since. I think that should be a little cleaner from an API standpoint. Probably we can just drop the ioctl, under the assumption that fsinfo() will be available in 5.7. Cheers, -- Jeff Layton From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Layton Subject: Re: [PATCH v3 0/3] vfs: have syncfs() return error when there are writeback errors Date: Fri, 07 Feb 2020 17:05:28 -0500 Message-ID: <220e015c525650588f24d17f549cd0a87ec518fd.camel@kernel.org> References: <20200207170423.377931-1-jlayton@kernel.org> <20200207205243.GP20628@dread.disaster.area> <20200207212012.7jrivg2bvuvvful5@alap3.anarazel.de> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20200207212012.7jrivg2bvuvvful5-npzPixP2Kky4qIFNZ/xzbbNAH6kLmebB@public.gmane.org> Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Andres Freund , Dave Chinner Cc: viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org, dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org, jack-AlSwsSmVLrQ@public.gmane.org, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org List-Id: linux-api@vger.kernel.org On Fri, 2020-02-07 at 13:20 -0800, Andres Freund wrote: > Hi, > > On 2020-02-08 07:52:43 +1100, Dave Chinner wrote: > > On Fri, Feb 07, 2020 at 12:04:20PM -0500, Jeff Layton wrote: > > > You're probably wondering -- Where are v1 and v2 sets? > > > The basic idea is to track writeback errors at the superblock level, > > > so that we can quickly and easily check whether something bad happened > > > without having to fsync each file individually. syncfs is then changed > > > to reliably report writeback errors, and a new ioctl is added to allow > > > userland to get at the current errseq_t value w/o having to sync out > > > anything. > > > > So what, exactly, can userspace do with this error? It has no idea > > at all what file the writeback failure occurred on or even > > what files syncfs() even acted on so there's no obvious error > > recovery that it could perform on reception of such an error. > > Depends on the application. For e.g. postgres it'd to be to reset > in-memory contents and perform WAL replay from the last checkpoint. Due > to various reasons* it's very hard for us (without major performance > and/or reliability impact) to fully guarantee that by the time we fsync > specific files we do so on an old enough fd to guarantee that we'd see > the an error triggered by background writeback. But keeping track of > all potential filesystems data resides on (with one fd open permanently > for each) and then syncfs()ing them at checkpoint time is quite doable. > > *I can go into details, but it's probably not interesting enough > Do applications (specifically postgresql) need the ability to check whether there have been writeback errors on a filesystem w/o blocking on a syncfs() call? I thought that you had mentioned a specific usecase for that, but if you're actually ok with syncfs() then we can drop that part altogether. > > > > - This adds a new generic fs ioctl to allow userland to scrape the > > > current superblock's errseq_t value. It may be best to present this > > > to userland via fsinfo() instead (once that's merged). I'm fine with > > > dropping the last patch for now and reworking it for fsinfo if so. > > > > What, exactly, is this useful for? Why would we consider exposing > > an internal implementation detail to userspace like this? > > There is, as far as I can tell, so far no way but scraping the kernel > log to figure out if there have been data loss errors on a > machine/fs. Even besides app specific reactions like outlined above, > just generally being able to alert whenever there error count increases > seems extremely useful. I'm not sure it makes sense to expose the > errseq_t bits straight though - seems like it'd enshrine them in > userspace ABI too much? > Yeah, if we do end up keeping it, I'm leaning toward making this fetchable via fsinfo() (once that's merged). If we do that, then we'll split this into a struct with two fields -- the most recent errno and an opaque token that you can keep to tell whether new errors have been recorded since. I think that should be a little cleaner from an API standpoint. Probably we can just drop the ioctl, under the assumption that fsinfo() will be available in 5.7. Cheers, -- Jeff Layton