Util-Linux package development
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux@vger.kernel.org, jkosina@suse.cz, kurt@garloff.de,
	den@openvz.org, msuchanek@suse.de, efremov@linux.com
Subject: Re: [PATCH 2/2] libblkid: reopen floppy without O_NONBLOCK
Date: Fri, 24 Dec 2021 18:31:39 +0300	[thread overview]
Message-ID: <23719c29-9668-1edc-e60c-a30bd821c7fa@virtuozzo.com> (raw)
In-Reply-To: <9dc07586-5471-ee5e-fae4-e177ceb114f4@virtuozzo.com>

16.12.2021 11:47, Vladimir Sementsov-Ogievskiy wrote:
> 15.12.2021 15:56, Karel Zak wrote:
>> On Tue, Dec 14, 2021 at 05:24:44PM +0300, Vladimir Sementsov-Ogievskiy wrote:
>>>> What does it mean didn't help?
>>>
>>> I tried it, but the bug remains as it was.. As I understand,
>>> dropping O_NONBLOCK by fcntl just removes this flag, to change
>>> further behavior of device to non-blocking. But it doesn't do any
>>> additional actions in driver.
>>
>> Hmm ...
>>
>>>> The solution based on blkid_safe_open() means that we have to modify
>>>> many applications. For example, systemd/udevd uses
>>>>
>>>>       fd = open(devnode, O_RDONLY|O_CLOEXEC|O_NONBLOCK);
>>>>       r = blkid_probe_set_device(pr, fd, offset, 0);
>>>
>>> Hmm, yes, that's not very good :(
>>>
>>>>
>>>> The same is probably in many other places (mkfs-like programs, etc.).
>>>>
>>>> What do you think?
>>>>
>>>
>>> Maybe be we can get filename from fd reading it from /proc, then do
>>> open() and than dup() to old fd.. But that's even more dirty to do
>>> in a library call.
>>
>> Yes, re-open() sounds like a possible way.
>>
>> The dup() is not necessary. The library already support private FD for
>> probing. See blkid_new_probe_from_filename() and BLKID_FL_PRIVATE_FD.
>>
>> It's also often used when the library probe whole-disk device (when you
>> probe sda1 than it also reads data from partition table on sda). In
>> this case it opens a separate FD.
>>
>> It's for floppies (0.001% of all cases). IMHO re-open is good enough and
>> better than force changes in all applications :-)> I'll try to prepare a patch and ask you for test/review. Thanks!
>>
> 
> Great!
> 

Hi! Are you working on this? If not I can try to make a v2.

-- 
Best regards,
Vladimir

  reply	other threads:[~2021-12-24 15:31 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09 14:12 [PATCH 0/2] libblkid: don't use O_NONBLOCK for floppy Vladimir Sementsov-Ogievskiy
2021-12-09 14:12 ` [PATCH 1/2] libblkid: introduce blkid_safe_open Vladimir Sementsov-Ogievskiy
2021-12-09 14:12 ` [PATCH 2/2] libblkid: reopen floppy without O_NONBLOCK Vladimir Sementsov-Ogievskiy
2021-12-14 11:45   ` Michal Suchánek
2021-12-14 13:58     ` Vladimir Sementsov-Ogievskiy
2021-12-14 12:03   ` Karel Zak
2021-12-14 14:24     ` Vladimir Sementsov-Ogievskiy
2021-12-15 12:56       ` Karel Zak
2021-12-16  8:47         ` Vladimir Sementsov-Ogievskiy
2021-12-24 15:31           ` Vladimir Sementsov-Ogievskiy [this message]
2022-01-03  8:43             ` Karel Zak
2022-01-17 11:50               ` Karel Zak
2022-01-17 15:46                 ` Vladimir Sementsov-Ogievskiy
2022-01-17 16:12                   ` Karel Zak
2022-01-17 18:10                   ` Vladimir Sementsov-Ogievskiy
2022-01-20  9:14                     ` Karel Zak
2022-01-21 10:18   ` Karel Zak
2022-01-21 12:13     ` Vladimir Sementsov-Ogievskiy
2022-01-21 13:57       ` Karel Zak
2021-12-14 10:25 ` [PATCH 0/2] libblkid: don't use O_NONBLOCK for floppy Jiri Kosina
2021-12-14 10:29   ` Kurt Garloff
2021-12-14 11:46 ` Michal Suchánek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=23719c29-9668-1edc-e60c-a30bd821c7fa@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=den@openvz.org \
    --cc=efremov@linux.com \
    --cc=jkosina@suse.cz \
    --cc=kurt@garloff.de \
    --cc=kzak@redhat.com \
    --cc=msuchanek@suse.de \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox