Received: by 2002:ab2:715a:0:b0:1fd:c064:50c with SMTP id l26csp48520lqm; Mon, 10 Jun 2024 12:15:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXpsj8dFG8YDdO2FK9BqR9uiWbY29I/S10UtFbGAfOxE9YICu5Pbhp/U1WG4RZTlHomBKv489oyppIjkcnISnHOkzxS7uWyIR7OY8HQtw== X-Google-Smtp-Source: AGHT+IHc6zgqpCrtldoHqU/QaHZcq6dlqgbG0dtPT8KnjZSYLmm7HhBke6TmsWVO1lD0++99HrKC X-Received: by 2002:a50:c056:0:b0:57c:68fd:2bca with SMTP id 4fb4d7f45d1cf-57c68fd2c81mr5422672a12.24.1718046920268; Mon, 10 Jun 2024 12:15:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718046920; cv=pass; d=google.com; s=arc-20160816; b=JZLx0sdDURhB22kwyvF21oJC1kh9W1diUDvLHP0YdbM+C8RrcPqjCWkLXmXXMdvEyT Z0KPCfmXHgeFSTgzQHkwY2LMjvijuU0xHSLZD7Fc+FHiNle7rMP901yrq6IGbERL3YT2 AhIrZ2AYfv5IswcfeRHDGJ09S/SgC8ZR44y2SysnzscQyr0B3SWQngMuOPmcmVVOVseI b92tZb3X+h9z1BdQSxsIrlOdr14ppXqM/HzNGcPfdoqEqxYathp5mxuXGxEPE9v842ZG VsAz8lHkvRBJUOD7yDJUXvRMGPgbFsRypFD0MhGxtGsm3KFOf1xWnQi9S+SgLwO88ul2 asvA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=AAKM2OZB8R/fR9k+N8VOAC2KLaopOWKY3hyEGI99zXg=; fh=Qk9SgIMWl70BZcFuULjbN89U7ljdVRFuOwKCaVGjZjY=; b=QYEC54IDoAa4BjBAmPLDN1ToCiPOflpbjYhUs3IsD8rQeKAg/ovPWnQR+x6PcLVHHr H1sV6V04gMd+cEnZJUdWWWMkiLO/6N3QjW/OkwwE4BH2plRX4M5WfQdAitl/xkzLL3jw P1F/E4MqvOUFsXpb25amBx8/HqtG+jicVdzIQsogy/jWH57w6ANz31Fn1rgNoJkO1N83 mTLocZeClvBE5ODIxaxUUlVZaj4xw7tcql+rX5jwbfIpBNd+5mj9E/xx2V1G/ghOMqsW 72tQueiAGz85OBBYIw3Wp5KFZKlKIrKKsS6TTvwf0FTlt0Uo7bzGtSZ7Sn0ALzrUaohk NNtQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aC2wDHIu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-208777-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208777-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57aae2308e7si4861693a12.463.2024.06.10.12.15.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 12:15:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208777-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aC2wDHIu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-208777-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208777-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 0173D1F22DB8 for ; Mon, 10 Jun 2024 19:15:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A2D8B14C581; Mon, 10 Jun 2024 19:15:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aC2wDHIu" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C7744182B5; Mon, 10 Jun 2024 19:15:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718046910; cv=none; b=mXmgKWPU94QXnlF6aWl+pvwtF73lqyBTyEaegD2iPJMCWFBdzYGCibRHcc2MQZZFx1JX0+4ddWFyCY5HH51zLgKKNZUw+U+OakBkSG9CksyAAzSUF62r5UdRtQaM1S6CeQzZlb8JpNRBiaG2JmU7dsawlaG2w2/igfRKi1jlw7c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718046910; c=relaxed/simple; bh=L7ZozjW/CAUgCkBG7Y7oL8z6so9aqPVMLj+1HaGaLFY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=paOfI0sQBfaWOpVZvzeaCQYBkAPXdjraIqrpjQYmlxCjIW2gfpOBcSrWbPacX8bIVgR/z+VI9B6ix1cOKZtLPhFPhZxxOhSV/yvR8ZWiaO+UBEp1ohtyC2YgXPPYnmZT79PVPdHw/PxqO0u1eyWSmnO96/xVlTimScRqUkmtCSs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aC2wDHIu; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDEA8C2BBFC; Mon, 10 Jun 2024 19:15:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718046910; bh=L7ZozjW/CAUgCkBG7Y7oL8z6so9aqPVMLj+1HaGaLFY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aC2wDHIus0HXZO/CjsYD8+ikV+1Z/HZo7oKJy1yjj5PKXzrYk3ti49hNPhRELCyVi 4R/BH/sCRX/vfBS/qInp505tZQQhp9P8Dar0hZFrs9pJrmf7Cg/Bzi56EPiqJATsoo qxw1cWZPSUNkQrrZQArXmZLyQLoFWsqGCKaouLP5sQLQBp/OsCUBu/dUD1SfGlCnuM n9vXMRQ8h+NJ34+BZo9427kh5b9WYNTEZ+G5sT7DWlL8w5kQtgpQsYl9vnHVQ+FR0m QlUT8nWVjRwSTT5LA2Bx6SAPqo1s+yDuTz8Y5bld4P3ndS3Y6xh64kblf0362SqK3x dMMLKT0rMXBOQ== Date: Mon, 10 Jun 2024 13:15:07 -0600 From: Keith Busch To: Sagi Grimberg Cc: Venkat Rao Bagalkote , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, sachinp@linux.vnet.com Subject: Re: Kernel OOPS while creating a NVMe Namespace Message-ID: References: <2312e6c3-a069-4388-a863-df7e261b9d70@linux.vnet.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@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: On Mon, Jun 10, 2024 at 10:05:00PM +0300, Sagi Grimberg wrote: > > > On 10/06/2024 21:53, Keith Busch wrote: > > On Mon, Jun 10, 2024 at 01:21:00PM +0530, Venkat Rao Bagalkote wrote: > > > Issue is introduced by the patch: be647e2c76b27f409cdd520f66c95be888b553a3. > > My mistake. The namespace remove list appears to be getting corrupted > > because I'm using the wrong APIs to replace a "list_move_tail". This is > > fixing the issue on my end: > > > > --- > > diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c > > index 7c9f91314d366..c667290de5133 100644 > > --- a/drivers/nvme/host/core.c > > +++ b/drivers/nvme/host/core.c > > @@ -3959,9 +3959,10 @@ static void nvme_remove_invalid_namespaces(struct nvme_ctrl *ctrl, > > mutex_lock(&ctrl->namespaces_lock); > > list_for_each_entry_safe(ns, next, &ctrl->namespaces, list) { > > - if (ns->head->ns_id > nsid) > > - list_splice_init_rcu(&ns->list, &rm_list, > > - synchronize_rcu); > > + if (ns->head->ns_id > nsid) { > > + list_del_rcu(&ns->list); > > + list_add_tail_rcu(&ns->list, &rm_list); > > + } > > } > > mutex_unlock(&ctrl->namespaces_lock); > > synchronize_srcu(&ctrl->srcu); > > -- > > Can we add a reproducer for this in blktests? I'm assuming that we can > easily trigger this > with adding/removing nvmet namespaces? I'm testing this with Namespace Manamgent commands, which nvmet doesn't support. You can recreate the issue by detaching the last namespace.