dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/0034-imsm-close-removed-drive-fd.patch

f5dd7b
From 91c97c5432028875db5f8abeddb5cb5f31902001 Mon Sep 17 00:00:00 2001
f5dd7b
From: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
f5dd7b
Date: Mon, 15 Jul 2019 09:25:35 +0200
f5dd7b
Subject: [RHEL7.8 PATCH V2 34/47] imsm: close removed drive fd.
f5dd7b
f5dd7b
When member drive fails, managemon prepares metadata update and adds
f5dd7b
the drive to disk_mgmt_list with DISK_REMOVE flag. It fills only
f5dd7b
minor and major. It is enough to recognize the device later.
f5dd7b
f5dd7b
Monitor thread while processing this update will remove the drive from
f5dd7b
super only if it is a spare. It never removes failed member from
f5dd7b
disks list. As a result, it still keeps opened descriptor to
f5dd7b
non-existing device.
f5dd7b
f5dd7b
If removed drive is not a spare fill fd in disk_cfg structure
f5dd7b
(prepared by managemon), monitor will close fd during freeing it.
f5dd7b
f5dd7b
Also set this drive fd to -1 in super to avoid double closing because
f5dd7b
monitor will close the fd (if needed) while replacing removed drive
f5dd7b
in array.
f5dd7b
f5dd7b
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
f5dd7b
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
f5dd7b
---
f5dd7b
 super-intel.c | 3 +++
f5dd7b
 1 file changed, 3 insertions(+)
f5dd7b
f5dd7b
diff --git a/super-intel.c b/super-intel.c
f5dd7b
index d7e8a65..a103a3f 100644
f5dd7b
--- a/super-intel.c
f5dd7b
+++ b/super-intel.c
f5dd7b
@@ -9200,6 +9200,9 @@ static int add_remove_disk_update(struct intel_super *super)
f5dd7b
 					remove_disk_super(super,
f5dd7b
 							  disk_cfg->major,
f5dd7b
 							  disk_cfg->minor);
f5dd7b
+				} else {
f5dd7b
+					disk_cfg->fd = disk->fd;
f5dd7b
+					disk->fd = -1;
f5dd7b
 				}
f5dd7b
 			}
f5dd7b
 			/* release allocate disk structure */
f5dd7b
-- 
f5dd7b
2.7.5
f5dd7b