What's the mean of FMODE_EXCL?
Hi all:
Today, i wrote to a partition which already mounted using dd.So the fs was destroyed completedly.
So i asked why dd can write? I remembed the flag O_EXCL which prevent other operation.
I review the code and found it used FMODE_EXCL.But why dd can write?
In open(2):
Quoted 4 lines
In general, the behavior of
O_EXCLis undefined if it is used withoutO_CREAT. There is one
exception: on Linux 2.6 and later,O_EXCLcan be used withoutO_CREATif pathname refers to a
block device. If the block device is in use by the system (e.g., mounted),open()fails with the error EBUSY.
But understand from the literal meaning, EXCL means opened exclusively.I think it like mutex-operation.
Can someone please tell me why?
Thanks!
Jianpeng