* bfs_fsync() now locks the inode as it must do.

* added a IsLocked() method to ReadLocked.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17057 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-04-10 21:09:39 +00:00
parent 357433e049
commit a4237b2a8e
2 changed files with 18 additions and 8 deletions
+11 -7
View File
@@ -1,12 +1,11 @@
/* Lock - simple semaphores, read/write lock implementation
* Roughly based on a Be sample code written by Nathan Schrenk.
*
* Copyright 2001-2006, Axel Dörfler, [email protected].
* This file may be used under the terms of the MIT License.
*/
#ifndef LOCK_H
#define LOCK_H
/* Lock - simple semaphores, read/write lock implementation
**
** Initial version by Axel Dörfler, [email protected]
** Roughly based on a Be sample code written by Nathan Schrenk.
**
** This file may be used under the terms of the OpenBeOS License.
*/
#include <KernelExport.h>
@@ -444,6 +443,11 @@ class ReadLocked {
fLock.Unlock();
}
status_t IsLocked()
{
return fStatus;
}
private:
ReadWriteLock &fLock;
status_t fStatus;
@@ -1,4 +1,4 @@
/* kernel_interface - file system interface to BeOS' vnode layer
/* kernel_interface - file system interface to Haiku's vnode layer
*
* Copyright 2001-2006, Axel Dörfler, [email protected].
* This file may be used under the terms of the MIT License.
@@ -657,6 +657,12 @@ bfs_fsync(void *_ns, void *_node)
return B_BAD_VALUE;
Inode *inode = (Inode *)_node;
ReadLocked locked(inode->Lock());
status_t status = locked.IsLocked();
if (status < B_OK)
RETURN_ERROR(status);
return inode->Sync();
}