From 363999a1ebe2ba20a3f41d6f76b45d6b2248a16a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 27 Nov 2002 22:40:04 +0000 Subject: [PATCH] Thanks to Bruno, we fixed a bug in Inode::Create() that happened with newly created files that already existed. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2098 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/file_systems/bfs/Inode.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/add-ons/kernel/file_systems/bfs/Inode.cpp b/src/add-ons/kernel/file_systems/bfs/Inode.cpp index 5a2b4206e6..d2502b5647 100644 --- a/src/add-ons/kernel/file_systems/bfs/Inode.cpp +++ b/src/add-ons/kernel/file_systems/bfs/Inode.cpp @@ -1734,6 +1734,12 @@ Inode::Sync() status_t Inode::Remove(Transaction *transaction, const char *name, off_t *_id, bool isDirectory) { + thread_info info; + if (get_thread_info(find_thread(NULL), &info) == B_OK) { + dprintf("stack base = %p, stack end = %p, size = %ld\n", info.stack_base, info.stack_end, (uint32)info.stack_end - (uint32)info.stack_base); + } else + dprintf("get_thread_info() failed\n"); + BPlusTree *tree; if (GetTree(&tree) != B_OK) RETURN_ERROR(B_BAD_VALUE); @@ -1775,10 +1781,13 @@ Inode::Remove(Transaction *transaction, const char *name, off_t *_id, bool isDir } // remove_vnode() allows the inode to be accessed until the last put_vnode() - if (remove_vnode(fVolume->ID(), id) != B_OK) + if (remove_vnode(fVolume->ID(), id) != B_OK) { + dprintf("remove_vnode() failed!!!\n"); return B_ERROR; + } if (tree->Remove(transaction, name, id) < B_OK) { + dprintf("tree->Remove() failed!!!\n"); unremove_vnode(fVolume->ID(), id); RETURN_ERROR(B_ERROR); } @@ -1803,8 +1812,10 @@ Inode::Remove(Transaction *transaction, const char *name, off_t *_id, bool isDir index.RemoveLastModified(transaction, inode); } - if (inode->WriteBack(transaction) < B_OK) + if (inode->WriteBack(transaction) < B_OK) { + dprintf("inode->WriteBack() failed!!!\n"); return B_ERROR; + } return B_OK; } @@ -1874,7 +1885,7 @@ Inode::Create(Transaction *transaction, Inode *parent, const char *name, int32 m *_inode = inode; // only keep the vnode in memory if the _id or _inode pointer is provided - if (_id == NULL && _inode == NULL) + if (_id != NULL || _inode != NULL) vnode.Keep(); return B_OK;