Added detail to the comment about why we can't call the create() hook without

O_EXCL.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37555 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2010-07-17 16:11:56 +00:00
parent 1a38616f35
commit c019945cbd
+7 -6
View File
@@ -5144,12 +5144,13 @@ create_vnode(struct vnode* directory, const char* name, int openMode,
// This is somewhat tricky: If the entry already exists, the FS responsible
// for the directory might not necessarily also be the one responsible for
// the node the entry refers to. So we can actually never call the create()
// hook without O_EXCL. Instead we try to look the entry up first. If it
// already exists, we just open the node (unless O_EXCL), otherwise we call
// create() with O_EXCL. This introduces a race condition, since someone
// else might have created the entry in the meantime. We hope the respective
// FS returns the correct error code and retry (up to 3 times) again.
// the node the entry refers to (e.g. in case of mount points or FIFOs). So
// we can actually never call the create() hook without O_EXCL. Instead we
// try to look the entry up first. If it already exists, we just open the
// node (unless O_EXCL), otherwise we call create() with O_EXCL. This
// introduces a race condition, since someone else might have created the
// entry in the meantime. We hope the respective FS returns the correct
// error code and retry (up to 3 times) again.
for (int i = 0; i < 3 && status != B_OK; i++) {
// look the node up