bfs_free_cookie() now always write locks the inode - before it only hold a read lock
which wasn't enough when tampering with the inode's data, and it also acquired that lock too late. Thanks to Stefano for pointing this out. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20079 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1254,6 +1254,8 @@ bfs_free_cookie(void *_ns, void *_node, void *_cookie)
|
|||||||
Volume *volume = (Volume *)_ns;
|
Volume *volume = (Volume *)_ns;
|
||||||
Inode *inode = (Inode *)_node;
|
Inode *inode = (Inode *)_node;
|
||||||
|
|
||||||
|
WriteLocked locked(inode->Lock());
|
||||||
|
|
||||||
bool needsTrimming = inode->NeedsTrimming();
|
bool needsTrimming = inode->NeedsTrimming();
|
||||||
|
|
||||||
if ((cookie->open_mode & O_RWMASK) != 0
|
if ((cookie->open_mode & O_RWMASK) != 0
|
||||||
@@ -1261,7 +1263,6 @@ bfs_free_cookie(void *_ns, void *_node, void *_cookie)
|
|||||||
&& (needsTrimming
|
&& (needsTrimming
|
||||||
|| inode->OldLastModified() != inode->LastModified()
|
|| inode->OldLastModified() != inode->LastModified()
|
||||||
|| inode->OldSize() != inode->Size())) {
|
|| inode->OldSize() != inode->Size())) {
|
||||||
ReadLocked locked(inode->Lock());
|
|
||||||
|
|
||||||
// trim the preallocated blocks and update the size,
|
// trim the preallocated blocks and update the size,
|
||||||
// and last_modified indices if needed
|
// and last_modified indices if needed
|
||||||
|
|||||||
Reference in New Issue
Block a user