f2fs: give RO message when recovering superblock
Subsystems (2)
Jaegeuk Kim
maintainerPATCH 1/1 f2fs: give RO message when recovering superblock
When one of superblocks is missing, f2fs recovers it with the valid one. But, even if f2fs is mounted as RO, we'd better notify that too.
--- fs/f2fs/super.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/f2fs/super.c +4 -1
@@ -1293,6 +1293,9 @@ int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover)struct buffer_head *bh;int err; +if (f2fs_readonly (sbi->sb) ||bdev_read_only (sbi->sb->s_bdev)) +return -EROFS ; +/* write back-up superblock first */ bh =sb_getblk (sbi->sb, sbi->valid_super_block ?0 :1 );if (!bh)
@@ -1560,7 +1563,7 @@ try_onemore:kfree (options);/* recover broken superblock */ -if (recovery && !f2fs_readonly (sb) && !bdev_read_only (sb->s_bdev)) { +if (recovery) { err =f2fs_commit_super (sbi, true); f2fs_msg(sb, KERN_INFO, "Try to recover %dth superblock, ret: %ld",
Signature · 1 line
2.6.3
Quoted 2 lines · Jaegeuk Kim
When one of superblocks is missing, f2fs recovers it with the valid one. But, even if f2fs is mounted as RO, we'd better notify that too.
(I have written this in my other mail, but in case you didn't see it, because it wasn't directly sent to you, I replied directly).
Basically all other filesystems do not treat "ro" as anything but as a vfs flag - the mounted volume will be readonly, but they will happily write to the volume for recovery or integrity purposes. This has been extensively discussed on lkml in the past and it was decided that overloading "ro" to have two different meanings is bad.
If f2fs wants to suppress writes, it should use the norecovery option to decide, not the ro option. This is the behaviour that other filesystems follow (at least extN, xfs).
Unless f2fs has a very good reason (which I don't think it has), it should behave like the other filesystems, and treat "ro" merely as a vfs flag to suppress writing.
There is a third reason to not change the meaning: typically, the root fs is mounted ro first and later rw. Therefore f2fs must make sure to have full integrity on a ro mount, even if that means writing to the backing store. It isn't acceptable to make ro mounts fail when rw mounts would work, for example, when upgrading the kernel and rebooting.
Signature · 13 lines
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / [email protected]
-=====/_/_//_/\_,_/ /_/\_\
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140