* When aborting a transaction, we also need to revert any changes made to the
cached bfs_inode of all changes inodes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31859 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -333,9 +333,7 @@ Inode::Inode(Volume* volume, ino_t id)
|
||||
{
|
||||
PRINT(("Inode::Inode(volume = %p, id = %Ld) @ %p\n", volume, id, this));
|
||||
|
||||
NodeGetter node(volume, this);
|
||||
memcpy(&fNode, node.Node(), sizeof(bfs_inode));
|
||||
fNode.flags &= HOST_ENDIAN_TO_BFS_INT32(INODE_PERMANENT_FLAGS);
|
||||
UpdateNodeFromDisk();
|
||||
|
||||
char lockName[B_OS_NAME_LENGTH];
|
||||
snprintf(lockName, sizeof(lockName), "bfs inode %d.%d",
|
||||
@@ -458,6 +456,15 @@ Inode::WriteBack(Transaction& transaction)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Inode::UpdateNodeFromDisk()
|
||||
{
|
||||
NodeGetter node(fVolume, this);
|
||||
memcpy(&fNode, node.Node(), sizeof(bfs_inode));
|
||||
fNode.flags &= HOST_ENDIAN_TO_BFS_INT32(INODE_PERMANENT_FLAGS);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
Inode::CheckPermissions(int accessMode) const
|
||||
{
|
||||
|
||||
@@ -42,7 +42,9 @@ public:
|
||||
{ transaction.AddInode(this); }
|
||||
|
||||
recursive_lock& SmallDataLock() { return fSmallDataLock; }
|
||||
|
||||
status_t WriteBack(Transaction& transaction);
|
||||
void UpdateNodeFromDisk();
|
||||
|
||||
bool IsContainer() const
|
||||
{ return S_ISDIR(Mode()); }
|
||||
|
||||
@@ -1151,10 +1151,17 @@ Transaction::RemoveInode(Inode* inode)
|
||||
|
||||
|
||||
void
|
||||
Transaction::_UnlockInodes()
|
||||
Transaction::_UnlockInodes(bool success)
|
||||
{
|
||||
while (Inode* inode = fLockedInodes.RemoveHead()) {
|
||||
inode->Node().flags &= ~HOST_ENDIAN_TO_BFS_INT32(INODE_IN_TRANSACTION);
|
||||
if (success) {
|
||||
inode->Node().flags
|
||||
&= ~HOST_ENDIAN_TO_BFS_INT32(INODE_IN_TRANSACTION);
|
||||
} else {
|
||||
// revert any changes made to the cached bfs_inode
|
||||
inode->UpdateNodeFromDisk();
|
||||
}
|
||||
|
||||
rw_lock_write_unlock(&inode->Lock());
|
||||
|
||||
// See AddInode() why we do this here
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2008, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Copyright 2001-2009, Axel Dörfler, axeld@pinc-software.de.
|
||||
* This file may be used under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef JOURNAL_H
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
{
|
||||
if (fJournal != NULL) {
|
||||
fJournal->Unlock(this, false);
|
||||
_UnlockInodes();
|
||||
_UnlockInodes(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
{
|
||||
status_t status = B_OK;
|
||||
if (fJournal != NULL) {
|
||||
_UnlockInodes();
|
||||
_UnlockInodes(true);
|
||||
status = fJournal->Unlock(this, true);
|
||||
if (status == B_OK)
|
||||
fJournal = NULL;
|
||||
@@ -172,7 +172,7 @@ private:
|
||||
Transaction& operator=(const Transaction& other);
|
||||
// no implementation
|
||||
|
||||
void _UnlockInodes();
|
||||
void _UnlockInodes(bool success);
|
||||
|
||||
Journal* fJournal;
|
||||
InodeList fLockedInodes;
|
||||
|
||||
Reference in New Issue
Block a user