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=-10.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 96E4CC43461 for ; Fri, 4 Sep 2020 10:28:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6401D20791 for ; Fri, 4 Sep 2020 10:28:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730066AbgIDK2I (ORCPT ); Fri, 4 Sep 2020 06:28:08 -0400 Received: from mx2.suse.de ([195.135.220.15]:46158 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726171AbgIDK2F (ORCPT ); Fri, 4 Sep 2020 06:28:05 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id CBBB2AF6D; Fri, 4 Sep 2020 10:28:03 +0000 (UTC) Subject: Re: [PATCH 14/19] floppy: use a separate gendisk for each media format To: Christoph Hellwig , Jens Axboe Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Denis Efremov , "David S. Miller" , Song Liu , Al Viro , Finn Thain , Michael Schmitz , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org, linux-raid@vger.kernel.org, linux-scsi@vger.kernel.org, linux-m68k@lists.linux-m68k.org References: <20200903080119.441674-1-hch@lst.de> <20200903080119.441674-15-hch@lst.de> From: Hannes Reinecke Message-ID: <6a89e295-fd16-1930-c5a1-474c1ed47718@suse.de> Date: Fri, 4 Sep 2020 12:28:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200903080119.441674-15-hch@lst.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/3/20 10:01 AM, Christoph Hellwig wrote: > The floppy driver usually autodetects the media when used with the > normal /dev/fd? devices, which also are the only nodes created by udev. > But it also supports various aliases that force a given media format. > That is currently supported using the blk_register_region framework > which finds the floppy gendisk even for a 'mismatched' dev_t. The > problem with this (besides the code complexity) is that it creates > multiple struct block_device instances for the whole device of a > single gendisk, which can lead to interesting issues in code not > aware of that fact. > > To fix this just create a separate gendisk for each of the aliases > if they are accessed. > > Signed-off-by: Christoph Hellwig > --- > drivers/block/floppy.c | 154 ++++++++++++++++++++++++++--------------- > 1 file changed, 97 insertions(+), 57 deletions(-) > Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer