Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1587313pxv; Fri, 23 Jul 2021 11:59:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuM2JpAF2URgH7Ck5oA2NvFcp7akfND/UDKZlTpjH7of5pbgSWixR6VTNPD0jClJTG/KIK X-Received: by 2002:a5e:d918:: with SMTP id n24mr5083606iop.173.1627066753370; Fri, 23 Jul 2021 11:59:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627066753; cv=none; d=google.com; s=arc-20160816; b=vWnU2uWi6oqZox7ChBEh4BSCFCMrtv4OtGs+rn2MLkWrZwd8CVT/ZJeeKJD+M40YTS fIKmtV/RQaWn5LEnlkWss8xDnbPdbeeTpW267zPizKt6klFNxzSVkoLzry1Iv6BDmJ+d z7RvlU79AyDR3P7tq2gcEFfW8ukHrSLsaZBUBR9IF/rI3U+dXNP65RnkmisM+axxQr8a hv3sByx77JinPtCsR9E7s4EEjvYj0+F+/PgugfKr4x8kCwcwM5rvcOc2XTwMyMnbl2gJ lLWzI5cSiUOzUmdnyeNouT6TsyyYV/oZu37d8shnPka7qiKZk+RC4CLxO031XxlVS2Ch 30Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:user-agent:date:message-id:organization:cc:to:reply-to :subject:from; bh=fKyMm3PEGHdsfNsU+RB2pERzEZDaEGLgPdHwvQMoji4=; b=BMo/UFLhqenHTv0OlEzPjN0eanhvM54LMGpKh/KLTO0H2/bp25nOEdawI6yndDMAZX axTqfBHgtfBU1xVUic16XK7tDzS8bGVLbQdViAXxpSCCb2eXDj+wL3XHoNWPmhEnn6ED GSFfDRxUVAdgTa0kqJe670rW2W+xInnp7Y8RwzsW88Dn83b2XN36kFm6Xop5IlsFbnq4 rxC5SYdeIkBMUcuwNFqv3J7U6SJwpmpcaBya7g8H0ewp0nZFqpd4cJQ7TFRaRXM0MEQ6 4Bh3sbRyphgElS1jGn1rwy+Qvtgbsdw/5FTkJXFy+CI52VnDVsX5PJZhJAgkGZhvMvi5 m20Q== 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 v1si22587750ioj.78.2021.07.23.11.59.01; Fri, 23 Jul 2021 11:59:13 -0700 (PDT) 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 S229971AbhGWSQM (ORCPT + 99 others); Fri, 23 Jul 2021 14:16:12 -0400 Received: from smtp106.ord1d.emailsrvr.com ([184.106.54.106]:55613 "EHLO smtp106.ord1d.emailsrvr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229964AbhGWSQL (ORCPT ); Fri, 23 Jul 2021 14:16:11 -0400 X-Auth-ID: markh@compro.net Received: by smtp6.relay.ord1d.emailsrvr.com (Authenticated sender: markh-AT-compro.net) with ESMTPSA id 579C6E027F; Fri, 23 Jul 2021 14:47:56 -0400 (EDT) From: Mark Hounschell Subject: [BUG] FLOPPY DRIVER since 5.10.20 Reply-To: markh@compro.net To: linux-block@vger.kernel.org, Linux-kernel Cc: Denis Efremov , Jiri Kosina , Mark Hounschell , Greg Kroah-Hartman Organization: Compro Computer Svcs. Message-ID: Date: Fri, 23 Jul 2021 14:47:50 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Classification-ID: c9e847c2-38a7-4e9c-914b-8fd45db953aa-1-1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These 2 incremental patches, patch-5.10.19-20 and patch-5.11.2-3 have broken the user land fd = open("/dev/fd0", (O_RDWR | O_NDELAY)); functionality. Since FOREVER before the patch, when using O_NDELAY, one could open the floppy device with no media inserted or even with write protected media without error. "Read-only file system" status is returned only when we actually tried to write to it. We have software still in use today that relies on this functionality. After the patch, if no media is in the drive the open fails with "no such device or address". If the floppy media is write protected the open fails with "Read-only file system". This is certainly drastically changing user land usage incorrectly IMHO. I think the commit is commit 8a0c014cd20516ade9654fc13b51345ec58e7be8 It is the only reference to the floppy driver in ChangeLog-5.10.20. However this change log entry actually sounds like it fixes the very issue I am reporting. Here is the patch from the 5.10.19-20 change. diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 7df79ae6b0a1e..295da442329f3 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -4120,23 +4120,23 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) if (fdc_state[FDC(drive)].rawcmd == 1) fdc_state[FDC(drive)].rawcmd = 2; - if (!(mode & FMODE_NDELAY)) { - if (mode & (FMODE_READ|FMODE_WRITE)) { - drive_state[drive].last_checked = 0; - clear_bit(FD_OPEN_SHOULD_FAIL_BIT, - &drive_state[drive].flags); - if (bdev_check_media_change(bdev)) - floppy_revalidate(bdev->bd_disk); - if (test_bit(FD_DISK_CHANGED_BIT, &drive_state[drive].flags)) - goto out; - if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &drive_state[drive].flags)) - goto out; - } - res = -EROFS; - if ((mode & FMODE_WRITE) && - !test_bit(FD_DISK_WRITABLE_BIT, &drive_state[drive].flags)) + if (mode & (FMODE_READ|FMODE_WRITE)) { + drive_state[drive].last_checked = 0; + clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &drive_state[drive].flags); + if (bdev_check_media_change(bdev)) + floppy_revalidate(bdev->bd_disk); + if (test_bit(FD_DISK_CHANGED_BIT, &drive_state[drive].flags)) + goto out; + if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &drive_state[drive].flags)) goto out; } + + res = -EROFS; + + if ((mode & FMODE_WRITE) && + !test_bit(FD_DISK_WRITABLE_BIT, &drive_state[drive].flags)) + goto out; + mutex_unlock(&open_lock); mutex_unlock(&floppy_mutex); return 0; Regards Mark