lkml.org 
[lkml]   [2006]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: CD writing in future Linux (stirring up a hornets' nest)
On Sunday February 5, mrmacman_g4@mac.com 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-02-05 23:33    [from the cache]
©2003-2011 Jasper Spaans