dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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