From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1BD027FB2E for ; Sat, 4 Apr 2026 13:28:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775309330; cv=none; b=t97mNxVqWev5OzoNrb0qMWcfl+lR8raf+YAolYUKJuv28jXbhOh4w0oYbCuyx62ys9cDE542/tCWMSbqe+KaptXJmai1OFb0jCcJ7zDtcZlLbvvTplkQRlAI8/f17zMX8VdJA6qYWsF6n+TsZOh4pRHoUCltkWGOnwjsT5lJLHw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775309330; c=relaxed/simple; bh=+Pg3y9uCZpZwx2gMNTmmSPXqOnhDGRer4BDuYSckX40=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=huBjlrJ3py2fOmAWz0hie7LzUi+dGx+YAI51WSvUMHqz3BwHVbI8g79qH2A8+6YP5+hQs1hwDrH1ZdQcPluDH6LZ14TvMscEKb8YYuWyOnsVm57BuUlIThUMNrTO4A/KNB4Jt+KJpSTnd9/XH4N1thlDTRkBsu9sU7PHXznI0q4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=SvNZev3h; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SvNZev3h" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775309327; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=rdgC9jmqU4elE5AoYVsNX/RMZxLg84P9OhHhc0kBzaE=; b=SvNZev3hE2ZL9tUf+IhouteSIz8JiVlSl7acSMfExlBTCsRyaAXI0aOb8B+4qQ7ZwYTjlR BKjpFV7QIf3P3f1ZzTUYtzoXOpVFF/iXCnTz4VVF4JJWNWGcMSDHBDp/iiuXt89D2FYz7k Yw6C35GSZ7iWv+DNcOa+dEv9uxbKc2E= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-253-rcW2SBgVM7GnIrMIQKFahA-1; Sat, 04 Apr 2026 09:28:42 -0400 X-MC-Unique: rcW2SBgVM7GnIrMIQKFahA-1 X-Mimecast-MFC-AGG-ID: rcW2SBgVM7GnIrMIQKFahA_1775309321 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 39E7E1800283; Sat, 4 Apr 2026 13:28:41 +0000 (UTC) Received: from fedora (unknown [10.72.116.33]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 536931955D84; Sat, 4 Apr 2026 13:28:33 +0000 (UTC) Date: Sat, 4 Apr 2026 21:28:26 +0800 From: Ming Lei To: Uday Shankar Cc: Caleb Sander Mateos , Jens Axboe , Shuah Khan , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH 1/2] ublk: reset per-IO canceled flag on each fetch Message-ID: References: <20260403-cancel-v1-0-86e5a6b3d3af@purestorage.com> <20260403-cancel-v1-1-86e5a6b3d3af@purestorage.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260403-cancel-v1-1-86e5a6b3d3af@purestorage.com> X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 On Fri, Apr 03, 2026 at 09:23:55PM -0600, Uday Shankar wrote: > If a ublk server starts recovering devices but dies before issuing fetch > commands for all IOs, cancellation of the fetch commands that were > successfully issued may never complete. This is because the per-IO > canceled flag can remain set even after the fetch for that IO has been > submitted - the per-IO canceled flags for all IOs in a queue are reset > together only once all IOs for that queue have been fetched. So if a > nonempty proper subset of the IOs for a queue are fetched when the ublk > server dies, the IOs in that subset will never successfully be canceled, > as their canceled flags remain set, and this prevents ublk_cancel_cmd > from actually calling io_uring_cmd_done on the commands, despite the > fact that they are outstanding. > > Fix this by resetting the per-IO cancel flags immediately when each IO > is fetched instead of waiting for all IOs for the queue (which may never > happen). > > Signed-off-by: Uday Shankar Fixes: 728cbac5fe21 ("ublk: move device reset into ublk_ch_release()") Reviewed-by: Ming Lei thanks, Ming