Preserve open inode identity across workspace renames

This commit is contained in:
ms2k 2026-08-03 01:06:54 +09:00
commit 982395bb28

View file

@ -57,13 +57,12 @@ impl Filesystem for IgnoredWorkspace {
let result = if let Some(handle) = handle {
self.with_file(handle, |open| {
let stat = fstat(open.file.as_fd())?;
let path = self.path_for(inode)?;
self.attributes(&ResolvedEntry {
path,
backing: open.backing,
stat,
})
self.attributes_for_inode(inode, stat)
})
} else if let Some(open) = self.open_file_for_inode(inode) {
fstat(open.file.as_fd())
.map_err(Into::into)
.and_then(|stat| self.attributes_for_inode(inode, stat))
} else {
self.path_for(inode).and_then(|path| {
let snapshot = self.classifier.snapshot_for(&path);
@ -124,12 +123,7 @@ impl Filesystem for IgnoredWorkspace {
)?;
}
self.record_changed(open.backing, &open.path);
let path = self.path_for(inode)?;
self.attributes(&ResolvedEntry {
path,
backing: open.backing,
stat: fstat(open.file.as_fd())?,
})
self.attributes_for_inode(inode, fstat(open.file.as_fd())?)
};
let result = if let Some(handle) = handle {
self.with_file(handle, operation)
@ -914,6 +908,7 @@ impl Filesystem for IgnoredWorkspace {
handle,
Arc::new(OpenFile {
file,
inode: attributes.ino,
backing,
path,
access_mode: flags & libc::O_ACCMODE,