[PATCH 1/2] cpukit/jffs2: Set extracted nodes off-chain
Kinsey Moore
kinsey.moore at oarcorp.com
Wed Sep 20 18:35:07 UTC 2023
The code here was developed under RTEMS_DEBUG=true which automatically
sets nodes off-chain upon extraction. Extraction does not set nodes
off-chain when not running under RTEMS_DEBUG=true. This code relies on
this behavior, so set nodes off-chain as needed.
Updates #4956
---
cpukit/libfs/src/jffs2/src/fs-rtems.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/cpukit/libfs/src/jffs2/src/fs-rtems.c b/cpukit/libfs/src/jffs2/src/fs-rtems.c
index 1a677c9772..36bada9a98 100644
--- a/cpukit/libfs/src/jffs2/src/fs-rtems.c
+++ b/cpukit/libfs/src/jffs2/src/fs-rtems.c
@@ -1268,6 +1268,7 @@ static void jffs2_remove_delayed_work(struct delayed_work *dwork)
rtems_chain_node* next_node = rtems_chain_next(node);
if (work == dwork) {
rtems_chain_extract(node);
+ rtems_chain_set_off_chain(node);
mutex_unlock(&delayed_work_mutex);
return;
}
@@ -1306,8 +1307,22 @@ static void process_delayed_work(void)
while (!rtems_chain_is_tail(&process_work_chain, node)) {
work = (struct delayed_work*) node;
rtems_chain_node* next_node = rtems_chain_next(node);
+
+ /*
+ * Don't leave extracted node exposed to other operations
+ * under RTEMS_DEBUG
+ */
+#ifdef RTEMS_DEBUG
+ mutex_lock(&delayed_work_mutex);
+#endif
rtems_chain_extract(node);
+#ifdef RTEMS_DEBUG
+ node->next = node;
+ mutex_unlock(&delayed_work_mutex);
+#endif
+
work->callback(&work->work);
+ rtems_chain_set_off_chain(node);
node = next_node;
}
}
--
2.39.2
More information about the devel
mailing list