From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.49 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796006402; b=ExnmyDkl9nqRrAJRFcTT9iS4C4CwLK8cB4i+bW6uVD+C1JlNmGfpD9scXAAO/aZQiJBP SKUKCymHP9u/usrvNmi1u45PFcnOBpWVZy6VVjTCyf+uRHHUIPrkPmM3mZo4IbmPQ4s/W XpXx7LORPuHsXbzdktWFTYJcxBiAocRjhfiAPgRAN8UZJXbDSD9xyDBKF97u4rMXb69cW sm2L6ZsJ8RINCuzHbU2Q6VvNHVAD+KqEmmr38dZMdjhybp6dMVLOdhzvX4YGHSdYIBAW+ z1B1HhOAc1b8nO+/Y4KVBgBoaoi/+Jh3HHVjV7wYCDBoB0qi7m6gskOTl+wms+BMrWA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796006402; 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=eRSkWabK+CsZrT3vKx9U4dPBgxCxfUEzYjPONYJHGr0=; b=TSNrwOfe4azJEna0i6tD1NBESoapNIhlX9O6+d/N0x9T3dadOBqkvPNybIHB55axfP+p LaxXsG5trmGnpjvSHUk0o6oxaE6f8bf2Xv3BUgZOBE9Fan+e/IomqvEYwv9tZjHhZX9yp xIBqUefuKHjAdcQXRr+rfDwhIPJ1BtzSWokPOu+HtyRLQmWpZ3u4r0lnViar8UnSSG+D9 brI1fNNahbN51x3E3pQ/af16BpYuY2oXIQnVyHAkGLTM1KJCUHi9man9Zr6O2jSfjYjhH NanlMTIAmuK6eYGYRXbe2KJeELvJuBqZPhEOoj7+ssi8zgx5+r3me5LodX6oJCJdZIA== 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=jO7yHHLw; arc=none smtp.remote-ip=209.85.210.49 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (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 7290D606A31D for ; Mon, 30 Nov 2026 02:40:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7290D606A31D 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=jO7yHHLw Received: by mail-ot1-f49.google.com with SMTP id 46e09a7af769-86156cf8a7eso7741452a34.1 for ; Sun, 29 Nov 2026 18:40:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796006401; x=1796611201; 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=eRSkWabK+CsZrT3vKx9U4dPBgxCxfUEzYjPONYJHGr0=; b=jO7yHHLwDT1nrB1VkZ7XN3s7yHiqExNYaKsvYyEg17Al1vHOD3whl9PbgrCm5SnU39 JKCNMtA3ej2BpLVY3qeGWunZ5olLAGoPwl7xjxsDMSDzIknP/vsbki+M0a/9r0gFH3w8 GhIPv/soTYJfiWDMXGE1jGCGXun8wFdRKbFQGu89SQ/QIioWqwRI6Jgy1FdoQ30EhlmG 391w6tbFiA7wh1uXjch//HOeA52rFiGkFsG2D70svhxtYwkEmRcB7buRHBz0TAkIlkgG 0M250aJspvBwFcucpc40oVW59SZjBRWvpGG1g3+t251DOZg8Nok+l/y0rvHbP2kOt8kA ZmkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796006401; x=1796611201; 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=eRSkWabK+CsZrT3vKx9U4dPBgxCxfUEzYjPONYJHGr0=; b=bbqt54NEkYogvywMKKHTB7o3zltQK/ON8Aoh8Jz7OH8kanSRDpqt//hUcMiuXJpWeV cmxriOXM/qBom2hGGCYx6hRtQQ8awNLgusND55wlf0ryKR5Yglln6oGOm6hm8/CW+j+b ZbBVgx2TJXBtvaH7hEkKM9bqR1B5hURLurNvVTCHoqyJmK8USOWgD/0s8LnfU21nUyKG FAl8yNrFnFPnqnxvsY2GnFLg/6WMddnUK0QiEMbNUvrs1B6AB7jYSbTIIjxNmsOcPVtz fU8NiRuA3p6QPIADcLKDwpmkIgWSQgcbKQm+Yi759Jp73EfUhEqBuxtt180zizr85CMC IYgA== X-Forwarded-Encrypted: i=1; AL+hErFPrvJAqs9vfw8U8nK80wv3D9e4OxZ0PmJYMqlynNeY3RQmCLw9xQH4/nW7MJleGOKq4ZUBVDnF9JWKSg==@vger.kernel.org X-Gm-Message-State: APuU4Z+YMEZv8yU5UH/tLIyIUcPppeVc+WaPJczBXHl74VDKzhQy0Ue5 7lID0B6qcdVfm82j4J51rRk4LW/ywJxBWCEqyoffuVsa2ZZ+XnWRoLho X-Gm-Gg: AZFdTZek8/aMOu3tcp0i/bmcL1kJJYhWwpIu4eM+X5nk3wyHm2tovmdkqV0uVQFkB9L 8HPmpaxxiNChVFqOoQpuMwuTAq3dtlWCioL8dQgHsSUBUr+YnkP2Toa6qZ1mFsENOqWyImwS1EP IXzN5ob21Lbliqd+LiPoZlF1MZHdAAKKBao5PD6rLfsR9DdLvRMsCDHBMTq2xZKi6rIFBKQhOAh tE4xNwIbjxuNF0gB3aotK2bR4SlmXXlY73L7hZ7bSftOgMptXVfeVZKF7GBPcHu9m10e7fdxydC JMan05k4afBxHtUyF85rTM9b8Fy/QW8+ICOzcbglIXPCP2GmjQiKFOHX8J4WLP5GGx7X3KXiZrb k6OO9lEgMRyfskTELhqupJW3pHQ9eN4B5BpNUmM/MaItgEfXVsoaKA3u/icu6EEcUHqwNe9W3Qx 9tDqLtbrYlhycZQK0/7wpsdwXIHwCgJ0kI+l5M+TP28J+BulcQ1JK1Mn4QVXT/ARf2v/eYtyWXY a/TyDa/GHOSsfw9I+7qE+1f0lOfmI3RoA2tEYu3r/fdDlTvTctQMcW5vmFdTzdoy14Rabp1VS8L HRqU5azVoJyRIAHLw+2hxpw/f0zpoWLMAKhwM7CK7rwt6uucgjm7lYslhuInNveimRhi3o3MjMC 8OJ2rgASizSpT55Gi/TayZX4fMxEIV5IuokQwRxxHBmcNLMlNUdP7SRDkYg== X-Received: by 2002:a05:6830:2b20:b0:862:a53e:6f51 with SMTP id 46e09a7af769-86315674c60mr25536414a34.11.1796006401399; Sun, 29 Nov 2026 18:40:01 -0800 (PST) Received: from fedora-laptop.tail348456.ts.net ([172.245.82.59]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-86322db2d1asm21254554a34.4.2026.11.29.18.39.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 18:40:01 -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 4/5] ublk: fail a short zone append Date: Sun, 29 Nov 2026 20:39:29 -0600 Message-ID: <20261130023937.606428-5-tom.leiming@gmail.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261130023937.606428-1-tom.leiming@gmail.com> References: <20261130023937.606428-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, 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 69778b34ffd0..00ed6d9c8e98 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