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.2 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 BF074C4741F for ; Fri, 6 Nov 2020 14:02:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 68B7520791 for ; Fri, 6 Nov 2020 14:02:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727386AbgKFOCG (ORCPT ); Fri, 6 Nov 2020 09:02:06 -0500 Received: from verein.lst.de ([213.95.11.211]:51668 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727251AbgKFOCG (ORCPT ); Fri, 6 Nov 2020 09:02:06 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id C704868B02; Fri, 6 Nov 2020 15:02:01 +0100 (CET) Date: Fri, 6 Nov 2020 15:02:01 +0100 From: Christoph Hellwig To: Stefan Haberland Cc: Christoph Hellwig , Jens Axboe , Ilya Dryomov , Song Liu , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Jan Hoeppner , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, linux-bcache@vger.kernel.org, linux-raid@vger.kernel.org, linux-mtd@lists.infradead.org, linux-s390@vger.kernel.org Subject: Re: [PATCH 06/10] dasd: implement ->set_read_only to hook into BLKROSET processing Message-ID: <20201106140201.GA23087@lst.de> References: <20201103100018.683694-1-hch@lst.de> <20201103100018.683694-7-hch@lst.de> <20201105205634.GA78869@imap.linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201105205634.GA78869@imap.linux.ibm.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-raid@vger.kernel.org On Thu, Nov 05, 2020 at 09:56:47PM +0100, Stefan Haberland wrote: > > + /* do not manipulate hardware state for partitions */ > > if (bdev_is_partition(bdev)) > > - // ro setting is not allowed for partitions > > - return -EINVAL; > > - if (get_user(intval, (int __user *)argp)) > > - return -EFAULT; > > + return 0; > > + > > base = dasd_device_from_gendisk(bdev->bd_disk); > > if (!base) > > return -ENODEV; > > - if (!intval && test_bit(DASD_FLAG_DEVICE_RO, &base->flags)) { > > - dasd_put_device(base); > > - return -EROFS; > > - } > > - set_disk_ro(bdev->bd_disk, intval); > > > While testing this patch I just noticed that when I set a device readonly this is > not going to be passed on to the partitions on this device any longer. > > This is caused by the removed call to set_disk_ro(). > > Is this intentional or was this removed by accident? It was unintentionally intentional :) The generic code used already by almost all drivers in mainline only calls set_device_ro from blkdev_roset, that is it only sets the main device read-only. dasd was the outlier here, and I didn't notice it actually called set_disk_ro instead of set_device_ro. That being said I think setting all the partitions read-only as well when the full device is set read-only makes perfect sense. I'm just a little worried it could cause regressions. Let me prepare a follow on patch on top of the series that switches to that behavior.