HomeFreeBSD

1) Fix a deadlock in the VFS:
rS186197Unpublished

Unpublished Commit ยท Learn More

No further details are available.

Description

  1. Fix a deadlock in the VFS:
  2. threadA runs vfs_rel(mp1)
  3. threadB does unmount the mp1 fs, sets MNTK_UNMOUNT and drop MNT_ILOCK()
  4. threadA runs vfs_busy(mp1) and, as long as, MNTK_UNMOUNT is set, sleeps waiting for threadB to complete the unmount
  5. threadB, in vfs_mount_destroy(), finds mnt_lock > 0 and sleeps waiting for the refcount to expire.

Fix the deadlock by adding a flag called MNTK_REFEXPIRE which signals the
unmounter is waiting for mnt_ref to expire.
The vfs_busy contenders got awake, fails, and if they retry the
MNTK_REFEXPIRE won't allow them to sleep again.

  1. Simplify significantly the code of vfs_mount_destroy() trimming unnecessary codes:
    • as long as any reference exited, it is no-more possible to have write-op (primarty and secondary) in progress.
    • it is no needed to drop and reacquire the mount lock.
    • filling the structures with dummy values is unuseful as long as it is going to be freed.

Tested by: pho, Andrea Barberio <insomniac at slackware dot it>
Discussed with: kib

Details

Event Timeline