Skip to content

Commit

Permalink
Address ZFS race condition
Browse files Browse the repository at this point in the history
This change adds a patch that reverts a change to the Linux kernel that
was intended to clean-up some internal behavior. Unfortunately, ZFS
currently relies on this behavior to perform correctly.

Without this patch, zvol links might not be created correctly due to a
race condition.

See #183 for more information about this issue.
  • Loading branch information
fabianishere committed Nov 8, 2021
1 parent 9614ffe commit 23230a1
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From 92557ee787b409ab4e0cec33d13b483ef80e6d6e Mon Sep 17 00:00:00 2001
From: Fabian Mastenbroek <[email protected]>
Date: Mon, 8 Nov 2021 17:16:32 +0100
Subject: [PATCH] Revert "block: remove the -ERESTARTSYS handling in
blkdev_get_by_dev"

This reverts commit a8ed1a0607cfa5478ff6009539f44790c4d0956d.
---
block/bdev.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/block/bdev.c b/block/bdev.c
index 485a258b0ab3..f93165f05987 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -800,6 +800,10 @@ struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode, void *holder)
if (ret)
return ERR_PTR(ret);

+ /*
+ * If we lost a race with 'disk' being deleted, try again. See md.c.
+ */
+retry:
bdev = blkdev_get_no_open(dev);
if (!bdev)
return ERR_PTR(-ENXIO);
@@ -852,6 +856,8 @@ struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode, void *holder)
disk_unblock_events(disk);
put_blkdev:
blkdev_put_no_open(bdev);
+ if (ret == -ERESTARTSYS)
+ goto retry;
return ERR_PTR(ret);
}
EXPORT_SYMBOL(blkdev_get_by_dev);
--
2.33.1

1 change: 1 addition & 0 deletions debian/patches/series.linux
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ pve/0002-bridge-keep-MAC-of-first-assigned-port.patch
pve/0003-pci-Enable-overrides-for-missing-ACS-capabilities-4..patch
pve/0004-kvm-disable-default-dynamic-halt-polling-growth.patch
pve/0005-net-core-downgrade-unregister_netdevice-refcount-lea.patch
pve/0006-Revert-block-remove-the-ERESTARTSYS-handling-in-blkd.patch

0 comments on commit 23230a1

Please sign in to comment.