From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.224.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796342211; b=KH4zVDkvxdK2I8Djr+y3VIwlJlQmRcLFF/rliNSHGG3GMUz36+kwn1rr9BBNtImbPFI4 zrjSGahxavphRQtbbR7MF+YLFZfedL5tXsKTEy338mVZcxuowPg2+W2CoqkRWQdJYnDfW rjXWuiiElkum5gNhhgMgRXd25dp+mVFavx3df4Y2X/GfgP4R8WGNY4RxLn901dBG5yQDC exCXDTBAc7U0TnDclMgfIt8eUtN6JaQgQP2S0NI2qMmD+P4nDjBeLmKIqkiYB3lNcZX2L Uw3aQoDD9HAJIspcgSJMxxLQ3tbO9hW2kj8dzWnAB3PdJMOfUd1HHpQ/sp6470y3RAg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796342211; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=9Fv2uLaFCBvj9DgfbtIy8pIsZBW2tKNeTfjWVlL9R8g=; b=Gl8b8CuCmci2aSD/ybQhfOMvK/PyAyj7PFfkwlQ1v5TvIir8pu4nwAAmcNklenHo49s7 KpVRQwL0NymOFfGIBFinoTK/vlyBVjzSIU48uT/jD3BKqTGpc6n4HneFGYw6O+I3xKfEz oQHCZUh+V63oopGIwotR2iuDu225MZLSy/32p6pPY7qnM51ECZoe/hzywD6GNnnmlmwYY 3D8/6QAkEQI69xfej0O6QB10pwT28IKuMILWomxuPnkFT4whVTvzA0GOV3jhYQtuIaCXr lG2sVVI+jk0Gu0nCbiC9WxY4+sgcIYCI700tPqoY0fMQA1HwmdXdhCtMxbbZeHWRyoQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=bJYUk563; arc=none smtp.remote-ip=74.125.224.131 Received: from mail-yx2-f3.google.com (mail-yx2-f3.google.com [74.125.224.131]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CEABD606A32F for ; Thu, 3 Dec 2026 23:56:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CEABD606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=bJYUk563 Received: by mail-yx2-f3.google.com with SMTP id 956f58d0204a3-67eb1a27e56so133545d50.0 for ; Thu, 03 Dec 2026 15:56:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796342210; x=1796947010; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=9Fv2uLaFCBvj9DgfbtIy8pIsZBW2tKNeTfjWVlL9R8g=; b=bJYUk563rC5Nsl152qU3esp8Az5S8uG/gLTzSwtuH1KpHC0vYUckW1UEQcGoeKvETB 7Q39Y6qcJqev/vi9RYTWHnrcBJqyIkqY4XOIIHHt8hPzSufrvYZrjxBR5qyGIA6vyzo2 fhV/I9QNeL2vH8aHtze4By1J0Xcm9jG+63hBLoyftBlpr8NYFTXbD94ONPCfuVMiBaNP QT5DnNiZ0GcT2aEjaV/nxXOF7m2nSh7pIDT3qOIzkD7mouuXS3uyNeOAV1mT5xMPqG07 32++UwXY0P+EsnvWmwqTE8mnH73J245QkZ8j+YwidznGf/utc5Fj/YU2fDCdvw5cXLxe Urtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796342210; x=1796947010; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=9Fv2uLaFCBvj9DgfbtIy8pIsZBW2tKNeTfjWVlL9R8g=; b=ucYjwSrKGMaB8K5Qt701Z2iDDR32argIJnWWDLe5S6Ux8GWSo4RLfVemH1D76aH1zc KN8p2uD5z7VkkJZzsv6cYFDm7nWRKAILX0F+1Bznkf2C6TFKBn8Mh+vEST5Gk5YBsYlC UpOMEc0vA+uCDh33591Z01mvTejX4Xwz8ZO+nlw+3/7j7J5ZOMhcoVD068+dhx2MoaIT ApzhIu+NAzVD7lN+15iHsEdUE2kXggJo6PltwiSHBkDbVH0SPPnUnlCk+hktPmPh8I/U 2v80C3vhjVsuwJ5glktpbrpbrfmJRTubeFMtTWCuEOz2AFjdG8wfyk+4I2KfgU3IEjgE tQ8w== X-Gm-Message-State: APuU4Z+B0AQ/QSvmPojDNd8XF9RD4Bqp1dSQAKPVBVTIyA12e/WHp6kf oUc60VSmDKusfaGa2acZ9ek3LyYBj8W0qq0HMh8bKgq8/GtZ0kmGnieQQS7q9R16 X-Gm-Gg: AZFdTZetMjFOMSSnoygBXKWZ3nPnBG5HTBFJfB8ROjw0E5Kf8NV8eIt+NA+wnDimp8M HhbGs1MY6qnpoXmfIeoV2QyqgVPE6weMfOEfoSa4JeeEb3aHqHiw2UaP/7KQDxl5GP9uQeY7HGO N1dfOU9DPaL5FUI1jhhszOw8Hz4Jf/aR1bAFnv0L2jyKIjXSg1yl3dSNOZsql1FSdNYIoNQaS2v FGm3acOew4VujfyQ33Aby4tkjsSZaIULq5ltgvjY7vbhvZ5p+oaFaj391JuHhNLkWCQXSM6gX+G Ne6HRFBeXZ9DHqMq+h2F31dpi3BQEByh08XE/YE91mLqLhObr64MRNU3XdZJHZiw/RDCHdMGdWJ Qd8y6mknFjiBbusOhsMDmvpnNEUOD4TLb34lHiMQKMYLuef9Js2nyH8GJu4xViaA415I+BqpHMr 9p+d+vUMJf3R+xN4BhLyAGH3X39XbQ76ecyhtaRbfuObgHYrO8+C7DcYl6sDEdh/4p+aJ7+4YwO C5Qxuz6ZRi7fTUah9xrVZhUnN6OeAny05/SPl/Y860P2kvoOgYpz0rXkMQc5QslWsQ+qi/UCT5L D5R3nTQEjAMBnUoLpxNC3kYS X-Received: by 2002:a05:690e:144a:b0:67d:a3f0:7d98 with SMTP id 956f58d0204a3-67f7245ba4amr246239d50.81.1796342209623; Thu, 03 Dec 2026 15:56:49 -0800 (PST) Received: from localhost ([2a03:2880:10ff:5a::]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-67f0cd0378dsm350140d50.9.2026.12.03.15.56.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 15:56:49 -0800 (PST) From: Leo Martins To: linux-btrfs@vger.kernel.org, kernel-team@fb.com Cc: David Sterba , Chris Mason , Filipe Manana , Josef Bacik Subject: [PATCH v2 0/2] btrfs: don't lose fsynced data to a transaction abort Date: Thu, 3 Dec 2026 15:56:44 -0800 Message-ID: X-Mailer: git-send-email 2.53.1 X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Fast fsync can sync a file extent item and its checksums to the tree log while the ordered extent is still waiting to update the subvolume tree. If the transaction aborts in between, replay can restore a file mapping whose blocks were overwritten after fsync returned. If an ordered extent that fast fsync logged fails to complete, patch 1 preserves the log for replay, and for a COW write keeps the new blocks out of the free space cache. Patch 2 refuses NOCOW writes after a filesystem error, so they can't overwrite logged data in place. That covers a preallocated range the failed ordered extent left unwritten, and an extent shared by a reflink that the cross-ref check can no longer see after an abort. The series is based on for-next, which has Josef's "btrfs: data integrity fixes" v3 [1]. Patch 1 describes the fast fsync prerequisites. Changes in v2: - Also handle failed writes into prealloc extents (Sashiko, via Filipe) and NOCOW writes in patch 1. - Check IOERR before marking an extent logged if ordered extent completion races fsync. - New patch 2. - Fix the discard comment (Filipe). v1: https://lore.kernel.org/linux-btrfs/54da67463c57f41302f8456a8a7a1190dcb65ae2.1794266796.git.loemra.dev@gmail.com/ [1] https://lore.kernel.org/linux-btrfs/20261120-b4-btrfs-data-integrity-v3-0-4de4b91b826e@toxicpanda.com/ Leo Martins (2): btrfs: fix loss of fsynced data when ordered extent completion fails btrfs: refuse NOCOW writes after a filesystem error fs/btrfs/inode.c | 100 +++++++++++++++++++++++++++++++++++++------- fs/btrfs/tree-log.c | 26 ++++++++---- 2 files changed, 104 insertions(+), 22 deletions(-) base-commit: 418f7723b545cf064fc584529710b28d1347188e -- 2.53.1-Meta