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

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to