linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: fix to do sanity with enabled features in image
@ 2019-04-24  9:48 Chao Yu
  2019-04-28 13:38 ` Jaegeuk Kim
  2019-04-29 20:54 ` Ju Hyung Park
  0 siblings, 2 replies; 12+ messages in thread
From: Chao Yu @ 2019-04-24  9:48 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, chao, Chao Yu

This patch fixes to do sanity with enabled features in image, if
there are features kernel can not recognize, just fail the mount.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/f2fs/f2fs.h  | 13 +++++++++++++
 fs/f2fs/super.c |  9 +++++++++
 2 files changed, 22 insertions(+)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index f5ffc09705eb..15b640967e12 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -151,6 +151,19 @@ struct f2fs_mount_info {
 #define F2FS_FEATURE_VERITY		0x0400	/* reserved */
 #define F2FS_FEATURE_SB_CHKSUM		0x0800
 
+#define F2FS_ALL_FEATURES	(F2FS_FEATURE_ENCRYPT |			\
+				F2FS_FEATURE_BLKZONED |			\
+				F2FS_FEATURE_ATOMIC_WRITE |		\
+				F2FS_FEATURE_EXTRA_ATTR |		\
+				F2FS_FEATURE_PRJQUOTA |			\
+				F2FS_FEATURE_INODE_CHKSUM |		\
+				F2FS_FEATURE_FLEXIBLE_INLINE_XATTR |	\
+				F2FS_FEATURE_QUOTA_INO |		\
+				F2FS_FEATURE_INODE_CRTIME |		\
+				F2FS_FEATURE_LOST_FOUND |		\
+				F2FS_FEATURE_VERITY |			\
+				F2FS_FEATURE_SB_CHKSUM)
+
 #define __F2FS_HAS_FEATURE(raw_super, mask)				\
 	((raw_super->feature & cpu_to_le32(mask)) != 0)
 #define F2FS_HAS_FEATURE(sbi, mask)	__F2FS_HAS_FEATURE(sbi->raw_super, mask)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 4f8e9ab48b26..57f2fc6d14ba 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -2573,6 +2573,15 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi,
 		return 1;
 	}
 
+	/* check whether kernel supports all features */
+	if (le32_to_cpu(raw_super->feature) & (~F2FS_ALL_FEATURES)) {
+		f2fs_msg(sb, KERN_INFO,
+			"Unsupported feature:%u: supported:%u",
+			le32_to_cpu(raw_super->feature),
+			F2FS_ALL_FEATURES);
+		return 1;
+	}
+
 	/* check CP/SIT/NAT/SSA/MAIN_AREA area boundary */
 	if (sanity_check_area_boundary(sbi, bh))
 		return 1;
-- 
2.18.0.rc1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-07-29  7:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-24  9:48 [PATCH] f2fs: fix to do sanity with enabled features in image Chao Yu
2019-04-28 13:38 ` Jaegeuk Kim
2019-04-29 13:57   ` Chao Yu
2019-05-01  3:22     ` Jaegeuk Kim
2019-05-05  2:51       ` Chao Yu
2019-05-09  1:15         ` [f2fs-dev] " Chao Yu
2019-07-16 10:02           ` Chao Yu
2019-07-23  1:35             ` Jaegeuk Kim
2019-07-23  7:01               ` Chao Yu
2019-07-29  5:47                 ` Jaegeuk Kim
2019-07-29  7:09                   ` Chao Yu
2019-04-29 20:54 ` Ju Hyung Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).