From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.53 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796257979; b=Tpzspuby/sBIY2DAWPQu3DWPW9j3JiQjoST+YHJ6thGIY4RCNe3IPgw3+WY6euX1u2p4 Hav+2LbzOTpgvuDzKFLjcytX32GmzggapGkArrusnTe7gzkpLWtcD7/n/mXbSi01M2cJm j+/p6evvBzTv87lN9XR0GmJLo67qnp2/pr33i81aU/5FAHWOOaDFaP06E9LJcmGPQmRp+ p+Jvpe5QVf6NYsmZ54Gi6H/Ym16zwrGy89Cgi6NFOSHxY8dekjGy22Utf+JQkMvTG9IFC A0/aGbs5l+xx3uFg00oObz4IEtYyvWX/pbCMSBQLCamm/Z75KZT2ShcS3JDQBK1KsYw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796257979; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=DPrBo+nD6nxGTDuMJfIVQrSAHlW5Nio0ukiNdEWTGJA=; b=qJfPMUYNo5O9BWqL/XIysKorztnp9/Rp/66+WFwCFiFCSNqc/W4V5wHnp591SU7XXA20 knKqgVFp8Qd7CH065kn+kAvBHyRRmu/mXoK6vAhspqsBvBZZe0Sb+RtqOgo0+L85YV98A E7yn8tR7h03p5omEH27yXQc809WJ3KBjqlfuYA6l7W2PhhSStlH8gBzIaKN9XRQQaZghW wfaAN1fDqutbW9wgX8EJqFCvnzYq/FMsnK8mu0bNHKP7GJ2zREwf9Cj7vMByoWWTXIQrL wZ+5M2TxUg5ZDB+mlYz5QoAGRLWjXZxhFxqjoP/mp6br3itmK3Ew9cki8nOeSbZe+CA== 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=BTIW3I+a; arc=none smtp.remote-ip=209.85.210.53 Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) (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 E1067606A32C for ; Thu, 3 Dec 2026 00:32:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E1067606A32C 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=BTIW3I+a Received: by mail-ot1-f53.google.com with SMTP id 46e09a7af769-86288992de5so196662a34.1 for ; Wed, 02 Dec 2026 16:32:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796257978; x=1796862778; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=DPrBo+nD6nxGTDuMJfIVQrSAHlW5Nio0ukiNdEWTGJA=; b=BTIW3I+apZEZaWmdR0N43stVEOdBOtYGkMsTfjbDXIO+g4ceyhVzTa5G1sbydAfkqN EX9vUrGiYKzmPIltA6mOkXJp6UHz3Dz7VPiYu7wjn8HzP8ZOk8Taqg7nstNNPHtN5EjS 7AtRUyblFLvoKP+8rNtXi/a2XVjNKTRzV7qIG+4nZi3fnnfDet0W87pLOLlFGpbld5Ax 2bLfZh9buJL6I2Sc2iuMvnBd7fqUKGTC9QZgasPRz468L+EYJzs0xe0lOxDFswZqzpDO 6M9j13T9tMWtRG6NHYAYJ2a3eBKyrftVIhKRdfJdLrK6v1mJ//a4jx+MQZ9LVw2PK/vA EeWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796257978; x=1796862778; h=content-transfer-encoding:mime-version:references:in-reply-to :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=DPrBo+nD6nxGTDuMJfIVQrSAHlW5Nio0ukiNdEWTGJA=; b=O1LIZtxslqRYdwtcmREm21LOE0t74C5n+vADJFrf1HaZuGzi3kCUDhD3GvASx/DDMm uK4BUPG773BovOKcc1LRp7y/jMVZ1v/fBH38QlxlCT5Y9jy2e0i45zqZok6Q4cjqY38e RzpO2X1szDQrPAf1SYi2B4agez4XP+JXiJluxG0WExamVagilcf7FdPbCYg292lV7UUp MKbr9DYGaM835/nSo1MkrVIYUMS+pEkMytcXliZUIDQl1IKhmFpLXLwNa7WCXxtf7B5q +TVQBlL1BGGsSvkkFYi6AkOfg5/t+Ej2SZhudtf2CUvaRRXV5PxRQiLsfy7Ggacrm3SU LCUQ== X-Forwarded-Encrypted: i=1; AL+hErGhG9Zp3npUCLbZmwKiF+gP3EMqJmtgbBfmrE7W3CQb/gOPWzt+i2kjXvkiGsZMxzRqO5eSoBljDGg2Iepp6Go=@vger.kernel.org X-Gm-Message-State: APuU4Z9uM4xogQH022BCyztZugHXtstFwSL6fyDFQsA6yQc6NYoXKYTo ghgAvAI/O7KBnWswPT+RVYggc8xpsHiNghzybFoWp6N+GaCnpovlVRVR X-Gm-Gg: AZFdTZce1CP3Rx0LDrEGJ/ryARC7cbNlBwLozj7M/0AymrMZ30pDYRwqbELByty5/wN LgSkeAWYSDBtJuUh1t+dg6ih3tItt44GqctD6RAT68If8g4NMlV4T1uUoYcTi2Q2+LkNlnrKT2c o2kdUxYozLzqevTDf7mA5R+yJ/55YY1QH3MyFNWE3JT+dH1yrlKpRA/r5vGGpren+bm6KSUoMLc zDgSSii16h0FoNI9/91ArcjYAinDdbHT245hG20Do8+3bVe/vBmJK2PKEC3FokMAGtLoFzH1r50 /GubnjAjulvbdPHaDJt04xY3xj9QOFbyFKUEA+iaVhlqfM+952nlcxDF8K39o+SbxPqtQV3pcwI xVYblUbQujgL4j8k+wx4/omQFCmGwEMKAL8UTmu/oWPEYO1JGS3mvKu00VdhCWI9famavZEVDb3 hTmSnCUZpYovP9prCzdCG5zbeNhqc9ecvuW4Sdgf4j0T4t3+FD0kvep4rDrM7i18EEPUsrOnIQq 4oBw2Q8cwR4t+pPHNXhkuzorr2gRaJG3ERe7YlOspeBjkG1blu86pK5sGlQ5huQQ0cLG+7DZMZa OnbDlytgunOLMCCilaYCl/gzhKn6AdU5WZhkg9x6dGqNChEeEtU9JRDdoFrYQTKwRvA0vvCMuyQ Rkc7WTRZq3IdUDlPkVNrNBRwBTan/t5TJ+H7su0B+02GSxKtXyAUnkKzJfdY1IKdhEygmRmVWRk 3Z133t X-Received: by 2002:a05:6830:2317:b0:847:b333:229f with SMTP id 46e09a7af769-863ec13de00mr357354a34.19.1796257977975; Wed, 02 Dec 2026 16:32:57 -0800 (PST) Received: from fedora-laptop.tail348456.ts.net ([172.245.82.59]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-863169105b7sm32213309a34.22.2026.12.02.16.32.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 16:32:57 -0800 (PST) From: Ming Lei To: Jens Axboe , linux-block@vger.kernel.org Cc: Ming Lei , Caleb Sander Mateos , Shuah Khan , linux-kselftest@vger.kernel.org Subject: [PATCH v4 4/5] ublk: fail a short zone append Date: Wed, 2 Dec 2026 18:32:33 -0600 Message-ID: <20261203003236.1514775-5-tom.leiming@gmail.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261203003236.1514775-1-tom.leiming@gmail.com> References: <20261203003236.1514775-1-tom.leiming@gmail.com> X-Mailing-List: linux-kselftest@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 A zone append that the server completes short is ended in full, so the caller is told that the whole bio was written while its tail never was. Requeueing the rest, as is done for a short write, doesn't work either: the rest is sent as a new zone append and written again at the moved write pointer. blk_update_request() fails a partial zone append, but only if it is given the short byte count. A zone append is ended by blk_mq_end_request(), which always passes blk_rq_bytes(), so that check never sees the short result. Fail a zone append with BLK_STS_IOERR unless its result is the request length, which rejects a result larger than the request too. Fixes: 29802d7ca33b ("ublk: enable zoned storage support") Signed-off-by: Ming Lei Reviewed-by: Caleb Sander Mateos --- drivers/block/ublk_drv.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index e38293b23b0f..bfd054685106 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -1606,10 +1606,17 @@ static inline void __ublk_complete_rq(struct request *req, struct ublk_io *io, * - the reply of report zones (DRV_IN) can be shorter than the buffer, * and a requeued rest would rerun the report * - a requeued rest of zone append would be appended again at a moved - * write pointer + * write pointer, so fail it here unless the whole request is done: + * blk_update_request() fails a partial zone append only if it is + * given the short byte count, but the request is ended in full from + * here */ - if (!ublk_req_is_rw(req)) + if (!ublk_req_is_rw(req)) { + if (req_op(req) == REQ_OP_ZONE_APPEND && + io->res != blk_rq_bytes(req)) + res = BLK_STS_IOERR; goto exit; + } /* * The result of READ and WRITE is the number of bytes done. Fail an -- 2.56.1