From 536f5d515aeb33277b9d434e1d17a83a2919635a Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 9 May 2008 21:21:22 +0000 Subject: [PATCH] Don't create anything in a removed directory. Axel, please review. I don't see how the locking in Remove()/Create() works. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25404 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/file_systems/bfs/Inode.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/add-ons/kernel/file_systems/bfs/Inode.cpp b/src/add-ons/kernel/file_systems/bfs/Inode.cpp index 5687771542..38147ff967 100644 --- a/src/add-ons/kernel/file_systems/bfs/Inode.cpp +++ b/src/add-ons/kernel/file_systems/bfs/Inode.cpp @@ -2320,6 +2320,15 @@ Inode::Create(Transaction &transaction, Inode *parent, const char *name, WriteLocked locker(parent != NULL ? &parent->Lock() : NULL); // the parent directory is locked during the whole inode creation + if (parent != NULL && parent->IsDirectory()) { + // don't create anything in removed directories + bool removed; + if (get_vnode_removed(volume->FSVolume(), parent->ID(), &removed) + != B_OK || removed) { + RETURN_ERROR(B_ENTRY_NOT_FOUND); + } + } + if (tree != NULL) { // Does the file already exist? off_t offset;