BFS: Send live-query rename/move notifications along with node monitor.

Otherwise, we send them out before the file is actually renamed,
and so we could send notifications with stale name values in them
(in the case of B_ENTRY_CREATED and B_ENTRY_REMOVED), or before
the file's name actually changed as visible in stat(). This way,
we send the notification only after updating the entries.
This commit is contained in:
Augustin Cavalier
2026-04-09 15:21:46 -04:00
parent da1768c354
commit bc415d41f1
@@ -1271,16 +1271,13 @@ bfs_rename(fs_volume* _volume, fs_vnode* _oldDir, const char* oldName,
inode->WriteLockInTransaction(transaction);
volume->UpdateLiveQueriesRenameMove(inode, oldDirectory->ID(), oldName,
newDirectory->ID(), newName);
// update the name only when they differ
if (strcmp(oldName, newName)) {
status = inode->SetName(transaction, newName);
if (status == B_OK) {
Index index(volume);
index.UpdateName(transaction, oldName, newName, inode,
false /* we already updated live queries, above */);
false /* we'll notify live queries when finished */);
}
}
@@ -1321,6 +1318,8 @@ bfs_rename(fs_volume* _volume, fs_vnode* _oldDir, const char* oldName,
if (status == B_OK) {
notify_entry_moved(volume->ID(), oldDirectory->ID(),
oldName, newDirectory->ID(), newName, id);
volume->UpdateLiveQueriesRenameMove(inode, oldDirectory->ID(), oldName,
newDirectory->ID(), newName);
return B_OK;
}