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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 827F2C6379D for ; Sat, 21 Nov 2020 16:24:39 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 072BD2145D for ; Sat, 21 Nov 2020 16:24:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 072BD2145D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=dm-devel-bounces@redhat.com Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-186-cLK_9oonM1ucqfKQdYARYg-1; Sat, 21 Nov 2020 11:24:35 -0500 X-MC-Unique: cLK_9oonM1ucqfKQdYARYg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 87D4180EF83; Sat, 21 Nov 2020 16:24:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F1C5D10013BD; Sat, 21 Nov 2020 16:24:29 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6A44B4A7C6; Sat, 21 Nov 2020 16:24:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ALGOMEj022236 for ; Sat, 21 Nov 2020 11:24:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1D4911111C6A; Sat, 21 Nov 2020 16:24:22 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1996B11301DB for ; Sat, 21 Nov 2020 16:24:20 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 03D35811E78 for ; Sat, 21 Nov 2020 16:24:20 +0000 (UTC) Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-445-Qr8gjuvfOeCr7_AGyUPW9A-1; Sat, 21 Nov 2020 11:24:15 -0500 X-MC-Unique: Qr8gjuvfOeCr7_AGyUPW9A-1 Received: by verein.lst.de (Postfix, from userid 2407) id 951F467373; Sat, 21 Nov 2020 17:24:11 +0100 (CET) Date: Sat, 21 Nov 2020 17:24:11 +0100 From: Christoph Hellwig To: Jan Kara Message-ID: <20201121162411.GA18475@lst.de> References: <20201118084800.2339180-1-hch@lst.de> <20201118084800.2339180-15-hch@lst.de> <20201119120525.GW1981@quack2.suse.cz> <20201120090820.GD21715@lst.de> <20201120112121.GB15537@quack2.suse.cz> <20201120153253.GA18990@lst.de> <20201120155956.GB4327@casper.infradead.org> <20201120200548.GA27360@quack2.suse.cz> MIME-Version: 1.0 In-Reply-To: <20201120200548.GA27360@quack2.suse.cz> User-Agent: Mutt/1.5.17 (2007-11-01) X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: dm-devel@redhat.com Cc: Jens Axboe , Mike Snitzer , Konrad Rzeszutek Wilk , Richard Weinberger , Josef Bacik , Matthew Wilcox , Coly Li , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, dm-devel@redhat.com, linux-mtd@lists.infradead.org, linux-mm@kvack.org, Jan Kara , Tejun Heo , xen-devel@lists.xenproject.org, linux-bcache@vger.kernel.org, Christoph Hellwig Subject: Re: [dm-devel] [PATCH 14/20] block: remove the nr_sects field in struct hd_struct X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Fri, Nov 20, 2020 at 09:05:48PM +0100, Jan Kara wrote: > The code is already switched to it AFAICT (the lock is really only used in > the two places that write i_size). But the problem is that in theory two > i_size_write() calls can race in a way that the resulting stored i_size is a > mix of two stored sizes. Now I have hard time imagining how this could > happen for a block device and if two reconfigurations of a block device > could race like that we'd have a large problems anyway... Now that you mention it, yes - i_size_write needs to be under i_rwsem or an equivalent lock. We could look into using i_rwsem also for block device, but for now the spinlock seems to be doing fine. Note that in current mainline we only have such a lock protecting i_size of the block_device inode, but none for the size in hd_struct. -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel 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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E916DC388F9 for ; Sat, 21 Nov 2020 16:24:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B474A22206 for ; Sat, 21 Nov 2020 16:24:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726398AbgKUQYR (ORCPT ); Sat, 21 Nov 2020 11:24:17 -0500 Received: from verein.lst.de ([213.95.11.211]:46174 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725953AbgKUQYQ (ORCPT ); Sat, 21 Nov 2020 11:24:16 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id 951F467373; Sat, 21 Nov 2020 17:24:11 +0100 (CET) Date: Sat, 21 Nov 2020 17:24:11 +0100 From: Christoph Hellwig To: Jan Kara Cc: Matthew Wilcox , Christoph Hellwig , Jens Axboe , Tejun Heo , Josef Bacik , Konrad Rzeszutek Wilk , Coly Li , Mike Snitzer , dm-devel@redhat.com, Richard Weinberger , Jan Kara , linux-block@vger.kernel.org, xen-devel@lists.xenproject.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 14/20] block: remove the nr_sects field in struct hd_struct Message-ID: <20201121162411.GA18475@lst.de> References: <20201118084800.2339180-1-hch@lst.de> <20201118084800.2339180-15-hch@lst.de> <20201119120525.GW1981@quack2.suse.cz> <20201120090820.GD21715@lst.de> <20201120112121.GB15537@quack2.suse.cz> <20201120153253.GA18990@lst.de> <20201120155956.GB4327@casper.infradead.org> <20201120200548.GA27360@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201120200548.GA27360@quack2.suse.cz> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-bcache@vger.kernel.org On Fri, Nov 20, 2020 at 09:05:48PM +0100, Jan Kara wrote: > The code is already switched to it AFAICT (the lock is really only used in > the two places that write i_size). But the problem is that in theory two > i_size_write() calls can race in a way that the resulting stored i_size is a > mix of two stored sizes. Now I have hard time imagining how this could > happen for a block device and if two reconfigurations of a block device > could race like that we'd have a large problems anyway... Now that you mention it, yes - i_size_write needs to be under i_rwsem or an equivalent lock. We could look into using i_rwsem also for block device, but for now the spinlock seems to be doing fine. Note that in current mainline we only have such a lock protecting i_size of the block_device inode, but none for the size in hd_struct. 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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C48CC388F9 for ; Sat, 21 Nov 2020 23:13:40 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 42253217A0 for ; Sat, 21 Nov 2020 23:13:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="x11cAwC4"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="pGx8zMSj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 42253217A0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=znUtWx/00cu2nGpP6WG0jyU6rA1I+ndpbLa8W1A3CYQ=; b=x11cAwC41BPCgHTQzpXktLD3w AC6c5qX8DUpq6DdoR7og88sgpbEUfSJ3VAggD+8pA35d+1c8vgQuFnhwcNaQ2gv6hncvcpoxuZgUi tR0Y9oUdPFdAnSswGWQlcYf1OAOt/OKQyQ0BacPiWLQvXj5viiP04MVwA5hwsA5YHXK+Yq6NjVqsg qLM9CtuCj1eU8LdQbTBUxSMCCXJlOgRko+9igDEpinCp5so06XU6rb3wXV5oAHhp1pbm5QwHA4/pU nw2Lp7XD1ydRTJZiUEb8BKRbRjYQ6fLlP3ZLfZPcxnowqqL0Ch7CFRvDIBidoB0bfDR1axJwoAdQr L2fhaa8Wg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kgc3M-0007zD-8f; Sat, 21 Nov 2020 23:12:24 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kgc3C-0007x7-Nj for linux-mtd@merlin.infradead.org; Sat, 21 Nov 2020 23:12:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=WxEoaLD4KxXy4hYyuj+02iCTv0K0pSQLkqPe94yBbac=; b=pGx8zMSjlrF1NMZS+unTIykJwB VhFMd7qu2rsN5xwrBo3B1AJuyCM7wYC/upLuG96grtvnMj4nk6t4KyInmMU9ldXhwQxS94UCMMAEu 657+dWcAg1uDmW3Oa0ptNWTNZ3TTl4wLiQSkumh08mbtpuA22HLfG15bzaYJ/VBaNwkvrZ4SHaWI0 HQ+eIXN5omXdry0h8a6ZUaTEm/PPZs8lFwWQ3b7dHL0zPxFK0wAjzffujrskkDB4fI60cErQ1FyfQ I38ROfh0g6b/LGSFmdYV/jq/vi2Gqd9Xa8unAuNy4VFLmSuaf7KDzf5KS36JB6T4UHxj0u9QgK8Dk Vh0UOtYw==; Received: from verein.lst.de ([213.95.11.211]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kgVgQ-0001aD-IL for linux-mtd@lists.infradead.org; Sat, 21 Nov 2020 16:24:21 +0000 Received: by verein.lst.de (Postfix, from userid 2407) id 951F467373; Sat, 21 Nov 2020 17:24:11 +0100 (CET) Date: Sat, 21 Nov 2020 17:24:11 +0100 From: Christoph Hellwig To: Jan Kara Subject: Re: [PATCH 14/20] block: remove the nr_sects field in struct hd_struct Message-ID: <20201121162411.GA18475@lst.de> References: <20201118084800.2339180-1-hch@lst.de> <20201118084800.2339180-15-hch@lst.de> <20201119120525.GW1981@quack2.suse.cz> <20201120090820.GD21715@lst.de> <20201120112121.GB15537@quack2.suse.cz> <20201120153253.GA18990@lst.de> <20201120155956.GB4327@casper.infradead.org> <20201120200548.GA27360@quack2.suse.cz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201120200548.GA27360@quack2.suse.cz> User-Agent: Mutt/1.5.17 (2007-11-01) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201121_162418_856352_945EF6A9 X-CRM114-Status: GOOD ( 18.48 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jens Axboe , Mike Snitzer , Konrad Rzeszutek Wilk , Richard Weinberger , Josef Bacik , Matthew Wilcox , Coly Li , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, dm-devel@redhat.com, linux-mtd@lists.infradead.org, linux-mm@kvack.org, Jan Kara , Tejun Heo , xen-devel@lists.xenproject.org, linux-bcache@vger.kernel.org, Christoph Hellwig Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org On Fri, Nov 20, 2020 at 09:05:48PM +0100, Jan Kara wrote: > The code is already switched to it AFAICT (the lock is really only used in > the two places that write i_size). But the problem is that in theory two > i_size_write() calls can race in a way that the resulting stored i_size is a > mix of two stored sizes. Now I have hard time imagining how this could > happen for a block device and if two reconfigurations of a block device > could race like that we'd have a large problems anyway... Now that you mention it, yes - i_size_write needs to be under i_rwsem or an equivalent lock. We could look into using i_rwsem also for block device, but for now the spinlock seems to be doing fine. Note that in current mainline we only have such a lock protecting i_size of the block_device inode, but none for the size in hd_struct. ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/