Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4233525ioo; Mon, 30 May 2022 22:55:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJfU8Rvz/190Z0qZYY0urFXXLiyuF/+HwKq7g27BQywg5It2HfhscW2yEU01KKF1E7KdpO X-Received: by 2002:a17:90b:2245:b0:1e0:6ad6:33c with SMTP id hk5-20020a17090b224500b001e06ad6033cmr26489265pjb.86.1653976557119; Mon, 30 May 2022 22:55:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653976557; cv=none; d=google.com; s=arc-20160816; b=GZexNFzTL7s/wN+6VO8qtRtHl09RHkBxr9OXdp0KgrpnVxHfBQkP0O8QnGvyJUyfyb 6MawEbpkX5Gyg0HzFMgZ9Dy9O4LMnPS8sAw+ueSfX4CIWBvimSjmMD4DW6tAmYZj0vJe Q5GHICU5wh5EsQNYboAH4NpqrU0dHbSHlJ59HLXS1xee/6pY0Q9h/6weizcW/lOBK2aw 51Mex4HOqicXRmAs/7TE1Dn3eQNBI3GM0UYIgGRPbUslmPXDARSOFsquBFVO5K/V3zPx He/0h+MDwJugwp4I26HT0Aan97Z9QvY5Va0z72jauHdRxkv2e4gELZmRi8Y+raDGlvqZ saeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9XVHS3rlr74kwDPS9cPLZWGBf1IHIjmcfJWC5iwwI2Q=; b=J4OqPJ5WrcA5WCov7m7JOjDUw2/zGGjIToDiDWIERCcZZCBLDTbqd1ZnbMGg6pWuZE huz7B34+AwtA64A6Pg6AKf0FLelOSEYj5FA17nODHYocR7e7mWOTqxwwD2vrvcbTCvRD fvEV9jFsqZY7n5WCYzmkAhj66nm7pf7Aef7n/i0dLzcFgKpGxfwnteBv82Ru+Q0Zhycd w+VVrLyeQyCFi+bqA59odHlR0g9yzm5sMe9VNpnKrlgwcB4r+/b0zX+POTgpFbeykJWj /203WiUL3RLxmd83OODhz3uOUyL6Se1Coy/+8HFcZ2w1B1SDYnSrPY2pY9hdFJrI1ntL x8MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=MbARoEMN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n6-20020a63a506000000b003fc6bdc732fsi343837pgf.131.2022.05.30.22.55.45; Mon, 30 May 2022 22:55:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=MbARoEMN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241670AbiE3Pdq (ORCPT + 99 others); Mon, 30 May 2022 11:33:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241531AbiE3Pdj (ORCPT ); Mon, 30 May 2022 11:33:39 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C0AD151FDB for ; Mon, 30 May 2022 07:38:29 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id jx22so21130261ejb.12 for ; Mon, 30 May 2022 07:38:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=9XVHS3rlr74kwDPS9cPLZWGBf1IHIjmcfJWC5iwwI2Q=; b=MbARoEMNQrQQ5S51pge6GPzZS8oHKf3IaF+XiDUy8Ks5VCzzDxfw2dNHfzHZpEiWQC Lir4csByQgi8syophTh9lcO08dPkZ5b+pcyLI4xvARvyOpGO5Dz1suPagZKcrX5giq++ tWsVlviaPGUMTu82QwfnMk/+msafi9JIPmz0I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=9XVHS3rlr74kwDPS9cPLZWGBf1IHIjmcfJWC5iwwI2Q=; b=n+r8eYO+WQb5XWC/XqRK6S4rnHoX2N8RWUBLAmTOzQUR7rUhLtQJCwp5V7GcdY5vxo O9dFDBJnVCrlj6p3O19w4SZhFebwwNpsSlDKbeQUkyjfS37V/jWZ5hmeNqqqwp7Iqp52 EBcLn5Cu+Q1htBwPLNY9i04TjRP0E5236spyDkjinVwrtRYGaJZGFE+TbOEBbqyJkHtv +9LWtEo8PXCgl2PGt4Gi/j7CrEd4OeM82AvXuPvkM6/Axd0XF8mbA+Am7xjzL3xLFVdP 3kbrAkygtzBTq5Bkw+n6kOKtE1BDaMFcblriwmI5DLVu31xTIUifCc6gSHMFpuS4289I Oi8w== X-Gm-Message-State: AOAM532jPwSUYDwXjb62rNkLQ91cijzlP9H3yMdnqX3jhojHyQ6Y9O6C OIAxpyc7u5EHjyslXZmbuQF1OQ== X-Received: by 2002:a17:906:90c9:b0:6fe:9e40:5cc with SMTP id v9-20020a17090690c900b006fe9e4005ccmr46125940ejw.367.1653921508038; Mon, 30 May 2022 07:38:28 -0700 (PDT) Received: from miu.piliscsaba.redhat.com (catv-178-48-189-3.catv.fixed.vodafone.hu. [178.48.189.3]) by smtp.gmail.com with ESMTPSA id bh19-20020a170906a0d300b006ff802baf5dsm910684ejb.54.2022.05.30.07.38.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 May 2022 07:38:27 -0700 (PDT) Date: Mon, 30 May 2022 16:38:24 +0200 From: Miklos Szeredi To: Jeff Layton Cc: Al Viro , ChenXiaoSong , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, liuyongqiang13@huawei.com, "zhangyi (F)" , zhangxiaoxu5@huawei.com, Steve French , NeilBrown Subject: Re: [PATCH -next,v2] fuse: return the more nuanced writeback error on close() Message-ID: References: <20220523014838.1647498-1-chenxiaosong2@huawei.com> <9915b7b556106d2a525941141755adcca9e50163.camel@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9915b7b556106d2a525941141755adcca9e50163.camel@kernel.org> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 30, 2022 at 10:02:06AM -0400, Jeff Layton wrote: > The main difference is that ->flush is called from filp_close, so it's > called when a file descriptor (or equivalent) is being torn down out, > whereas ->fsync is (obviously) called from the fsync codepath. > > We _must_ report writeback errors on fsync, but reporting them on the > close() syscall is less clear. The thing about close() is that it's > going be successful no matter what is returned. The file descriptor will > no longer work afterward regardless. > > fsync also must also initiate writeback of all the buffered data, but > it's not required for filesystems to do that on close() (and in fact, > there are good reasons not to if you can). A successful close() tells > you nothing about whether your data made it to the backing store. It > might just not have been synced out yet. > > Personally, I think it's probably best to _not_ return writeback errors > on close at all. The only "legitimate" error on close is -EBADF. > Arguably, we should make ->flush be void return. Note that most > filp_close callers ignore the error anyway, so it's not much of a > stretch. > > In any case, if you do decide to return errors in fuse_flush, then > advancing the cursor would also have the effect of masking writeback > errors on dup()'ed file descriptors, and I don't think you want to do > that. Thanks for clarifying. Chen, would the following patch make sense for your case? Thanks, Miklos --- fs/fuse/file.c | 5 ----- 1 file changed, 5 deletions(-) --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -487,11 +487,6 @@ static int fuse_flush(struct file *file, fuse_sync_writes(inode); inode_unlock(inode); - err = filemap_check_errors(file->f_mapping); - if (err) - return err; - - err = 0; if (fm->fc->no_flush) goto inval_attr_out;