dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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