Zhe Li 64c7497915 jffs2: Fix GC exit abnormally
The log of this problem is:
jffs2: Error garbage collecting node at 0x***!
jffs2: No space for garbage collection. Aborting GC thread

This is because GC believe that it do nothing, so it abort.

After going over the image of jffs2, I find a scene that
can trigger this problem stably.
The scene is: there is a normal dirent node at summary-area,
but abnormal at corresponding not-summary-area with error
name_crc.

The reason that GC exit abnormally is because it find that
abnormal dirent node to GC, but when it goes to function
jffs2_add_fd_to_list, it cannot meet the condition listed
below:

if ((*prev)->nhash == new->nhash && !strcmp((*prev)->name, new->name))

So no node is marked obsolete, statistical information of
erase_block do not change, which cause GC exit abnormally.

The root cause of this problem is: we do not check the
name_crc of the abnormal dirent node with summary is enabled.

Noticed that in function jffs2_scan_dirent_node, we use
function jffs2_scan_dirty_space to deal with the dirent
node with error name_crc. So this patch add a checking
code in function read_direntry to ensure the correctness
of dirent node. If checked failed, the dirent node will
be marked obsolete so GC will pass this node and this
problem will be fixed.

Cc: <stable@vger.kernel.org>
Signed-off-by: Zhe Li <lizhe67@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
2023-01-12 08:16:30 +01:00
2021-10-13 14:45:37 -05:00
2023-01-12 08:16:30 +01:00
2020-10-10 13:50:41 +02:00
2022-06-21 09:32:16 +02:00
2013-09-19 13:16:06 +02:00
2020-04-27 11:35:21 +10:00
2022-11-11 11:58:05 -07:00

Real-Time Executive for Multiprocessing Systems (RTEMS)
-------------------------------------------------------

RTEMS, Real-Time Executive for Multiprocessor Systems, is a real-time executive
(kernel) which provides a high performance environment for embedded
applications with the following features:

 - standards based user interfaces
 - multitasking capabilities
 - homogeneous and heterogeneous multiprocessor systems
 - event-driven, priority-based, preemptive scheduling
 - optional rate monotonic scheduling
 - intertask communication and synchronization
 - priority inheritance
 - responsive interrupt management
 - dynamic memory allocation
 - high level of user configurability
 - open source with a friendly user license

Project git repositories are located at https://git.rtems.org/

 RTEMS Kernel:        : https://git.rtems.org/rtems/
 RTEMS Source Builder : https://git.rtems.org/rtems-source-builder/
 RTEMS Tools          : https://git.rtems.org/rtems-tools/
 RTEMS Documentation  : https://git.rtems.org/rtems-docs/
 RTEMS FreeBSD        : https://git.rtems.org/rtems-libbsd/

Online documentation is available at https://docs.rtems.org/

 RTEMS User Manual : https://docs.rtems.org/branches/master/user/index.html
 RTEMS RSB Manual  : https://docs.rtems.org/branches/master/rsb/index.html
 RTEMS Classic API : https://docs.rtems.org/branches/master/c-user/index.html
 RTEMS POSIX API   : https://docs.rtems.org/branches/master/posix-users/index.html

RTEMS Doxygen for CPUKit : https://docs.rtems.org/doxygen/branches/master/

RTEMS POSIX 1003.1 Compliance Guide :
 https://docs.rtems.org/branches/master/posix-compliance/index.html

 - Details the standards base functionality and profiles RTEMS supportsXo

RTEMS Developers Wiki : http://devel.rtems.org

 - Bug reporting, community knowledge and tutorials.

RTEMS Mailing Lists : https://lists.rtems.org/mailman/listinfo

 - The RTEMS Project maintains mailing lists which are used for most
   discussions:

   * For general-purpose questions related to using RTEMS, use the rtems-users
     ml: https://lists.rtems.org/mailman/listinfo/users

   * For questions and discussion related to development of RTEMS, use the
     rtems-devel ml: https://lists.rtems.org/mailman/listinfo/devel

The version number for this software is indicated in the VERSION file.
Description
RTEMS is a ​real-time executive in use by embedded systems applications around the world and beyond
Readme 126 MiB
Languages
C 93.9%
Assembly 3.4%
Ada 1.4%
Python 0.3%
HTML 0.3%
Other 0.4%