diff -Nru zfs-linux-0.6.5.6/debian/changelog zfs-linux-0.6.5.6/debian/changelog --- zfs-linux-0.6.5.6/debian/changelog 2018-06-25 13:31:14.000000000 +0000 +++ zfs-linux-0.6.5.6/debian/changelog 2018-07-12 08:18:24.000000000 +0000 @@ -1,3 +1,11 @@ +zfs-linux (0.6.5.6-0ubuntu25) xenial; urgency=medium + + * Fix zpl_mount() deadlock (LP: #1781364) + - Upstream ZFS fix ac09630d8b0b ("Fix zpl_mount() deadlock") + fixes deadlock on multiple parallelized mount/umounts + + -- Colin Ian King Thu, 12 Jul 2018 09:18:24 +0100 + zfs-linux (0.6.5.6-0ubuntu24) xenial; urgency=medium * Allow multiple mounts of zfs datasets (LP: #1759848) diff -Nru zfs-linux-0.6.5.6/debian/patches/3202-Fix-zpl_mount-deadlock.patch zfs-linux-0.6.5.6/debian/patches/3202-Fix-zpl_mount-deadlock.patch --- zfs-linux-0.6.5.6/debian/patches/3202-Fix-zpl_mount-deadlock.patch 1970-01-01 00:00:00.000000000 +0000 +++ zfs-linux-0.6.5.6/debian/patches/3202-Fix-zpl_mount-deadlock.patch 2018-07-12 08:18:24.000000000 +0000 @@ -0,0 +1,91 @@ +From ac09630d8b0bf6c92084a30fdaefd03fd0adbdc1 Mon Sep 17 00:00:00 2001 +From: Brian Behlendorf +Date: Wed, 11 Jul 2018 15:49:10 -0700 +Subject: [PATCH] Fix zpl_mount() deadlock +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +Commit 93b43af10 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 + +Reviewed by: Alek Pinchuk +Signed-off-by: Brian Behlendorf +Closes #7598 +Closes #7659 +Closes #7691 +Closes #7693 +--- + include/sys/zfs_vfsops.h | 1 + + module/zfs/zpl_super.c | 11 ++++++++++- + 2 files changed, 11 insertions(+), 1 deletion(-) + +Index: zfs-linux-0.6.5.6/include/sys/zfs_vfsops.h +=================================================================== +--- zfs-linux-0.6.5.6.orig/include/sys/zfs_vfsops.h ++++ zfs-linux-0.6.5.6/include/sys/zfs_vfsops.h +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + #include + + #ifdef __cplusplus +Index: zfs-linux-0.6.5.6/module/zfs/zpl_super.c +=================================================================== +--- zfs-linux-0.6.5.6.orig/module/zfs/zpl_super.c ++++ zfs-linux-0.6.5.6/module/zfs/zpl_super.c +@@ -467,8 +467,17 @@ zpl_mount_impl(struct file_system_type * + if (err) + return (ERR_PTR(-err)); + ++ /* ++ * The dsl pool lock must be released prior to calling sget(). ++ * It is possible sget() may block on the lock in grab_super() ++ * while deactivate_super() holds that same lock and waits for ++ * a txg sync. If the dsl_pool lock is held over over sget() ++ * this can prevent the pool sync and cause a deadlock. ++ */ ++ dsl_pool_rele(dmu_objset_pool(os), FTAG); + s = zpl_sget(fs_type, zpl_test_super, set_anon_super, flags, os); +- dmu_objset_rele(os, FTAG); ++ dsl_dataset_rele(dmu_objset_ds(os), FTAG); ++ + if (IS_ERR(s)) + return (ERR_CAST(s)); + diff -Nru zfs-linux-0.6.5.6/debian/patches/series zfs-linux-0.6.5.6/debian/patches/series --- zfs-linux-0.6.5.6/debian/patches/series 2018-06-25 13:31:14.000000000 +0000 +++ zfs-linux-0.6.5.6/debian/patches/series 2018-07-12 08:18:24.000000000 +0000 @@ -28,3 +28,4 @@ 2202-compat-0.7.0-BLKZNAME.patch 2203-Allow-mounting-datasets-more-than-once.patch 3100-remove-libzfs-module-timeout.patch +3202-Fix-zpl_mount-deadlock.patch