Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp225071lqp; Tue, 11 Jun 2024 22:19:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVb6Nu3aRsnTuep9ijAE6YTcKexjFKatHX250evS/fsflCT3PNB6Yjbym5H/MRMDYTqi1g2NWdt3N7xJGBM/tq+/noDlW9Yh7wk3RKdAw== X-Google-Smtp-Source: AGHT+IGiWI4qbfbs2MqYVvp/CD/616YKHVlSNXBU2FnSfSKXdWJ6XkHaM6Sj9fitao9bwVrGqQjI X-Received: by 2002:a50:a693:0:b0:579:73b7:b4cc with SMTP id 4fb4d7f45d1cf-57ca978fc18mr554116a12.2.1718169597175; Tue, 11 Jun 2024 22:19:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718169597; cv=pass; d=google.com; s=arc-20160816; b=S2/o5wnf4/GzyBJsMPluspCHxbWDxpv7CuYqaDAAlN3v8IKdz9YMNlRBoBPcfv8rC6 lQOUbFJedIHziHRZmKBjIrSvIX1r1Pu3piW8tAx0ygk70TBd9xonaZptWLcJKM/PS1/H u7VjhVyAXxblraHIGy8xtxD0H29l34W50+RELLcWmCY7lUr0lyKAm3R7nBmpOsHH72fU OncMfcyySTkKFLkGxwfxuqMb7XQHV+mFk+mP8bNduSmWhVufLDtuTAexTenKD10FtzUC Q8BNRbC2NwMcA6KZrRJfTWXONHnmJDGuucZ7ZpdapAxr3Ui7xJqFK+uGvdRxYPc+as5E cwCQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=rjWqG5Xd0t0OhjIOD7U3J8u5McdvpmMHGBY3/A95F7A=; fh=KMPbCmxlrUIIUPJkFMBstxHesF3oI717SJokiCR5tp4=; b=l00TsD2XK8cKfjclP/6RhvL1Y+bedT1USoXZfdDJcPgihx9SjFQAkM9VhrmtmMiM/D dgKQjKbPsPE9LbNG21yTbDa6GwskTVuE2Ba+H2H4VrZbp2bhLjntQgukbKGpzi+c7kb3 XJ7WGcAWrMcNRk5dLt/TUx9A3CIGKBIJqYhLQ4QRnsH9bmQNNdCgwn3d2E1qyioba/PQ qXfeACkHyACouiaQy2hU4oI+tliQW3eKL1eqXKSmzQRNwWnBxnTsYSw8ZheyYcpCUBvi QvqjXelCHu7igfNdEFW+OLjYDDiV/MbdEcz1S4Y1SK3W5uieXcmxtJ/+YiGVmtRI9a51 ooIg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=lst.de); spf=pass (google.com: domain of linux-kernel+bounces-210939-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210939-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f29bda142si207126166b.481.2024.06.11.22.19.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 22:19:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210939-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=lst.de); spf=pass (google.com: domain of linux-kernel+bounces-210939-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210939-linux.lists.archive=gmail.com@vger.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 E0FDD1F22872 for ; Wed, 12 Jun 2024 05:19:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 31908374CB; Wed, 12 Jun 2024 05:19:47 +0000 (UTC) Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (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 B66E733FE; Wed, 12 Jun 2024 05:19:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718169586; cv=none; b=Dsb9Tu9rP1Pw7QHNqzezj+NdX9tyWX6YAAkAJP1Z1rzRkPqVaoNSX0YZ+lMffL8ksHYHf68KRe4pu9ffafznT6N1dW/cJJ5EH7B3AyOrz7ZOowVGdjIVHy8EdCrdVaEwNcztr+t6lSB7lyrL2F/KJiJDsqQUnggGnlnLbj+pFgM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718169586; c=relaxed/simple; bh=rjWqG5Xd0t0OhjIOD7U3J8u5McdvpmMHGBY3/A95F7A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tbuhgp12Jh5RkUl4xHaAa/pIsqjAsKPJbMDf+qqFVtrXjBconQjMUczr4WOIWm6ukHan2V6Iqk9xik4lwndW2Q0/1xa0JTrEqCTt6Rw0W+ILiRGrYgdI5DU8Rbagn4KggrKHbAKA5uytrlhGC+EDPHYKsY2JhqgiqP7mOpvdTuM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id E09B668BEB; Wed, 12 Jun 2024 07:19:40 +0200 (CEST) Date: Wed, 12 Jun 2024 07:19:40 +0200 From: Christoph Hellwig To: Gulam Mohamed Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai1@huaweicloud.com, hch@lst.de, axboe@kernel.dk Subject: Re: [PATCH V4 for-6.10/block] loop: Fix a race between loop detach and loop open Message-ID: <20240612051940.GA27294@lst.de> References: <20240607190607.17705-1-gulam.mohamed@oracle.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: <20240607190607.17705-1-gulam.mohamed@oracle.com> User-Agent: Mutt/1.5.17 (2007-11-01) On Fri, Jun 07, 2024 at 07:06:07PM +0000, Gulam Mohamed wrote: > Setting the lo_state to Lo_rundown in loop_clr_fd() may not help in > stopping the incoming open(), when the loop is being detached, as the > open() could invoke the lo_open() before the lo_state is set to Lo_rundown > and increment the disk_openers refcnt later. > As the actual cleanup is deferred to last close, in release, there is no > chance for the open() to kick in to take the reference. Because both open() > and release() are protected by open_mutex and hence they cannot run in > parallel. > So, lo_open() and setting lo_state to Lo_rundown is not needed. Removing > the loop state Lo_rundown as its not used anymore. Looks like LTP still expects Lo_rundown to be set.