nfs4: Do not remove RootInode too soon
This commit is contained in:
@@ -27,9 +27,10 @@ void
|
|||||||
VnodeToInode::Replace(Inode* newInode)
|
VnodeToInode::Replace(Inode* newInode)
|
||||||
{
|
{
|
||||||
WriteLocker _(fLock);
|
WriteLocker _(fLock);
|
||||||
if (fInode != NULL)
|
if (fInode != NULL && !IsRoot()) {
|
||||||
fInode->GetFileSystem()->InoIdMap()->MarkRemoved(fID);
|
fInode->GetFileSystem()->InoIdMap()->MarkRemoved(fID);
|
||||||
delete fInode;
|
delete fInode;
|
||||||
|
}
|
||||||
|
|
||||||
fInode = newInode;
|
fInode = newInode;
|
||||||
if (fInode != NULL) {
|
if (fInode != NULL) {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include "Inode.h"
|
#include "Inode.h"
|
||||||
#include "InodeIdMap.h"
|
#include "InodeIdMap.h"
|
||||||
|
#include "RootInode.h"
|
||||||
|
|
||||||
class VnodeToInode {
|
class VnodeToInode {
|
||||||
public:
|
public:
|
||||||
@@ -31,6 +32,8 @@ public:
|
|||||||
inline void Clear();
|
inline void Clear();
|
||||||
|
|
||||||
inline ino_t ID() const;
|
inline ino_t ID() const;
|
||||||
|
|
||||||
|
inline bool IsRoot() const;
|
||||||
private:
|
private:
|
||||||
ino_t fID;
|
ino_t fID;
|
||||||
rw_lock fLock;
|
rw_lock fLock;
|
||||||
@@ -70,7 +73,7 @@ inline
|
|||||||
VnodeToInode::~VnodeToInode()
|
VnodeToInode::~VnodeToInode()
|
||||||
{
|
{
|
||||||
Remove();
|
Remove();
|
||||||
if (fFileSystem != NULL)
|
if (fFileSystem != NULL && !IsRoot())
|
||||||
fFileSystem->InoIdMap()->RemoveEntry(fID);
|
fFileSystem->InoIdMap()->RemoveEntry(fID);
|
||||||
rw_lock_destroy(&fLock);
|
rw_lock_destroy(&fLock);
|
||||||
}
|
}
|
||||||
@@ -101,11 +104,19 @@ inline void
|
|||||||
VnodeToInode::Clear()
|
VnodeToInode::Clear()
|
||||||
{
|
{
|
||||||
WriteLocker _(fLock);
|
WriteLocker _(fLock);
|
||||||
delete fInode;
|
if (!IsRoot())
|
||||||
|
delete fInode;
|
||||||
fInode = NULL;
|
fInode = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool
|
||||||
|
VnodeToInode::IsRoot() const
|
||||||
|
{
|
||||||
|
return fInode && fFileSystem && fInode->ID() == fFileSystem->Root()->ID();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Inode*
|
inline Inode*
|
||||||
VnodeToInode::GetPointer() const
|
VnodeToInode::GetPointer() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user