Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp180683lqh; Thu, 30 May 2024 19:31:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWexoyG+5G9Zb7DKYKxbuKfuf1zqkFnbo4OH2BETBtvQkx5N/Ups6tG3gxveC4AlyDCXdZ6wCCDQvW8bl405MveGpX3CgQS3Fh4jyAk7A== X-Google-Smtp-Source: AGHT+IGyAB3qEHWatSJtzN2YruTA4r4YjD2qqh/dgio3jbmrzEk49Rtcs5Yu2AR2Qtg1IoKdOuh4 X-Received: by 2002:a17:902:ecca:b0:1f4:7d47:b88b with SMTP id d9443c01a7336-1f636fe89damr9645755ad.11.1717122715604; Thu, 30 May 2024 19:31:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717122715; cv=pass; d=google.com; s=arc-20160816; b=JqgJmzHNqePQYgbJAilGPdXFvI3HagiO67xdqeNty8iToGwlpApLJfLWQEmDj2Sneb LLAYCtNpiW97RcrW+PPBMEvm63PdHk+sN61jU30KCf+f9hA/Ll+rbyhKExQuD+vIIrPy qolstwhrA1SPMnvRaXmlz0J568qehlW+0Z4gsDfvteoh69u8MGP/SvZfZrW9SbQcDi0L CjRFiLctvsZFbcDsZXIgQlluOhzIc2cWp7hkkuvce8cOutjqNyrgoC9EmGXk7BzUUznW wrrnUS1d2H96LWJCwvBtUMUaWxTkppR2aHd/7DheEPTMT7uxm9X8fw7DO32SOh9WzTDE 2iNA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=9DtHHW/1JNGGMpmrvNWctFteiGBA2L9suuHhbLIp850=; fh=9QA4ZLr+1b6KAs9emCF14kPKPWeMuKnIuKLpwBa8Frc=; b=ABdjrvMkGWFJIqUIUcmYiWx3vKZv5bKCoVAx4ev4V8RJOf1Pz7WdQgszYoXRwUV0HR vFrxPm8JQPRZ9vqpPiO/rBD2Fdck5v5ypc1rZNgrNHQPNjyZZMYcrGlCfXiIQMurpeiK SePdeAgy5qxk02CUQTm5fDHg3CAAcuFtN7ImuAXtPKD/i1kBTxF+gY53wfSrYlTP78wJ 5y4vorHpUJlds47KHUsmcXxp86GAphtVdF5HYnhXGbkR6CGUyZkP2jgVEW2WhApz9FRD D4uWhYLT4ikE9m0oGIOXaPy3xR4zFzztnD96duPVs/rMx0KvJ8ehbrpw+VrwXUhm52TL Zgxw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=BuCbUCZy; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-196189-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196189-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f632402ed2si3295365ad.497.2024.05.30.19.31.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 19:31:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196189-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=BuCbUCZy; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-196189-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196189-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3B4FA285B96 for ; Fri, 31 May 2024 02:31:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6070E78C8C; Fri, 31 May 2024 02:31:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="BuCbUCZy" Received: from out-186.mta1.migadu.com (out-186.mta1.migadu.com [95.215.58.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACB7D1F16B for ; Fri, 31 May 2024 02:31:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.186 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717122700; cv=none; b=k0+D31BgV4pDq2kQJrzQSz9puthasJXemZd8mwPBvaUirAtgcMC6rPs/WlbVQOxDFAdn0Wo2lfYFgDsDLvXbMgPh3ydXrp76gANZRY/sg/+K/GCUFz7GQYrag+8tE6RpiohWfUPpOHqlsjM8hC5gSlUW60xGkQbQrnqyk5DjIWw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717122700; c=relaxed/simple; bh=00ju4f/3GHc0EOMMkg7vmxo/6msUeyLgsUBjUiefSlU=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=QnB1mSklGV5PMEe0kQtGfEk7zcDhJBtgeK0gvKLSZnxAu630FhWrxqN3J8bS0Z1uE9IWKh48NzOSiF/59hed84x2pDuTY32cpVSTGJbdCIrXm7S7WHVul/VpS8EmF5Jwxth5mvmerZ/Xj2UPy6YYKkGxONLQixCQpBLg+X+flQg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=BuCbUCZy; arc=none smtp.client-ip=95.215.58.186 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: kent.overstreet@linux.dev DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1717122694; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=9DtHHW/1JNGGMpmrvNWctFteiGBA2L9suuHhbLIp850=; b=BuCbUCZyu9TzxKDUftypGJ8NhpNeLrZOuCiT9fscxqrfJexOohJvvm9Z1q/j8F2wed4uzx CKfIHVpoyCAcaKz1v4Kdv6AnwlMroeEuZcv9iYI5pxXN8dMfEhsK2/LbWgagFdo5VV2OhG Xft1e0+8HmmWqrCM96Bw11msIKz2SEE= X-Envelope-To: bfoster@redhat.com X-Envelope-To: linux-bcachefs@vger.kernel.org X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: tangyouling@kylinos.cn X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Youling Tang To: Kent Overstreet Cc: Brian Foster , linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org, Youling Tang Subject: [PATCH] bcachefs: track writeback errors using the generic tracking infrastructure Date: Fri, 31 May 2024 10:31:15 +0800 Message-Id: <20240531023115.11940-1-youling.tang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT From: Youling Tang We already using mapping_set_error() in bch2_writepage_io_done(), so all we need to do is to use file_check_and_advance_wb_err() when handling fsync() requests in bch2_fsync(). Signed-off-by: Youling Tang --- fs/bcachefs/fs-io.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c index ef20b64033e0..f5b266e51261 100644 --- a/fs/bcachefs/fs-io.c +++ b/fs/bcachefs/fs-io.c @@ -192,7 +192,7 @@ int bch2_fsync(struct file *file, loff_t start, loff_t end, int datasync) { struct bch_inode_info *inode = file_bch_inode(file); struct bch_fs *c = inode->v.i_sb->s_fs_info; - int ret; + int ret, err; ret = file_write_and_wait_range(file, start, end); if (ret) @@ -205,6 +205,11 @@ int bch2_fsync(struct file *file, loff_t start, loff_t end, int datasync) ret = bch2_err_class(ret); if (ret == -EROFS) ret = -EIO; + + err = file_check_and_advance_wb_err(file); + if (!ret) + ret = err; + return ret; } -- 2.34.1