Invalidate our cached inode numbers when removing the attribute file. Basically

we want to ensure that we re-enumerate our environment when eventually writing
a new one as it has most probably changed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30888 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2009-05-28 02:05:23 +00:00
parent dfada88840
commit 0635976606

View File

@ -665,7 +665,15 @@ status_t
AttributeFile::RemoveAttributeFile(fs_volume *overlay, fs_volume *volume,
fs_vnode *vnode)
{
if (fAttributeDirInode == 0 || fAttributeFileInode == 0) {
bool hasAttributeFile = fAttributeFileInode != 0;
ino_t attributeDirInode = fAttributeDirInode;
// invalidate all of our cached inode numbers
fDirectoryInode = 0;
fAttributeDirInode = 0;
fAttributeFileInode = 0;
if (!hasAttributeFile) {
// there is no backing file at all yet
return B_OK;
}
@ -680,7 +688,7 @@ AttributeFile::RemoveAttributeFile(fs_volume *overlay, fs_volume *volume,
}
OverlayInode *overlayInode = NULL;
result = get_vnode(overlay, fAttributeDirInode, (void **)&overlayInode);
result = get_vnode(overlay, attributeDirInode, (void **)&overlayInode);
if (result != B_OK) {
TRACE_ALWAYS("getting attribute directory vnode failed: %s\n",
strerror(result));
@ -690,18 +698,18 @@ AttributeFile::RemoveAttributeFile(fs_volume *overlay, fs_volume *volume,
fs_vnode attributeDir = *overlayInode->SuperVnode();
if (attributeDir.ops->unlink == NULL) {
TRACE_ALWAYS("cannot remove attribute file, unlink hook missing\n");
put_vnode(volume, fAttributeDirInode);
put_vnode(volume, attributeDirInode);
return B_UNSUPPORTED;
}
result = attributeDir.ops->unlink(volume, &attributeDir, nameBuffer);
if (result != B_OK) {
TRACE_ALWAYS("failed to unlink attribute file: %s\n", strerror(result));
put_vnode(volume, fAttributeDirInode);
put_vnode(volume, attributeDirInode);
return result;
}
put_vnode(volume, fAttributeDirInode);
put_vnode(volume, attributeDirInode);
return B_OK;
}