cPanel & WHM Version 92 has been released, and brings a slew of great updates. Take a look at what is included, and then upgrade today!

VirtFS unmount should use MNT_DETACH as default to work with AWS EFS and FUSE file systems

Grace shared this idea 5 years ago
Open Discussion

The VirtFS unmount command currently uses the "FORCE" option as primary and "DETACH" as secondary. This has 3 issues:

a. FUSE filesystem such as ObjectiveFS (which is bind mounted) with user's home directory attached will be detached unintentionally

b. If used with AWS (NFSv4), this could cause data loss. (see man page notes below)

c. Since the "FORCE" option always succeeds, the "DETACH" path of this code is never used.

I'd like to propose using the lazy unmount option "DETACH" as primary, and only use "FORCE" as secondary if "DETACH" fails. The proposed fix addresses all 3 issues above.

A: Details:

On line 595-596 of /usr/local/cpanel/Cpanel/Filesys/Virtfs.pm, subroutine "_umount_user_virtfs":

Current:

my $can_unmount = Cpanel::Mount::umount( $mp, $Cpanel::Mount::MNT_FORCE ) == 0

|| Cpanel::Mount::umount( $mp, $Cpanel::Mount::MNT_DETACH ) == 0;

Proposed Fix:

my $can_unmount = Cpanel::Mount::umount( $mp, $Cpanel::Mount::MNT_DETACH ) == 0

|| Cpanel::Mount::umount( $mp, $Cpanel::Mount::MNT_FORCE ) == 0;

B. According to "man 2 umount":

MNT_FORCE (since Linux 2.1.116)Force unmount even if busy. This can cause data loss. (Only for NFS mounts.)MNT_DETACH (since Linux 2.4.11)Perform a lazy unmount: make the mount point unavailable for new accesses, and actually perform the unmount when the mount point ceases to be busy.

C. Reference

  • internal case number: 190057 (filed May 29, 2015)
  • support ticket: 6566561 (filed May 26, 2015)