From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 3597A38CFE8 for ; Wed, 2 Sep 2026 05:49:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788328194; cv=none; b=hSPDcIIqa1kVI1soLJRunZcvm9YOe5N3VGAFx9c+7craStvESucC/bk/6b3J+CWY0vgO4VkUO3HapmQFIH5ooK8Bt0ksgIzB7KcfJhTv782WgQoio0bf17S444eZggzX6yX5CUcrliIB4BTAkmoS86SrgsbtPmM9fwP2qjSq7IA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788328194; c=relaxed/simple; bh=1z797QEkyBVW4goR8piaxQPYkc+pXIWiqLFdNKTm89w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gAtS3FpMrW0DjCnOxCHPgWB00kkMeCPvgbD1SRDrKHKCRpBor1jORee2Fsf9yPHUXFsl5HaYGYkloCzpSmTLPDpr03J/pniaO/A78gt3qos9xe+Nw8yVHeo/PDo1LgAmC2ldnDjOSW+F0m5hPnuxV3CJ7IYIzd1Jsfm6HFGm/k8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=clgsdC8t; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="clgsdC8t" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=lh7Wymo80w/3FTu8z9lehUG90H4IX1EVrkj00YxFpEI=; b=clgsdC8tPVoEmnqTLqtnKKeqw/ 5FiZZqciLVitWduRxb0IOhkfktoW7DFeAGlMslCVIjWoxDioHBJygNSZzQhxivEqM8ZJmFX9GGrhf JTAzVP4/srABVNhV5v8gM3b5Cyuh5nuLaKbOCnfsq2N4gtGadmASbWAEbmCIOstCCETiGKWlJUcat vazIJOZw/51Qf3k2OAnpKssaWGVA89h7KH0vBYjd/pk2ZISWaZ7zKv+kDTfxR6z6TTqrE9Rc7SrQn qoQZqwqlxPBXlApfdK7SV8RiPXMRKYcoS4MRyWMiiTC+/vGOt9qEtruqZh9HdrajMJ98k5jkd5vg3 xd6pt3gg==; Received: from 87-119-185-211.ip.elisa.ee ([87.119.185.211] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.99.1 #2 (Red Hat Linux)) id 1x1dr6-0000000Dp5D-1L2Z; Wed, 02 Sep 2026 05:49:52 +0000 From: Christoph Hellwig To: Carlos Maiolino Cc: linux-xfs@vger.kernel.org Subject: [PATCH 2/6] xfs: don't continue on error in xfs_fsync Date: Wed, 2 Sep 2026 08:49:16 +0300 Message-ID: <20260902054942.111988-3-hch@lst.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260902054942.111988-1-hch@lst.de> References: <20260902054942.111988-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html As soon as we get an error from cache flushing or log forcing, there is no point in continuing as the data integrity is already impacted. Return the error instead of continuing to do more work. Signed-off-by: Christoph Hellwig --- fs/xfs/xfs_file.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 426a67b813a7..0d31fea67a2c 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -130,8 +130,8 @@ xfs_file_fsync( { struct xfs_inode *ip = XFS_I(file->f_mapping->host); struct xfs_mount *mp = ip->i_mount; - int error, err2; int log_flushed = 0; + int error; trace_xfs_file_fsync(ip); @@ -154,15 +154,17 @@ xfs_file_fsync( error = blkdev_issue_flush(mp->m_rtdev_targp->bt_bdev); else if (mp->m_logdev_targp != mp->m_ddev_targp) error = blkdev_issue_flush(mp->m_ddev_targp->bt_bdev); + if (error) + return error; /* * If the inode has a inode log item attached, it may need the journal * flushed to persist any changes the log item might be tracking. */ if (ip->i_itemp) { - err2 = xfs_fsync_flush_log(ip, datasync, &log_flushed); - if (err2 && !error) - error = err2; + error = xfs_fsync_flush_log(ip, datasync, &log_flushed); + if (error) + return error; } /* @@ -178,14 +180,11 @@ xfs_file_fsync( if (!log_flushed) { struct xfs_buftarg *file_targp = xfs_inode_buftarg(ip); - if (mp->m_logdev_targp == file_targp) { - err2 = blkdev_issue_flush(file_targp->bt_bdev); - if (err2 && !error) - error = err2; - } + if (mp->m_logdev_targp == file_targp) + return blkdev_issue_flush(file_targp->bt_bdev); } - return error; + return 0; } static int -- 2.53.0