Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9100595pxu; Mon, 28 Dec 2020 06:39:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJyxTtyid8iyFqVIIWd8eGAUhCU86ofCdt931FDhOMC3jELpvTiplQncXKlECO58lbAKXf1m X-Received: by 2002:a50:8741:: with SMTP id 1mr43023409edv.349.1609166361791; Mon, 28 Dec 2020 06:39:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609166361; cv=none; d=google.com; s=arc-20160816; b=l+QCARK9UMNvyC6HKR2OPhBNIpdKZi9j7qOur8Z9l70JaL9Un11xIwN2sS4sf8mry9 IZVN0CHikhGYgCU5B4jbSNgJLdAu2umyMpVnoGshU6+ZDQZCSzBowK6Id8Y+E6Lm7amD jKOSXKdz/3l/H6snMQGxIQ52Nschku2JeAxnDh1iBQZ+EWI/cbvxfX0MpP0csKEWI+Q3 UjcdgZ7trN4+rpgbWY+PQarRAgLSlqjUQq6vpEowOLJ/xAR6TqUMkOzab7JlBbi/k76t zknydrJwrRb/BEBcnNanvE89ZY7If5YZmE0r8u/7HIihH+cIAUi6Dae8w1YiOtXZlqsr LDyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FK9j1XVavjRTmY35rwmsHQKc/6dhfvzKSMi7lCiX4GY=; b=yVTI3IUHi9t6TvwXVckf7RUQE7kzD2sIJoNE6h9xpBfhHDExFJ0cB3Azc8o6swDO3b wqgQkQ3q7GGuq1AdRmyJxOb2r+eWIISJ/pwzat3P9kws4pzipg/TlmlvZua7jm/hCoJl duugSA9I2PkL6m34OLksUOVddamcNSan1Vdv8zwbNittmAQgznW8SKG7DEvD2scmpOXS qa3bmkvaua3pqTlwMg2EXmI9M70awKZhnWv3ei/1vZ9IROTEsweq06BsjKtZgkRjYMlc sAyn4TVFcLLqa1ZohmDtS2b/BlWAQ/JGACiXzzPVV1JAVjhih2J2wMgDSfHmlRXQs8tg dJww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZgGXl31A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q7si18470582edt.86.2020.12.28.06.38.58; Mon, 28 Dec 2020 06:39:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZgGXl31A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392149AbgL1Ofo (ORCPT + 99 others); Mon, 28 Dec 2020 09:35:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:40716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2504973AbgL1OdT (ORCPT ); Mon, 28 Dec 2020 09:33:19 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 35990225AB; Mon, 28 Dec 2020 14:33:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165983; bh=6JxeLSvVfNl3d8vdNUwnJStAh6gVTC73te8NftzIOWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZgGXl31AcOBdFbeYVCmw/Mzrll5FOTNg7mLWsraoIr6Xyq0Pz8PVCr5cxSfOhX4Qz Xynrh0AFqYlcbVa5ZgRHO/kSzUJyQvgwz/PupeDvmBkRjC0zViVeHeDf93v3w50ehH tBy1vjctBQZ+wf8c0CK0URce9p8D323w15mWLfzU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naohiro Aota , Damien Le Moal , Christoph Hellwig , Johannes Thumshirn , Jens Axboe Subject: [PATCH 5.10 717/717] null_blk: Fail zone append to conventional zones Date: Mon, 28 Dec 2020 13:51:55 +0100 Message-Id: <20201228125055.351891985@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Damien Le Moal commit 2e896d89510f23927ec393bee1e0570db3d5a6c6 upstream. Conventional zones do not have a write pointer and so cannot accept zone append writes. Make sure to fail any zone append write command issued to a conventional zone. Reported-by: Naohiro Aota Fixes: e0489ed5daeb ("null_blk: Support REQ_OP_ZONE_APPEND") Cc: stable@vger.kernel.org Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/block/null_blk_zoned.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/block/null_blk_zoned.c +++ b/drivers/block/null_blk_zoned.c @@ -339,8 +339,11 @@ static blk_status_t null_zone_write(stru trace_nullb_zone_op(cmd, zno, zone->cond); - if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL) + if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL) { + if (append) + return BLK_STS_IOERR; return null_process_cmd(cmd, REQ_OP_WRITE, sector, nr_sectors); + } null_lock_zone(dev, zno);