dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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