From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796111576; b=Yw5EbAeWe4wscYoNOU15KOgPXOu0ZXZdhMwQd6GmdUY7Qg9KVBcmk/9yxrX+gdEHS5kl fa2tqTDh/oJ03HiYKm7cyOFMl2oY3LlcHKDHuQ4z6ZU5uIZJpxY4BlDFJOd6bD3EbBLe0 VgT2aGNNpra6CTb4bwWv9fHNMzTkmQeKTPHJ77G1+0vv3cU817hIURmRuBpYaTPLk47H/ Ec7glmV0sTxvIYnnEZ1yv38r1EB+IrQaThig0ZEzFwUzMqQRbFCoaAO9wSLfrHuQovvJp 99t5i7I0E1z+0angVA/vAgWDFMU6r/nLwQDGkTMU5WUm79TQ/DLOjyOc/ww1uX3vMIQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796111576; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=hJgUdc+kYmZsq6TLbg2tpdf6HKlYZfwaAPmANurLEoY=; b=ZJCu/SP+WGvXclKYe4DT4E/TFmiuBFa+hp11pP4cIdLlKCUOKqHII6mLFcqmdVzu4fRX mobJxtKhRHy1upmwu17guw4DB+NZCLp+MLBzB8p+MUD+j1QmXm/ERbLaPnzdcnpviVlCl ZjrtlwbVLm/YikDIvZDnOcwHjT1BO4mCqJU7AktIOM5CmZlxQzJeMb1asf9TYtGkm5DwB GtDx9CvsmIAJUkD5geqx7XFmyj+9eUR1OS3Ujf9wgAqcgks6tWC/RNU93i7ODcODOyPVz uS5Vp9M6AyEieQ5sihZPrIv3/d2hL42NVfWo006QDTE0948d090KpJtrKdigfYpLmQg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="JTHxiL/t"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD213606A31A for ; Tue, 1 Dec 2026 07:52:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JTHxiL/t Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEAFF1F000C1; Tue, 1 Dec 2026 07:52:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796111576; bh=hJgUdc+kYmZsq6TLbg2tpdf6HKlYZfwaAPmANurLEoY=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=JTHxiL/t6CUjpPrw/AjBHhCDKhYT+0Xte8aq9CXo25D2mhQhQ4L+qpm3n4//h0p7a sl42Tgz9PkggNDpc9AbapkJBBFDPieIod/WWEbHpGmAJi8+aMOS5+taoBi2kFzi6OY aTrCIH1mFQ7bs4LCDhhAu3qZ+tR88cJB+QF+tJP47onhU1hLHKFS2y8N72z2lwsOCd mxifIPok3YbE+Cp9EUhjB7pnHfWbWJX2hXF8pO+GpPJ2hceKgdQPs1qpKjdutvJa3s YXrFx/O7IX7ZlfJt1SkgurNKVYjMaQy7l08+T+fBwF90yQ8hQPYU5nCa84/Z0DHNq5 ZPRablZ9IMl3A== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 2/2] dm thin: add wait_for_commit pool feature Reply-To: sashiko-reviews@lists.linux.dev To: "Peng Yu" , "Alasdair Kergon" , "Mike Snitzer" , "Mikulas Patocka" , "Benjamin Marzinski" Cc: "Joe Thornber" , dm-devel@lists.linux.dev In-Reply-To: <20261201072532.68398-3-yupeng0921@gmail.com> References: <20261201072532.68398-1-yupeng0921@gmail.com> <20261201072532.68398-3-yupeng0921@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 07:52:55 +0000 X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] dm thin: unreachable aborted-changes check in complete_discard_mapping() -- commit 6186cc8a4374967ef907958ccb4e31311f078113 Author: Peng Yu dm thin: add wait_for_commit pool feature This commit adds the wait_for_commit pool feature so that writes and discards on thin devices with uncommitted metadata changes only complete after the metadata transaction is committed. > diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c > index e695fc356c4dc..6485c19506e4d 100644 > --- a/drivers/md/dm-thin.c > +++ b/drivers/md/dm-thin.c [ ... ] > @@ -1065,6 +1085,40 @@ static void process_prepared_discard_success(struc= t dm_thin_new_mapping *m) > free_discard_mapping(m); > } > =20 > +/* > + * The metadata work of the discard is done. With the wait_for_commit > + * feature the discard is completed, and its cell released, only after t= he > + * commit: until then no other IO to the range may see the discard. > + */ > +static void complete_discard_mapping(struct dm_thin_new_mapping *m) > +{ > + struct thin_c *tc =3D m->tc; > + struct pool *pool =3D tc->pool; > + > + if (!pool->pf.wait_for_commit || > + !dm_thin_changed_this_transaction(tc->td)) { > + process_prepared_discard_success(m); > + return; > + } > + > + /* > + * As for a FUA write: fail the discard if earlier changes to the > + * metadata could not be committed. > + */ > + if (dm_thin_aborted_changes(tc->td)) { > + process_prepared_discard_fail(m); > + return; > + } [Severity: Medium] Can dm_thin_aborted_changes(tc->td) ever be reached here when true, or do discards instead complete with success after an aborted transaction? td->aborted_with_changes is only set by dm_pool_abort_metadata() via metadata_operation_failed() -> abort_transaction(), which immediately switches the pool to PM_READ_ONLY: drivers/md/dm-thin.c:set_pool_mode() { ... case PM_OUT_OF_METADATA_SPACE: case PM_READ_ONLY: dm_pool_metadata_read_only(pool->pmd); pool->process_bio =3D process_bio_read_only; pool->process_discard =3D process_bio_success; pool->process_cell =3D process_cell_read_only; pool->process_discard_cell =3D process_cell_success; pool->process_prepared_mapping =3D process_prepared_mapping_fail; pool->process_prepared_discard =3D process_prepared_discard_success; ... } Because complete_discard_mapping() is only called after dm_thin_remove_range() or dm_pool_dec_data_range() succeeds, and both fail once the metadata block manager is marked read-only, this check is dead code. Meanwhile, any discards processed in PM_READ_ONLY or PM_OUT_OF_METADATA_SPACE mode are completed with BLK_STS_OK by process_bio_success(), process_cell_success(), and process_prepared_discard_success(), even when wait_for_commit is enabled and their mapping removals were never committed. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201072532.6839= 8-1-yupeng0921@gmail.com?part=3D2