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().
This commit is contained in:
Kinsey Moore
2024-03-08 23:04:54 -06:00
committed by Joel Sherrill
parent 5ee87eee8a
commit 1ecb4e3047

View File

@@ -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