From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.45 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796257979; b=1pAG/ZbEUWVKK6QPX9B6PXCXuVIe6NiK+MvGt82srDxrUgg0Ruy7ibF98lKO9XToego6 qKRLYs5q6x5eky3SQNHBbYARtmku76f+CzTNwgJqN8VaLG2Obx2+COgVcSOqsNn/zCqzs QN2giMfQU1BuEtvsKCHZUXkZ2vgryD/NmqBwPBRZcilC5Fl4phhZmPz/k5yqFgXDpFhpE LZixIv88uPFSXI9njK6020oyliIVj2ysfZwD3rmDXCgb6Cr8kXrnmLE8C8aVJHX5KHh02 ZfkryXGe81vkicUfjwQguY1rdfKCFcPhsaVWD/sAJNnvkmkk7sGh/fBlr1Nsm2w9WzQ== 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=Gh46lwRIQMT31Qkkn2qMQHWzXwRw+iNmensHicIbm0RsNnW/luSQUOjPzXavm0SZ+Knr I+3OmhowWJuwBQi7YCKqBqO0Gp9RK+4lVxG/Q83s5nVs9u9KW8zO9sQ1lhOi84EltQI0P uMsq5To3b/zVDOa069UtB8t3YjAE58VMXOvFKhCg/7Nlp4iNwqjg8PzTQF1kcgAiySako DYhNY1N51a5OmUGNjl3pUlMgwEfhkFpcAsLDItpK3g4CHXkZmxUXV4s8Fqajmk4qpEAS5 XDJcMXmArIt3RWjCtNjS6gXbEKHhHuBaZ9lf/pYjIjVXssnHW5DN+1kadmHIog6Utcw== 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.45 Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) (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 E6900606A32D for ; Thu, 3 Dec 2026 00:32:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E6900606A32D 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-f45.google.com with SMTP id 46e09a7af769-862df509d48so313281a34.0 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=h7s/8V/aTPVdeNL9RHB13Or6BSWcRvxzO+/Q8oFacth+yu22izpUDCSf4RsPYKSl7y xKVkEkSBFET1r6efqbGYjfKgSkNzqLFUirYSt+F1r/cB1OlKAT2GG1LMwjlZrTz4Jvd8 5IeUpTno1hK+CGjLBm4opNdNs8I4ZvgZF+6r82zrS7gz+tqEA5XqZT/8pwoRm2aA7umo kUcS8ni9fq5ARWtepKpa2er+g7Vf0ghD1x9Pam2J65vpqA7bwYjyzXfoVZS267qJFk8E bHz8sy2BzrY3xepj4A9fkCJxxNBNLg4lxUIO0Hr3T9vdeVdttQFfLFwjhHGA37jRi6kv UL9w== X-Forwarded-Encrypted: i=1; AL+hErHfAGxFhkMMha0WlEzOeFh2U0NyYX9RRa0JbLuSclHTM1QRplEFrEOtD+YtXOdW8J9qml30nfKKzEQViw==@vger.kernel.org X-Gm-Message-State: APuU4Z/kk/xFv5+1fExz7AWoIFkwpy2HBLWG0V0ExEqlIoAX5/iP/fcr PMihP2bPdbtOch5QwQuSIflvPIr7rYJ38VOsYoHRZ/Ql6U0ig9h3pjzubHpdmMxdOEw= X-Gm-Gg: AZFdTZfLR++d3L90oJ1foPuAI4k89ym6qJP7oTeqO7sgfjAWY1/7LD87PjzwV00r5EE SI7/9D4PZk9/S8xOBj/NkjqRHp2JpASH4uy65kKO3fS8RB+eMPV9KAF2e3TpyCisFEfOqZmLD1s sCDVGsGZZoDMlwAC8AMcHlDITWYg7q0b3ypXCMi5O22H7mOzoaILQAJSCQyK0BsJYGAxsjADuA0 7fQb80P+1CWPeWAIVDlBlS73CJjFLj3J8M9TMeYKaWvH/FERCsW/y/p6yVoWB8JoMgm01n/iEI/ GZX/B+RzggX4idZw/Tu5FiIA5fSESHVnlIU3ZEQaJCn2lnBd9mk4NymhQVb2vw5i/7BADAEJbYP Z0nbHW0CmyB1OkRAU4lLDNGQIIrRPapNI0zLetS3jwCHATrLcYbJP2lq+kppl2kRViaqS1Y851x eZI5xVb0YLIscVH4+GesTPX+TXI8NQNPtTLP/1+mFjTW/7gYZL4NN0PbYpNBVoVa21p4OiCHdmZ bwMtEVk8o1UWPAgM/ctqxC++ns/jatbhkvw9LSVjMrhB3fCEQdsoJbmSqMAeg+khWzLKVcf3iIU EKqp00iU0JkLbqvm9GLjVXo734qB7NA6jAfVw8Fy7vSwIRy/vQds5awWSINHaBJdlgy6fvxPFk2 Ll5v6SaQChwl/tBlq71FrDfvc+cEGVHk1Se8JgsmDb9APCR+qlPXyQwXUJynHtcibMFPtIBhyVU nYbY17 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-block@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