Re: [PATCH 2/2] libblkid: reopen floppy without O_NONBLOCK

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



21.01.2022 13:18, Karel Zak wrote:
On Thu, Dec 09, 2021 at 03:12:33PM +0100, Vladimir Sementsov-Ogievskiy wrote:
Since c7e9d0020361f4308a70cdfd6d5335e273eb8717
"Revert "floppy: reintroduce O_NDELAY fix"" commit in linux kernel,
floppy drive works bad when opened with O_NONBLOCK: first read may
fail. This cause probing fail and leave error messages in dmesg. So, if
we detect that openedfd is floppy, reopen it without O_NONBLOCK flag.

  I'd like to a little bit optimize the code in libblkid and reduce
  number of situations when we call FDGETFDCSTAT ioctl.

  If I good understand the problem is read() with O_NONBLOCK, right?

My understanding goes no further :)


  I'd like to call stat() before FDGETFDCSTAT ioctl to make sure that
  the file descriptor is really block-device etc. (libmount supports
  regular files too)


Sounds good. I see, fstat() is called in blkid_probe_set_device(), so you just need to move your code below fstat() call.

--
Best regards,
Vladimir



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux