tests/g-file-info-filesystem-readonly: unmount lazily

fusermount -z behaves like umount --lazy, which is documented thus:

> Detach the filesystem from the file hierarchy now, and clean up all
> references to this filesystem as soon as it is not busy anymore.

Without this, the call to `fusermount -u` often fails with:

  /usr/bin/fusermount: failed to unmount /home/wjt/src/gnome/glib/_build/dir_bindfs_mountpoint: Device or resource busy

which causes the subsequent call to bindfs to fail:

  fuse: mountpoint is not empty
  fuse: if you are sure this is safe, use the 'nonempty' mount option

It's not clear what is causing the mount to be busy. Inserting a
g_usleep (100 * 1000) before the calls to `fusermount -u` also works to
make the problem go away, but for the purposes of this test the
important point is that the mount is detached from the directory, for
which a lazy unmount is fine.

Fixes #1590.
This commit is contained in:
Will Thompson 2018-11-12 14:46:34 +00:00
parent 3821ba06b1
commit 5b106cdc56
No known key found for this signature in database
GPG Key ID: 3422DC0D7AD482A7

View File

@ -130,7 +130,7 @@ test_filesystem_readonly (gconstpointer with_mount_monitor)
}
/* Now we unmount, and mount again but this time rw (not readonly) */
run (&error, fusermount, "-u", dir_mountpoint, NULL);
run (&error, fusermount, "-z", "-u", dir_mountpoint, NULL);
g_assert_no_error (error);
run (&error, bindfs, "-n", dir_to_mount, dir_mountpoint, NULL);
g_assert_no_error (error);
@ -169,7 +169,7 @@ test_filesystem_readonly (gconstpointer with_mount_monitor)
g_clear_object (&mount_monitor);
g_clear_object (&file_info);
g_clear_object (&mounted_file);
run (&error, fusermount, "-u", dir_mountpoint, NULL);
run (&error, fusermount, "-z", "-u", dir_mountpoint, NULL);
g_assert_no_error (error);
assert_remove (file_in_mount);