[FOR INTERNAL REVIEW] [PATCH 2/4] staging: erofs: fix superblock/inode flags (MS_RDONLY -> SB_RDONLY, S_NOATIME)

Gao Xiang gaoxiang25 at huawei.com
Mon Jul 30 19:18:29 AEST 2018


After commit 0a43a939c77e ("vfs: Suppress MS_* flag defs within
the kernel unless explicitly enabled"), there is no MS_RDONLY
and MS_NOATIME at all.

Reported-by: Stephen Rothwell <sfr at canb.auug.org.au>
Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
---

- Tested with images generated by mkfs.erofs:
   1) mount and unmount operations
   2) md5sum `find . -type f`
 
 drivers/staging/erofs/inode.c | 6 ++++++
 drivers/staging/erofs/super.c | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/erofs/inode.c b/drivers/staging/erofs/inode.c
index fbf6ff2..809cbd0 100644
--- a/drivers/staging/erofs/inode.c
+++ b/drivers/staging/erofs/inode.c
@@ -242,6 +242,12 @@ struct inode *erofs_iget(struct super_block *sb,
 	if (inode->i_state & I_NEW) {
 		int err;
 		struct erofs_vnode *vi = EROFS_V(inode);
+
+		/*
+		 * no need to use 'inode_set_flags'
+		 * (see fuse_iget in fs/fuse/inode.c)
+		 */
+		inode->i_flags |= S_NOATIME;
 		vi->nid = nid;
 
 		err = fill_inode(inode, isdir);
diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c
index 1aec509..ae1eb20 100644
--- a/drivers/staging/erofs/super.c
+++ b/drivers/staging/erofs/super.c
@@ -340,7 +340,7 @@ static int erofs_read_super(struct super_block *sb,
 		goto err_sbread;
 
 	sb->s_magic = EROFS_SUPER_MAGIC;
-	sb->s_flags |= MS_RDONLY | MS_NOATIME;
+	sb->s_flags |= SB_RDONLY;
 	sb->s_maxbytes = MAX_LFS_FILESIZE;
 	sb->s_time_gran = 1;
 
@@ -627,7 +627,7 @@ static int erofs_remount(struct super_block *sb, int *flags, char *data)
 {
 	BUG_ON(!sb_rdonly(sb));
 
-	*flags |= MS_RDONLY;
+	*flags |= SB_RDONLY;
 	return 0;
 }
 
-- 
1.9.1



More information about the Linux-erofs mailing list