2006-02-05 22:28:09

by NeilBrown

[permalink] [raw]
Subject: Re: CD writing in future Linux (stirring up a hornets' nest)

On Sunday February 5, [email protected] wrote:
>
> If you specify O_EXCL (and not O_CREAT), it is implementation defined
> what will happen (in the Linux case, this opens a block device for
> exclusive access).

With Linux, O_EXCL on a block devices isn't *exactly* exclusive
access.
It only provided you exclusive access against other people who ask for
exclusive access, which includes in-kernel usage like mount, md, dm,
and swap.

So if you open a block device O_EXCL, it will fail if the block device
is already open O_EXCL or is mounted, or in use by the kernel in some
other way (including if a partition is open O_EXCL). An if you
succeed in getting an O_EXCL open, then no-one else will be able to
get an O_EXCL open, or mount the filesystem etc.
Bit on open without O_EXCL will always succeed no matter whether
someone has it O_EXCL or not.

So it is a lot like an advisory exclusive lock on the whole block
device.

NeilBrown


2006-02-06 11:15:10

by Krzysztof Halasa

[permalink] [raw]
Subject: Re: CD writing in future Linux (stirring up a hornets' nest)

Neil Brown <[email protected]> writes:

> Bit on open without O_EXCL will always succeed no matter whether
> someone has it O_EXCL or not.

Ok. That means hald has no use for it, but cdrecord and similar
programs could use it.
--
Krzysztof Halasa

2006-02-06 14:58:54

by Jan Engelhardt

[permalink] [raw]
Subject: Re: CD writing in future Linux (stirring up a hornets' nest)

>
>> Bit on open without O_EXCL will always succeed no matter whether
>> someone has it O_EXCL or not.
>
>Ok. That means hald has no use for it, but cdrecord and similar
>programs could use it.

But that again sounds like hald won't use O_EXCL, therefore could always be
able to open the device and potentially send commands which interrupt cd
writing.


Jan Engelhardt
--

2006-02-06 18:17:52

by Krzysztof Halasa

[permalink] [raw]
Subject: Re: CD writing in future Linux (stirring up a hornets' nest)

Jan Engelhardt <[email protected]> writes:

> But that again sounds like hald won't use O_EXCL, therefore could always be
> able to open the device and potentially send commands which interrupt cd
> writing.

Yep. Both need that. And I need some coffee to recover from
non-logical thinking.
--
Krzysztof Halasa

2006-02-06 18:38:41

by Phillip Susi

[permalink] [raw]
Subject: Re: CD writing in future Linux (stirring up a hornets' nest)

Out of curiosity, what commands does hal send the drive that can
interrupt burning? I've been reading the MMC-5 standard lately and it
looks like while the drive is burning, attempts to send it other
commands that would interfere with the burn are supposed to be failed
with an error code indicating that a burn is in progress, and thus,
avoid making a coaster.

Krzysztof Halasa wrote:
> Jan Engelhardt <[email protected]> writes:
>
>
>> But that again sounds like hald won't use O_EXCL, therefore could always be
>> able to open the device and potentially send commands which interrupt cd
>> writing.
>>
>
> Yep. Both need that. And I need some coffee to recover from
> non-logical thinking.
>

2006-02-09 16:09:30

by Jan Engelhardt

[permalink] [raw]
Subject: Re: CD writing in future Linux (stirring up a hornets' nest)

>
> Out of curiosity, what commands does hal send the drive that can interrupt
> burning? I've been reading the MMC-5 standard lately and it looks like while
> the drive is burning, attempts to send it other commands that would interfere
> with the burn are supposed to be failed with an error code indicating that a
> burn is in progress, and thus, avoid making a coaster.
>
At least there needs to be a command that is not ignored to stop a burn.
Though, hald would not be /that/ evil.


Jan Engelhardt
--