[rtems commit] cpukit/jffs2: Properly commit JFFS2 data

Joel Sherrill joel at rtems.org
Thu Mar 14 22:13:27 UTC 2024


Module:    rtems
Branch:    master
Commit:    1ecb4e3047a71b27093861970ac62038bc599eec
Changeset: http://git.rtems.org/rtems/commit/?id=1ecb4e3047a71b27093861970ac62038bc599eec

Author:    Kinsey Moore <kinsey.moore at oarcorp.com>
Date:      Fri Mar  8 23:04:54 2024 -0600

cpukit/jffs2: Properly commit JFFS2 data

When unmounting a JFFS2 filesystem, any outstanding write buffers must
be flushed to disk. In some circumstances, these write buffers are
instantiated by a garbage collection pass and as such no inode number is
associated with it. Due to the way that JFFS2 processes these garbage
collection passes, a write buffer without any associated inodes will not
be flushed unless it is forced with jffs2_flush_wbuf_pad().

---

 cpukit/libfs/src/jffs2/src/fs-rtems.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cpukit/libfs/src/jffs2/src/fs-rtems.c b/cpukit/libfs/src/jffs2/src/fs-rtems.c
index 8191dffe53..029cba6618 100644
--- a/cpukit/libfs/src/jffs2/src/fs-rtems.c
+++ b/cpukit/libfs/src/jffs2/src/fs-rtems.c
@@ -579,6 +579,9 @@ static int rtems_jffs2_ioctl(
 			break;
 		case RTEMS_JFFS2_FORCE_GARBAGE_COLLECTION:
 			eno = -jffs2_garbage_collect_pass(&inode->i_sb->jffs2_sb);
+			if (!eno) {
+			  eno = -jffs2_flush_wbuf_pad(&inode->i_sb->jffs2_sb);
+			}
 			break;
 		default:
 			eno = EINVAL;
@@ -1066,6 +1069,7 @@ static void rtems_jffs2_fsunmount(rtems_filesystem_mount_table_entry_t *mt_entry
 	/* Flush any pending writes */
 	if (!sb_rdonly(&fs_info->sb)) {
 		jffs2_flush_wbuf_gc(c, 0);
+		jffs2_flush_wbuf_pad(c);
 	}
 #endif
 



More information about the vc mailing list