From 1156d4846485e5b8bfdbdbd10f7e705376eb5766 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Tue, 10 Mar 2026 13:49:47 +0100 Subject: [PATCH] Fix spurious 'not mounted' error on FUSE3 shutdown In FUSE3 mode, pfs_do_stop called fuse_unmount followed by fuse_exit. The FUSE thread then called fuse_destroy, which tried to unmount again, producing "fusermount3: not mounted". For FUSE3, fuse_exit is sufficient to stop the loop; fuse_destroy handles the unmount. Restrict the explicit fuse_unmount call to FUSE2 only. Co-Authored-By: Claude Sonnet 4.6 --- pclsync/pfs.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/pclsync/pfs.c b/pclsync/pfs.c index e167127..d163eab 100644 --- a/pclsync/pfs.c +++ b/pclsync/pfs.c @@ -3616,29 +3616,15 @@ static void pfs_do_stop(void) { if (started == 1) { char *mp; - struct stat st_before, st_after; struct timespec ts = {0, 100000000}; mp = psync_fuse_get_mountpoint(); +#if FUSE_USE_VERSION < 30 if (mp) { + struct stat st_before; if (stat(mp, &st_before) == 0) { -#if FUSE_USE_VERSION >= 30 - fuse_unmount(psync_fuse); -#else fuse_unmount(mp, psync_fuse_channel); psync_fuse_channel = NULL; -#endif - clock_gettime(CLOCK_REALTIME, &ts); - - // Check if the mountpoint is still accessible - if (stat(mp, &st_after) == 0) { - if (st_before.st_dev == st_after.st_dev) { - pdbg_logf(D_WARNING, "FUSE filesystem may not have unmounted properly"); - } - } else if (errno != ENOENT) { - pdbg_logf(D_WARNING, "Unexpected error after unmount: %s", - strerror(errno)); - } } else { pdbg_logf(D_WARNING, "Mountpoint not accessible before unmount: %s", strerror(errno)); @@ -3646,6 +3632,7 @@ static void pfs_do_stop(void) { } else { pdbg_logf(D_ERROR, "Failed to get mountpoint"); } +#endif pdbg_logf(D_NOTICE, "running fuse_exit"); fuse_exit(psync_fuse);