• Colin Ian King's avatar
    UBUNTU: SAUCE: (noup) zfs to 0.6.5.6-0ubuntu25 · dfbc4d40
    Colin Ian King authored
    BugLink: http://bugs.launchpad.net/bugs/1781364
    
    This is a sync of zfs 0.6.5.6-0ubuntu25 that fixes a mount/umount deadlock
    for upstream ZFS commit ac09630d8b0b ("Fix zpl_mount() deadlock")
    
    ZFS commit 93b43af inadvertently introduced the following scenario which
    can result in a deadlock.  This issue was most easily reproduced by
    LXD containers using a ZFS storage backend but should be reproducible
    under any workload which is frequently mounting and unmounting.
    
    -- THREAD A --
    spa_sync()
      spa_sync_upgrades()
        rrw_enter(&dp->dp_config_rwlock, RW_WRITER, FTAG); <- Waiting on B
    
    -- THREAD B --
    mount_fs()
      zpl_mount()
        zpl_mount_impl()
          dmu_objset_hold()
            dmu_objset_hold_flags()
              dsl_pool_hold()
                dsl_pool_config_enter()
                  rrw_enter(&dp->dp_config_rwlock, RW_READER, tag);
        sget()
          sget_userns()
            grab_super()
              down_write(&s->s_umount); <- Waiting on C
    
    -- THREAD C --
    cleanup_mnt()
      deactivate_super()
        down_write(&s->s_umount);
        deactivate_locked_super()
          zpl_kill_sb()
            kill_anon_super()
              generic_shutdown_super()
                sync_filesystem()
                  zpl_sync_fs()
                    zfs_sync()
                      zil_commit()
                        txg_wait_synced() <- Waiting on A
    Signed-off-by: default avatarBrian Behlendorf <behlendorf1@llnl.gov>
    (backport from ZFS upstream commit ac09630d8b0bf6c92084a30fdaefd03fd0adbdc1)
    Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
    Acked-by: default avatarStefan Bader <stefan.bader@canonical.com>
    Acked-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
    Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
    dfbc4d40
META 169 Bytes