hc
2024-02-19 151fecfb72a0d602dfe79790602ef64b4e241574
kernel/fs/super.c
....@@ -906,6 +906,7 @@
906906 struct super_block *sb = fc->root->d_sb;
907907 int retval;
908908 bool remount_ro = false;
909
+ bool remount_rw = false;
909910 bool force = fc->sb_flags & SB_FORCE;
910911
911912 if (fc->sb_flags_mask & ~MS_RMT_MASK)
....@@ -922,7 +923,7 @@
922923 if (!(fc->sb_flags & SB_RDONLY) && bdev_read_only(sb->s_bdev))
923924 return -EACCES;
924925 #endif
925
-
926
+ remount_rw = !(fc->sb_flags & SB_RDONLY) && sb_rdonly(sb);
926927 remount_ro = (fc->sb_flags & SB_RDONLY) && !sb_rdonly(sb);
927928 }
928929
....@@ -952,6 +953,14 @@
952953 if (retval)
953954 return retval;
954955 }
956
+ } else if (remount_rw) {
957
+ /*
958
+ * We set s_readonly_remount here to protect filesystem's
959
+ * reconfigure code from writes from userspace until
960
+ * reconfigure finishes.
961
+ */
962
+ sb->s_readonly_remount = 1;
963
+ smp_wmb();
955964 }
956965
957966 if (fc->ops->reconfigure) {