[linux-yocto] [PATCH 1/1] yaffs2: Add patch to fix missing checkpoint

zhe.he at windriver.com zhe.he at windriver.com
Thu Dec 10 01:36:35 PST 2015


From: He Zhe <zhe.he at windriver.com>

Signed-off-by: He Zhe <zhe.he at windriver.com>
---
 .../yaffs2-fix-missing-checkpoint-on-yaffs.patch   | 85 ++++++++++++++++++++++
 features/yaffs2/yaffs2.scc                         |  1 +
 2 files changed, 86 insertions(+)
 create mode 100644 features/yaffs2/yaffs2-fix-missing-checkpoint-on-yaffs.patch

diff --git a/features/yaffs2/yaffs2-fix-missing-checkpoint-on-yaffs.patch b/features/yaffs2/yaffs2-fix-missing-checkpoint-on-yaffs.patch
new file mode 100644
index 0000000..cd7cc58
--- /dev/null
+++ b/features/yaffs2/yaffs2-fix-missing-checkpoint-on-yaffs.patch
@@ -0,0 +1,85 @@
+From fcdadf7cdb9659c76808ff5fc2f105c56436e6a8 Mon Sep 17 00:00:00 2001
+From: He Zhe <zhe.he at windriver.com>
+Date: Wed, 2 Dec 2015 01:31:31 -0500
+Subject: [PATCH] fs/yaffs2: fix missing checkpoint on yaffs
+
+For yaffs file system, the mode of reading or writing is restricted at
+four pointer where are mnt->mnt_flags,mnt->mnt_sb->s_flags,mtd->flags
+and dev->read_only,the first three is used handle file and file
+system(eg,remount) operation, and last one(dev->read_only) almost is used
+handle checkpoint of yaffs2. However, in current code, the dev->read_only
+only can be changed at first time when the yaffs2 file system is mounted,
+later it can't be changed again(eg,mount -o remount), the result is that
+the checkpoint's saving operation always can't succeed if you set readonly
+mode for yaffs2 file system when it is mounted at the first time.
+
+To fix this issue, we implement yaffs_remount_fs() which allows the
+rootfs to be remounted as r/w.
+
+Signed-off-by: Wenlin Kang <wenlin.kang at windriver.com>
+Signed-off-by: He Zhe <zhe.he at windriver.com>
+---
+ fs/yaffs2/yaffs_vfs.c | 39 +++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 39 insertions(+)
+
+diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c
+index 52177c1..16251d5 100644
+--- a/fs/yaffs2/yaffs_vfs.c
++++ b/fs/yaffs2/yaffs_vfs.c
+@@ -2614,7 +2614,45 @@ static int yaffs_sync_fs(struct super_block *sb)
+ 	return 0;
+ }
+ 
++/* the function only is used to change dev->read_only when this file system
++ * is remounted.
++ */
++static int yaffs_remount_fs(struct super_block *sb, int *flags, char *data)
++{
++	int read_only = 0;
++	struct mtd_info *mtd;
++	struct yaffs_dev *dev = 0;
++
++	/* Get the device */
++	mtd = get_mtd_device(NULL, MINOR(sb->s_dev));
++	if (!mtd) {
++		yaffs_trace(YAFFS_TRACE_ALWAYS,
++			"MTD device #%u doesn't appear to exist",
++			MINOR(sb->s_dev));
++		return 1;
++	}
+ 
++	/* Check it's NAND */
++	if (mtd->type != MTD_NANDFLASH) {
++		yaffs_trace(YAFFS_TRACE_ALWAYS,
++			"MTD device is not NAND it's type %d",
++			mtd->type);
++		return 1;
++	}
++
++	read_only = ((*flags & MS_RDONLY) != 0);
++	if (!read_only && !(mtd->flags & MTD_WRITEABLE)) {
++		read_only = 1;
++		printk(KERN_INFO
++		       "yaffs: mtd is read only, setting superblock read only");
++		*flags |= MS_RDONLY;
++	}
++
++	dev = sb->s_fs_info;
++	dev->read_only = read_only;
++
++	return 0;
++}
+ 
+ static const struct super_operations yaffs_super_ops = {
+ 	.statfs = yaffs_statfs,
+@@ -2636,6 +2674,7 @@ static const struct super_operations yaffs_super_ops = {
+ #ifdef YAFFS_HAS_WRITE_SUPER
+ 	.write_super = yaffs_write_super,
+ #endif
++	.remount_fs = yaffs_remount_fs,
+ };
+ 
+ struct yaffs_options {
+-- 
+1.9.1
+
diff --git a/features/yaffs2/yaffs2.scc b/features/yaffs2/yaffs2.scc
index 2026f71..07e2653 100644
--- a/features/yaffs2/yaffs2.scc
+++ b/features/yaffs2/yaffs2.scc
@@ -13,3 +13,4 @@ patch yaffs2-switch-simple-generic_file_aio_read-users-to-.patch
 patch yaffs2-use-write_iter-variants-of-__-generic_file_ai.patch
 patch yaffs2-implement-splice_write-via-write_iter.patch
 patch yaffs2-fix-memory-leak-in-mount-umount.patch
+patch yaffs2-fix-missing-checkpoint-on-yaffs.patch
-- 
2.3.5



More information about the linux-yocto mailing list