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

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