From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 48D07EE49A0 for ; Fri, 25 Aug 2023 02:45:40 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1qZMpN-0005E4-Gd; Fri, 25 Aug 2023 02:45:37 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qZMpK-0005Dy-VH for linux-f2fs-devel@lists.sourceforge.net; Fri, 25 Aug 2023 02:45:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Sender:In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=BAs3vHnqB82jyF9T0JKZy08jGuQDnnwXLjj44ySrvFg=; b=QbwWJMgt2B2WOAZTBkthdK1G5r wwcIsqoGAkI+TPQqhqy5UVhFaKUvF+mgQ0XUGR99ejDn3nnP3LIO8NdCZIhOqhMxKZB7GUHkTgIMZ L8HuYsAKHmfB0wh8ZR3Ww0VQ04UyYqyYeJYyCOAh8DglZvAteXvgeLk4W+ScDctAG3E4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=BAs3vHnqB82jyF9T0JKZy08jGuQDnnwXLjj44ySrvFg=; b=LI1q3nnFSGttjg/LCm6cxCTH4h 9kiJQrC8DCSbLpPy5Zhq8B1QbfgdsP0RZZwLpW9pwo1DYc0BTtskMPzXxs4bRZiFIdwNJzy7doGa0 oPG6eAQ9f0/ZkaMzbzUBnUDy51GM/HhzFMHEB80ezNM9Q+G9FC8khqkUg+I6kOn6Duc8=; Received: from zeniv.linux.org.uk ([62.89.141.173]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1qZMpF-00085B-Kh for linux-f2fs-devel@lists.sourceforge.net; Fri, 25 Aug 2023 02:45:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=BAs3vHnqB82jyF9T0JKZy08jGuQDnnwXLjj44ySrvFg=; b=qG/yF0qNQFz1HErcIOwDpMsE95 yvpWaJiccPJne5E6IKKdLk49il4mSFXaxO10+cPRq4RqC2mgW99o+1yf2c4bs81MOg47gz2QA9ZFT aLJydE8tWV8lzCMv2+NeX7mQCMknUB5EhVQiqQN5lBaCEsUTiWdC5wvrGaIvwhXVRrB8AFK90tiyv FLjfEbnlTWQpGxkRRGa9YbyGmW5wSGD0SSIG8KNS+lDxJs8er6W0jn8lCxtIFwizoom7apeGKhs9v c0WlIDcCZSTbrPU9y3Jy4WWr/hC4ZjXs2RvO1eOF4P2UntF/l1INZ+xsvc1Hck8kt4ukocelH0IdQ bSBNV7lw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1qZMoj-000edp-26; Fri, 25 Aug 2023 02:44:57 +0000 Date: Fri, 25 Aug 2023 03:44:57 +0100 From: Al Viro To: Christoph Hellwig Message-ID: <20230825024457.GD95084@ZenIV> References: <20230608110258.189493-1-hch@lst.de> <20230608110258.189493-2-hch@lst.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230608110258.189493-2-hch@lst.de> X-Headers-End: 1qZMpF-00085B-Kh Subject: Re: [f2fs-dev] [PATCH 01/30] block: also call ->open for incremental partition opens X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vignesh Raghavendra , "Rafael J. Wysocki" , linux-nvme@lists.infradead.org, Phillip Potter , Chris Mason , dm-devel@redhat.com, "Md. Haris Iqbal" , Pavel Machek , Miquel Raynal , Jack Wang , linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, Richard Weinberger , linux-pm@vger.kernel.org, linux-um@lists.infradead.org, Josef Bacik , Coly Li , linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, Hannes Reinecke , David Sterba , Jens Axboe , Christian Brauner , "Martin K. Petersen" , linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-btrfs@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On Thu, Jun 08, 2023 at 01:02:29PM +0200, Christoph Hellwig wrote: > --- a/block/bdev.c > +++ b/block/bdev.c > @@ -683,9 +683,6 @@ static int blkdev_get_part(struct block_device *part, fmode_t mode) > struct gendisk *disk = part->bd_disk; > int ret; > > - if (atomic_read(&part->bd_openers)) > - goto done; > - > ret = blkdev_get_whole(bdev_whole(part), mode); > if (ret) > return ret; > @@ -694,9 +691,10 @@ static int blkdev_get_part(struct block_device *part, fmode_t mode) > if (!bdev_nr_sectors(part)) > goto out_blkdev_put; > > - disk->open_partitions++; > - set_init_blocksize(part); > -done: > + if (!atomic_read(&part->bd_openers)) { > + disk->open_partitions++; > + set_init_blocksize(part); > + } [with apologies for very late (and tangential) reply] That got me curious about the ->bd_openers - do we need it atomic? Most of the users (and all places that do modifications) are under ->open_mutex; the only exceptions are * early sync logics in blkdev_put(); it's explicitly racy - see the comment there. * callers of disk_openers() in loop and nbd (the ones in zram are under ->open_mutex). There's driver-private exclusion around those, but in any case - READ_ONCE() is no worse than atomic_read() in those cases. Is there something subtle I'm missing here? _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel