From 4251f05625ca44b4575584208d95741d77128f2f Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Thu, 28 May 2009 02:15:14 +0000 Subject: [PATCH] When writing an attribute store file the parent directory might have been invalidated since the creation of the object. If this is the case we have to look it up again. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30889 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../attribute_overlay/attribute_overlay.cpp | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp b/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp index 36b19a34e7..4ac247e60b 100644 --- a/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp +++ b/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp @@ -517,11 +517,6 @@ AttributeFile::WriteAttributeFile(fs_volume *overlay, fs_volume *volume, if (fFile == NULL) return B_NO_INIT; - if (fDirectoryInode == 0) { - TRACE_ALWAYS("directory inode not known\n"); - return B_NO_INIT; - } - char nameBuffer[B_FILE_NAME_LENGTH]; nameBuffer[sizeof(nameBuffer) - 1] = 0; status_t result = vnode->ops->get_vnode_name(volume, vnode, nameBuffer, @@ -531,7 +526,25 @@ AttributeFile::WriteAttributeFile(fs_volume *overlay, fs_volume *volume, return result; } - fs_vnode currentVnode; + fs_vnode currentVnode = *vnode; + if (fDirectoryInode == 0) { + if (currentVnode.ops->lookup == NULL) { + TRACE_ALWAYS("lookup not possible, lookup hook missing\n"); + return B_UNSUPPORTED; + } + + // see TODO above + result = currentVnode.ops->lookup(volume, ¤tVnode, "..", + &fDirectoryInode); + if (result != B_OK) { + TRACE_ALWAYS("lookup of parent directory failed: %s\n", + strerror(result)); + return B_UNSUPPORTED; + } + + put_vnode(volume, fDirectoryInode); + } + OverlayInode *overlayInode = NULL; if (fAttributeDirInode == 0) { result = get_vnode(overlay, fDirectoryInode, (void **)&overlayInode);