drop -ERESTARTSYS handling in blkdev_get_by_dev patch

ZFS 2.1.2 handles this internally
(commit 16da688f2518526389e6bff8370684a1a2a1469c)

Originally-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-01-11 12:03:23 +01:00
parent 7c0c6c37b2
commit 72807eeeb0

View File

@ -1,40 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
Date: Tue, 9 Nov 2021 12:01:12 +0100
Subject: [PATCH] Revert "block: remove the -ERESTARTSYS handling in
blkdev_get_by_dev"
This reverts commit a8ed1a0607cfa5478ff6009539f44790c4d0956d.
It breaks ZFS sometimes:
https://github.com/openzfs/zfs/issues/12301#issuecomment-873303739
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
fs/block_dev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/block_dev.c b/fs/block_dev.c
index e4a80bd4ddf1..4a14d28dd923 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1436,6 +1436,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);
@@ -1482,6 +1486,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);