From nobody Sat Feb 7 17:41:07 2026 Received: from mail-dl1-f99.google.com (mail-dl1-f99.google.com [74.125.82.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8256628DB49 for ; Tue, 6 Jan 2026 20:09:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.99 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767730146; cv=none; b=ZuNEtcnhvSpdVJLdTbpX/Etpt+uaRWCzOa6HlpouhiPNcciqd5/NUFibtiAr/aGdAGdL5Ei6DGJFVh5gxdcgN8CApH/6hdubMv1/UOWuyC0VMXQacfixbptyWC8oCF82TBYfPvm69CMVvtzhKFdPVopPSWJIYPekqQVu3LfyPoY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767730146; c=relaxed/simple; bh=2lcupd++x1Moic9b4VtfjeROaCYx184irW5v+3n9oZ0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=EX8Dnx/YGChzXXxwDgxreHijSknboBxBqjq8Oyg4RzElxYIR7s5gxxwqjr2BfZeded9QhMFP1kM0u2M4dyird00ZrCxEzSSpdvaF555TzbansU5fxxmYHTz3tA7eVRT6+N5jihpImTagMIsjMy3dfzxn8YFewfw4OttAU3Fbju4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=Z+5XAxL5; arc=none smtp.client-ip=74.125.82.99 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="Z+5XAxL5" Received: by mail-dl1-f99.google.com with SMTP id a92af1059eb24-121b937a5bcso65009c88.1 for ; Tue, 06 Jan 2026 12:09:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1767730143; x=1768334943; 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; bh=9SVubMuE0j+whBvLRvVXzI07Qv1rcUX3f0Z8uKGqRo8=; b=Z+5XAxL5sWOHYTafACtosf6u3Ks82Cj5f/vki3cJ1UZIDKSdTi3stXResJh0GJjS1m svk7uqZhUhT74w1JcJG2y5a1QhPYX4TlqNdoYDuMZjuZuiCIXoVtf5uYp/K1/5fm3qEB zVwH8zmWIRGKrcGPFu9YpyVWRIAoVNj1rPGuJ3l5/y1cmqlZTc/GLtCBgRN9cQxrqrNM l228hU0+DMqqab7MoveLtjqWGN6ds0c3b7T4qPWKmXHie0nAhxpw4yRllBVUtQLj0eaY AoeiWuu5xdavRhrIgSURbYQzCBIb4qWtL48RHA46tPyfRglg/pDuEMeJgV22GT2mSM/+ 8FBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767730143; x=1768334943; 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; bh=9SVubMuE0j+whBvLRvVXzI07Qv1rcUX3f0Z8uKGqRo8=; b=fjuQXlRf2GbV10mTdls5GD88VKIl3VHLDyvsWmPaUpheCkBvBT3FYGNFDWqw/nxRu9 sJSnpEEDSdaoa4bEm73CkBfnqe3frKMWZz10iiSYScp4VZbQObYRgVouyW0UeHhuDAp8 3FG1FWxSFzCa+uRtIvLBLBo3+oQmfzmN1T0t6XVBtgLQh5hjxOl/pYcsX/DxfxcTkjZd uMbpH1g22Y+OSCaXXhQglpRBTpXfuebP35A0BNYHYaLy8LkaZsuxhK55CesfyNTlo012 keI82KuMu7/tJoi2j1WtclL8A4qtgSOuDsnq5f9skETCIQh5oyX8oxDfpbcF8OWwCexD XnCQ== X-Forwarded-Encrypted: i=1; AJvYcCVHMUcabIH30pvapXYgHHUn15tI7mP+9+khlPPCeUYXBr0wqE0sNo/h3OVfPZM8LrmAIV7kpfbpJ3Pd8is=@vger.kernel.org X-Gm-Message-State: AOJu0Yw3rf92oAMwubOug9UzBIYN8VdJJextsCQD1S03UIZcKcFeuskJ 2yvd8u82NVggkDYvxas69j/HU78Qv/ISgVMaMaCsVFQYzq+3wvFBFsOoZiXWRL9mJf+HgN2eXs9 atvKX1ic3koPD5eMKezPh7U+nbtl0dCs9MzxL X-Gm-Gg: AY/fxX4quPAvsisTVp2G3mjDI35pxQiFsoF67VoFHCrPmZMfinndx+fO0ZcGm70TAu2 q7jcKFbg0nIyQR0icUDCXMgjTRIGHtNZ6uOTPpWGtzHuVC4IPc+mc/MKtRwyMT2ZSBS9Djbcdrn /hKlNfAp3LYrIXkWHl3vegis3Jx4gqAIdvOsDdOG4DzFs/YWdzNbKa0czyWMV6fmgtzyyv5nOh9 rs1423ViNCXUzzU1EFvyzNt7QipSjjzOdJ9CNfSwhCr5FVSkv7rd5bcUdxD1ikEbR/RnJV2RrYB zja47ovs1T1UIdkDhJKQ+lnF7QADIT8tU1Rt42svKpd6UsrZs7KZRbGwmxI5Lhsu58u5U4mFCDC JyV4CvRRA1RKjmk+rF5oe+q7IhFfzO9PGKN7WGwBvsw== X-Google-Smtp-Source: AGHT+IFri0XimIVAtss9i1TtFqdSkejhFF4tr/n0oIMn5U5OJKjupAAzB2VPtvCr3RLCcxKJXYiQU/BaDhXS X-Received: by 2002:a05:7301:fa0f:b0:2a4:3592:cf8b with SMTP id 5a478bee46e88-2b17d23fd01mr77426eec.2.1767730143226; Tue, 06 Jan 2026 12:09:03 -0800 (PST) Received: from c7-smtp-2023.dev.purestorage.com ([208.88.159.128]) by smtp-relay.gmail.com with ESMTPS id 5a478bee46e88-2b1706acf81sm358000eec.6.2026.01.06.12.09.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jan 2026 12:09:03 -0800 (PST) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.49.34.222]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id B94EB3401FD; Tue, 6 Jan 2026 13:09:02 -0700 (MST) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id AA8DDE422C2; Tue, 6 Jan 2026 13:09:02 -0700 (MST) From: Caleb Sander Mateos To: Jens Axboe Cc: Kanchan Joshi , Ming Lei , Caleb Sander Mateos , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] block: don't merge bios with different app_tags Date: Tue, 6 Jan 2026 13:08:37 -0700 Message-ID: <20260106200838.152055-1-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" nvme_set_app_tag() uses the app_tag value from the bio_integrity_payload of the struct request's first bio. This assumes all the request's bios have the same app_tag. However, it is possible for bios with different app_tag values to be merged into a single request. Add a check in blk_integrity_merge_{bio,rq}() to prevent the merging of bios/requests with different app_tag values if BIP_CHECK_APPTAG is set. Signed-off-by: Caleb Sander Mateos Fixes: 3d8b5a22d404 ("block: add support to pass user meta buffer") --- block/blk-integrity.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/block/blk-integrity.c b/block/blk-integrity.c index 9b27963680dc..964eebbee14d 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c @@ -138,18 +138,25 @@ int blk_rq_integrity_map_user(struct request *rq, voi= d __user *ubuf, EXPORT_SYMBOL_GPL(blk_rq_integrity_map_user); =20 bool blk_integrity_merge_rq(struct request_queue *q, struct request *req, struct request *next) { + struct bio_integrity_payload *bip, *bip_next; + if (blk_integrity_rq(req) =3D=3D 0 && blk_integrity_rq(next) =3D=3D 0) return true; =20 if (blk_integrity_rq(req) =3D=3D 0 || blk_integrity_rq(next) =3D=3D 0) return false; =20 - if (bio_integrity(req->bio)->bip_flags !=3D - bio_integrity(next->bio)->bip_flags) + bip =3D bio_integrity(req->bio); + bip_next =3D bio_integrity(next->bio); + if (bip->bip_flags !=3D bip_next->bip_flags) + return false; + + if (bip->bip_flags & BIP_CHECK_APPTAG && + bip->app_tag !=3D bip_next->app_tag) return false; =20 if (req->nr_integrity_segments + next->nr_integrity_segments > q->limits.max_integrity_segments) return false; @@ -161,19 +168,25 @@ bool blk_integrity_merge_rq(struct request_queue *q, = struct request *req, } =20 bool blk_integrity_merge_bio(struct request_queue *q, struct request *req, struct bio *bio) { + struct bio_integrity_payload *bip, *bip_bio =3D bio_integrity(bio); int nr_integrity_segs; =20 - if (blk_integrity_rq(req) =3D=3D 0 && bio_integrity(bio) =3D=3D NULL) + if (blk_integrity_rq(req) =3D=3D 0 && bip_bio =3D=3D NULL) return true; =20 - if (blk_integrity_rq(req) =3D=3D 0 || bio_integrity(bio) =3D=3D NULL) + if (blk_integrity_rq(req) =3D=3D 0 || bip_bio =3D=3D NULL) + return false; + + bip =3D bio_integrity(req->bio); + if (bip->bip_flags !=3D bip_bio->bip_flags) return false; =20 - if (bio_integrity(req->bio)->bip_flags !=3D bio_integrity(bio)->bip_flags) + if (bip->bip_flags & BIP_CHECK_APPTAG && + bip->app_tag !=3D bip_bio->app_tag) return false; =20 nr_integrity_segs =3D blk_rq_count_integrity_sg(q, bio); if (req->nr_integrity_segments + nr_integrity_segs > q->limits.max_integrity_segments) --=20 2.45.2