Re: CD writing in future Linux (stirring up a hornets' nest)

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

 



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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux