(In reply to Wenruo Qu from comment #9) > BTW, I also explored another solution, to allow mismatch in sb->s_flags and > fc->sb_flags, then reconfigure. > This methods avoid the brute force retry loop, and use proper rwsem to > prevent race in theory. > > But it just doesn't work. > > If the fs is initially mounted RO, a new RW open on the same device will > return -EINVAL, thus rejecting the mount way earlier before we can get a > proper super block to continue. > > That's why we're risking the race by retry without a proper sb lock to hold. What an idiot I am, I'm using a wrong script to test, thus mounting a wrong device, no wonder device scan failed, it's not related to the flag. I'll do more testing to make sure if we can go the new solution.