From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.161.46 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796118735; b=IWzDkICJ2xelTaSZS1RY93w1TOCSsNRi3wEj4OtAgKWCQiAhmOoEm1x6ciqxPL/KSd4h Cuf0dOEBb9XPCVoJMM5Bip/UElRekK9b2ftTlegpNLMohjdY6yuItQJUFu+CpiiZTsXfs XCebHXApjx3m3NY+f8y66qmqzng/rMIi0lUVnvuJQhpGH2igpdWTEljSijLoLNzdpPnBY H1Q0zG3HGh0Vah3e5tPz0LNGN3zX40W3v9TbMCeocL8m/HWZDrv78PW88vOGOFMXLX3Uq Ei+LkH2wfGmr/3D+yI5lvm0la+saKHg27hb0UoJh6sd94V26I5chPNsLls1JQ/rQy0Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796118735; 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=ydT5FvOLmvdg47vGMxTkwkcjU9HcQpcLrUeMKefFDA8=; b=5LPPHAXKFbUBUQyGnVSBiqizvT/92kQzbcTJZPp9dRFIhEZM6qdqGs63ZHHmHvT9aiLR WILgTvfLJc0HmXL1rD3OGDiPByL/NAszs6pkmtYk1S2IX5T/AGG16Bu+rh4IlXbdt4qYv gOxBcayPP/IF3xn+j6pmddFcJwSGSFWSCsB3HEGhqA3BRUWHmdvasnw8gb29zPtCQ39s/ qsG42wvvd6zgJz+2wHguexA8m7UxK0wQWZzMYeNZ3qFrvDmblXHSkxrft7mTkjL2MLjj7 kwAOc8NPNpRKT2eVdRDRf9RV9ODa8ooWSfVwQlWlzSY2hq9z9p2maR/q0VWdIUZekOg== 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=Iiqpi5Jt; arc=none smtp.remote-ip=209.85.161.46 Received: from mail-oo1-f46.google.com (mail-oo1-f46.google.com [209.85.161.46]) (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 B41CC606A333 for ; Tue, 1 Dec 2026 09:52:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B41CC606A333 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=Iiqpi5Jt Received: by mail-oo1-f46.google.com with SMTP id 006d021491bc7-702dedeb70dso6675636eaf.1 for ; Tue, 01 Dec 2026 01:52:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796118734; x=1796723534; 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=ydT5FvOLmvdg47vGMxTkwkcjU9HcQpcLrUeMKefFDA8=; b=Iiqpi5JtXjTvvl2W9kAzTRt1K6sIdyut4qtRViaOiegWqQgNjItWsomyTpKLVOR1F6 hQgzAMQXU/0vkbEWJ1R9AcGFrzl3dss1h4Q7g5YonwZ6rF1NS44hWNAyx4TgrkmcA49q eSu/rSyQMcP5lpfKTe1o8EKkMVFF3EDqy6+pB8ux1tinwxrecuwDE9/i8gR3G2JwdcRI QCdQRJtCowxctNmxJ39H4UU8qr5sY5jWT1Xrp2M8zopOKWCFB/80r7pmSbeEiNafFyTF mQ2j/ZldADTCUkYQqQCMdUdHOnjDAHO4iR3RQy3icWkVGBmnQWx/Ldryd8Pm5AjtSMpw qxLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796118734; x=1796723534; 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=ydT5FvOLmvdg47vGMxTkwkcjU9HcQpcLrUeMKefFDA8=; b=C/c6s/srE4HOXy/NvR5VNzcJ/olu6VY0kynJOpUM7yFdXl57Rn7t/XR4ZzQhBXxo0T XVf7Fb1dsLWhWqHpB4Q3HqKBQQQcNrKI7CmEbFNeCJU8UwagJNOa9hOGlLKzATKOCTz1 grAKQvt22sylAHnw+t8Y6zHVjEafxmNYTTOaqxcnTh7TIcZNQF6ZXwBt0DZCfSN7QMrw f7QxtObreOB/M/2fQd6/u9TddDwSoItvutc7YqRKvIIGt6dmV47b0RBa3YV5lmGmPE1n brx40hmDDaUuN/Z9NSzeNuJuBHP3mDmhi/e6uMVNe+2uKEAI//YwEi8CTjetZPL9v5pD Fuig== X-Forwarded-Encrypted: i=1; AL+hErHdawBzbYNnSQy39UI0ba8pfiZVoEp8Gy+n5spgIcHN8Gj3UT0IzfJjnpM4VwxiawzNYycpckXAirZaYSZofyM=@vger.kernel.org X-Gm-Message-State: APuU4Z+pnQOwTRTWNX7lHZhYRxTat431BfjobjakSMu2fuS/EZjQQEGT u+0QWRX3WPeBNpADzJCQKUg0OlQsudRn0lTL/82KgOjJ6En7e7SBw6K+ X-Gm-Gg: AZFdTZd8LhF4Zc26U4OFh0blhikL/pQ0JZUc2Qheb0GMJDkvRfyML8nEq0i+5B3aGjZ 5uOrO7oedgh2E6Pv5OVjgu7TpCYljVLIzb+5y78VUDnpX3Z/GQ9E5JAZpiP4h1sbwEHQ8X7Fw5q 4wTfK3OyHm9rlMP54JarwcLTcoPDBofWYWHqAhIV30p99CyAdmBaBhOSVgMk40jRvkdt/2Z3rTj o0VtaIxyU/BbCri3VRlWsd4c/BNV2MT81gtAA34bwoC/XTmDr0tAYwUYT46154/TyMk9CQPNH4Z dyFqCYCzZU4JjFhRA1neUCHAdI0cj9yC23wPgdYJkL4brNzjKgJil3dUeU3Z0fgHxEkLGNFS8y1 FuwCUEfX42nqoxQlqH87QyQyoxZHNQXZZLEpvg2v8n+5jsE60/Y3g4wHPSAmGZojKtKTbTeWWN6 3nrkWMIhYYuFjvd6DO2GzZ5U/B2mnWqajLZZ1euOzTQoSkLSIQTFjYuh8asR7ycXow44tVt7od3 9fdLwxJicEeeiV9tID3HH78VE8xobUVHze54rNQ86ZA56VjT+6vt+1hEmE1bn3R5R2oMTS8l0Em 6yf8yT0ssbXY+KbA94XwGgNYcf5nsKECbuho1AfQXjczKEXkOVaIYs1BBx7jajqqYgxkZQP0+7C oF9xHkdVgPC28MR1fa+2nbfn9aFP0TdM70nIFBNxNPWt7CY+tzksIhjUU8A== X-Received: by 2002:a05:6820:a28d:10b0:71b:911c:9d6c with SMTP id 006d021491bc7-71b911cb06bmr9698530eaf.26.1796118733747; Tue, 01 Dec 2026 01:52:13 -0800 (PST) Received: from fedora-laptop.tail348456.ts.net ([172.245.82.59]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-71b380b6f82sm22698287eaf.10.2026.12.01.01.52.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 01:52:13 -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 v2 4/5] ublk: fail a short zone append Date: Tue, 1 Dec 2026 03:51:50 -0600 Message-ID: <20261201095153.1012606-5-tom.leiming@gmail.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261201095153.1012606-1-tom.leiming@gmail.com> References: <20261201095153.1012606-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, and blk_update_request() then fails the bio anyway. Fail a short zone append with BLK_STS_IOERR. Fixes: 29802d7ca33b ("ublk: enable zoned storage support") Signed-off-by: Ming Lei --- drivers/block/ublk_drv.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 5cffd8c4e0a3..3afca4f1114f 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -1597,11 +1597,18 @@ static inline void __ublk_complete_rq(struct request *req, struct ublk_io *io, * FLUSH, DISCARD, WRITE_ZEROES and zone management requests usually * don't return a byte count, so end them directly. So is report zones * (DRV_IN): its reply can be shorter than the buffer, and a requeued - * rest would rerun the report. So is zone append: a requeued rest would - * be appended again at a moved write pointer. + * rest would rerun the report. + * + * A zone append can't be completed in part: a requeued rest would be + * appended again at a moved write pointer. Fail a short one, as + * blk_update_request() does for a partial zone append. */ - if (req_op(req) != REQ_OP_READ && req_op(req) != REQ_OP_WRITE) + if (req_op(req) != REQ_OP_READ && req_op(req) != REQ_OP_WRITE) { + if (req_op(req) == REQ_OP_ZONE_APPEND && + (unsigned int)io->res < blk_rq_bytes(req)) + res = BLK_STS_IOERR; goto exit; + } /* * Nothing to copy for WRITE, user copy, zero copy, auto buffer -- 2.56.1