diff options
author | Peri <peri@srdi.org> | 2023-05-11 02:38:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-11 02:38:46 +0100 |
commit | bb1890afd7d1eb33e95f36d1d9936dbd574260b6 (patch) | |
tree | 9c5d13d913e6dcd0fab15b8970c8805620305e81 /lib | |
parent | fcd293f675fc7bfa0522186c5d68ef932eec6945 (diff) | |
download | libfuse-bb1890afd7d1eb33e95f36d1d9936dbd574260b6.tar.gz |
Fix issue #746. (#782)
Added a secondary check in fuse_lib_unlink() after hide_node()
to check again under a lock if the (now hidden) file is still open.
If not then delete it.
This should synchronise fuse_lib_unlink() with fuse_lib_release(),
when nullpath_ok is set.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fuse.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -2967,6 +2967,20 @@ static void fuse_lib_unlink(fuse_req_t req, fuse_ino_t parent, fuse_prepare_interrupt(f, req, &d); if (!f->conf.hard_remove && is_open(f, parent, name)) { err = hide_node(f, path, parent, name); + if (!err) { + /* we have hidden the node so now check again under a lock in case it is not used any more */ + if (!is_open(f, parent, wnode->name)) { + char *unlinkpath; + + /* get the hidden file path, to unlink it */ + if (try_get_path(f, wnode->nodeid, NULL, &unlinkpath, NULL, false) == 0) { + err = fuse_fs_unlink(f->fs, unlinkpath); + if (!err) + remove_node(f, parent, wnode->name); + free(unlinkpath); + } + } + } } else { err = fuse_fs_unlink(f->fs, path); if (!err) |