Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13967908pxu; Mon, 4 Jan 2021 09:13:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwMllxINdocKqUNPJE9bicjQTTXRnTkA7M7USZAs8FScIuIWUQ/3JcQzyQb6iYBgc8ToDKo X-Received: by 2002:a17:906:3a55:: with SMTP id a21mr68307818ejf.516.1609780400171; Mon, 04 Jan 2021 09:13:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609780400; cv=none; d=google.com; s=arc-20160816; b=ajKMtzUuNhWsJFfyU8cUyq7QvRhL6sr92eS6lM4soBXqlOQ2fgX3o7FYklQ8ypP1Rw nYnEjoe+cU8oVhdGv4e26Pd//jZ9WoISGizrTJlDEiZd9QRvQlXIWAd1owsW5xg3K72z yq7xVfUxtA0qlFOsddrz1bJGFR29GSWxiju7ePWZgQavk4izuYlayG4nHRiNyLwIJPtF jBMk9CpRm6gRJ2Rx8xLmraogOSqhGeYVPqD8BdUFbm0RlJLUj5m8gU+2trbwOCPPKY6v HzZWqdPGB2bY3fOVp6RRM/AXCD3JQkNvSMZr2QBRCmP+hWOcdQlIqatHSML9YnjsRaFa 68og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=AOPbGk5Zqe/vNU2fGU+xk3BFHZ2mJFIbTKSixP9YOXs=; b=Ia4hflIatAQ9lJwRP2Jt4LKR73GP13BuBIxpyDkyz6B46nWVfDT7EXiUywdCF313RK vQ9Bli06opvUreghznT2t7bwVwkjUQC9asdn0PtZNd5ujP6s3sVsq0BVp/651N5LbEbT ZjT9X9AUuKeYMTPIxL2u8CDIbM+cj0IXH0jAaWrYr8eL1iMMZSJJiGYXJ21mSZzIx2bm Cb3q8D+UDodph3XsNmEkp8kpvVYa4SroER5MmtJ4mFgMZseZspksiHlYUE/HarmLuatT 6qiYCGYSwoSLPffIGyQNFP/HC9CEfTxkwNoRFmGr+LpEJp9muqZ+DJz4vKigwvge4mWT N2rQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g5si29396351ejw.724.2021.01.04.09.12.56; Mon, 04 Jan 2021 09:13:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727377AbhADRLv (ORCPT + 99 others); Mon, 4 Jan 2021 12:11:51 -0500 Received: from verein.lst.de ([213.95.11.211]:58547 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726308AbhADRLv (ORCPT ); Mon, 4 Jan 2021 12:11:51 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id 5EF8067373; Mon, 4 Jan 2021 18:11:08 +0100 (CET) Date: Mon, 4 Jan 2021 18:11:08 +0100 From: Christoph Hellwig To: Minwoo Im Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Jens Axboe , Alexander Viro , Christoph Hellwig , Chaitanya Kulkarni Subject: Re: [RFC PATCH V3 1/1] block: reject I/O for same fd if block size changed Message-ID: <20210104171108.GA27235@lst.de> References: <20210104130659.22511-1-minwoo.im.dev@gmail.com> <20210104130659.22511-2-minwoo.im.dev@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210104130659.22511-2-minwoo.im.dev@gmail.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 04, 2021 at 10:06:59PM +0900, Minwoo Im wrote: > + if (q->backing_dev_info && q->backing_dev_info->owner && > + limits->logical_block_size != size) { > + bdev = blkdev_get_no_open(q->backing_dev_info->owner->devt); > + bdev->bd_disk->flags |= GENHD_FL_BLOCK_SIZE_CHANGED; > + blkdev_put_no_open(bdev); > + } We really need the backpointer from the queue to the gendisk I've wanted to add for a while. Can we at least restrict this to a live gendisk? Also I think the size change flag should go into the ->state field and use the atomic bitops helpers to avoid concurrency problems.