Bring back O_NDELAY for floppy
Only one commit this time with revert of O_NDELAY removal for the floppy. Users reported that the commit breaks userspace utils and known floppy workflow patterns. We already reverted the same commit back in 2016 presumably for the same reason. Completely drop O_NDELAY for floppy seems excessive to solve problems it introduces. I started to write basic selftests for the floppy to prevent this kind of userspace breaks in the future. Signed-off-by: Denis Efremov <efremov@linux.com> -----BEGIN PGP SIGNATURE----- iQJGBAABCAAwFiEEdlQDNgKUDfGSD+QDtSKVsDNQMB8FAmErWwoSHGVmcmVtb3ZA bGludXguY29tAAoJELUilbAzUDAfRv0P/1jvwP/UlQt1ycjRgAW0ZcOzMxJXFl8v hQjm4xb1RS9EOGXBZuqIPhCZlvhsiVOqbM1zSHnUnCBxQwZzRNJQVWZHtwhqW549 fanqZbxd7JFpQSp2la9y31rNvlRj4cGzBMT7CVScebcPmbCGZ7OvmTj5TCh6Uoxy w/GAxz73m85LFmklXEeHa9iKZo9BUZjBxFYPYFBEMvQeht0RDElALU44Fu+l+ZR6 EHFUdWwzru7U7306JqaHzamuGg7z1OVv2pKzrSyM1qSP3cz7REiY1pSFXrANtE6u uWffOVarXlVS2G8MnjLniFYONcUQvOr5taG58mnnW+lIcLvIzEP6LlAIT7C0YIcv eM6n54xvn+b0PZubMNgIYs7zY+7MFMOrVa3/wjjr9znbZOfbV9oBhumYkPqBHjOQ 3DkEZY1cQe9FXKCUlGIU6n0NtWLAOQgNHeqJiUTy/v8O9NTV1rXHTVUsFwFuWSgk U8eJBZeYz7dK08M3qhS7Id0lk9z3/H/garPjwGlTEH6aP491R0OlaViJ1RpWnmiB JBpNtWooWFepaPXZA4Ts8ukT25p6h/OQbTzDv7ICuLzIzZptNmAxMvhEnhSuHBjx NsijVEqeUS9N+F9t+HynfDAd+SLgMcyguN+q/8i+zkakILGv7wfR/gyzl5ntx+uy c0UYUkCqWl6V =BNuJ -----END PGP SIGNATURE----- Merge tag 'floppy-for-5.15' of https://github.com/evdenis/linux-floppy into for-5.15/drivers Pull floppy fix from Denis: "Bring back O_NDELAY for floppy Only one commit this time with revert of O_NDELAY removal for the floppy. Users reported that the commit breaks userspace utils and known floppy workflow patterns. We already reverted the same commit back in 2016 presumably for the same reason. Completely drop O_NDELAY for floppy seems excessive to solve problems it introduces. I started to write basic selftests for the floppy to prevent this kind of userspace breaks in the future. Signed-off-by: Denis Efremov <efremov@linux.com>" * tag 'floppy-for-5.15' of https://github.com/evdenis/linux-floppy: Revert "floppy: reintroduce O_NDELAY fix"
This commit is contained in:
commit
b5b0eba590
@ -4029,23 +4029,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_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))
|
||||
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))
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user