summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKinsey Moore <kinsey.moore@oarcorp.com>2024-03-08 23:04:54 -0600
committerJoel Sherrill <joel@rtems.org>2024-03-14 17:13:23 -0500
commit1ecb4e3047a71b27093861970ac62038bc599eec (patch)
treeb2746ee74181f2c8ab4ee0d69ccaadf763d1af00
parentEnsure ticks per timeslice is greater than zero (diff)
downloadrtems-1ecb4e3047a71b27093861970ac62038bc599eec.tar.bz2
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().
-rw-r--r--cpukit/libfs/src/jffs2/src/fs-rtems.c4
1 files changed, 4 insertions, 0 deletions
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