Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

#4956 assigned defect

Deadlock caused by locking inversion in JFFS2

Reported by: Kinsey Moore Owned by: Kinsey Moore
Priority: normal Milestone: 6.1
Component: admin Version:
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

When the code for delayed writes was added to support JFFS2 on NAND, it introduced a possible locking inversion when managing the delayed write work queue.

This has been partially addressed by fa85760c99a72b8186c70c896b98efe0d7cde2b6, but there are other issues with this code that need to be addressed as well.

First is that when not compiling with RTEMS_DEBUG, nodes are not automatically set as off the chain upon extraction and this behavior is depended upon.

Second is that protected (ISR-locked) chain calls are used when they are not necessary due to already being locked.

Third is that the bug fixed by the referenced commit needs a test that verifies the fix.

Change History (4)

comment:1 Changed on 09/26/23 at 00:41:07 by z.ling111

Hey i'm interested working on this ticket would the nodes be set off only if

#if defined(RTEMS_DEBUG) is true? I can't find other functions that call this so i can't confirm. I think i'm going to try to work on the first part.

comment:2 Changed on 09/26/23 at 13:16:46 by Kinsey Moore

Hey, thanks for the interest. I actually have a patch on the mailing list that just got approved for fixing this, so it should be going into the codebase shortly. I still need to write a test that produces the original issue, though.

comment:3 Changed on 09/26/23 at 13:38:00 by Kinsey Moore <kinsey.moore@…>

In [changeset:"99c637fbd973a3d2f6e5adf38aac8f3f588cbb7e/rtems" 99c637f/rtems]:

cpukit/jffs2: Avoid use of off-chain semantics

This reworks the JFFS2 delayed work queue to avoid use of
on-chain/off-chain semantics since they vary in behavior under
RTEMS_DEBUG and are not guaranteed to be safe to use in SMP systems.
This adds all delayed work structs to the chain on FS init and does not
remove them until umount.

Updates #4956

comment:4 Changed on 02/16/24 at 00:35:11 by Kinsey Moore

Owner: set to Kinsey Moore
Status: newassigned
Note: See TracTickets for help on using tickets.