From c019945cbd4e36914c6eba37e2f4c2d60a25b117 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 17 Jul 2010 16:11:56 +0000 Subject: [PATCH] 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 --- src/system/kernel/fs/vfs.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index b8d5f2b509..13759764c5 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -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