Merge tag 'gfs2-v5.12-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2

Pull gfs2 fixes from Andreas Gruenbacher:
"Various gfs2 fixes"

* tag 'gfs2-v5.12-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2:
gfs2: bypass log flush if the journal is not live
gfs2: bypass signal_our_withdraw if no journal
gfs2: fix use-after-free in trans_drain
gfs2: make function gfs2_make_fs_ro() to void type

+22 -19
+5 -1
fs/gfs2/log.c
··· 998 998 while (!list_empty(head)) { 999 999 bd = list_first_entry(head, struct gfs2_bufdata, bd_list); 1000 1000 list_del_init(&bd->bd_list); 1001 + if (!list_empty(&bd->bd_ail_st_list)) 1002 + gfs2_remove_from_ail(bd); 1001 1003 kmem_cache_free(gfs2_bufdata_cachep, bd); 1002 1004 } 1003 1005 head = &tr->tr_databuf; 1004 1006 while (!list_empty(head)) { 1005 1007 bd = list_first_entry(head, struct gfs2_bufdata, bd_list); 1006 1008 list_del_init(&bd->bd_list); 1009 + if (!list_empty(&bd->bd_ail_st_list)) 1010 + gfs2_remove_from_ail(bd); 1007 1011 kmem_cache_free(gfs2_bufdata_cachep, bd); 1008 1012 } 1009 1013 } ··· 1036 1032 * Do this check while holding the log_flush_lock to prevent new 1037 1033 * buffers from being added to the ail via gfs2_pin() 1038 1034 */ 1039 - if (gfs2_withdrawn(sdp)) 1035 + if (gfs2_withdrawn(sdp) || !test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) 1040 1036 goto out; 1041 1037 1042 1038 /* Log might have been flushed while we waited for the flush lock */
+1 -3
fs/gfs2/ops_fstype.c
··· 1539 1539 return -EINVAL; 1540 1540 1541 1541 if (fc->sb_flags & SB_RDONLY) { 1542 - error = gfs2_make_fs_ro(sdp); 1543 - if (error) 1544 - errorfc(fc, "unable to remount read-only"); 1542 + gfs2_make_fs_ro(sdp); 1545 1543 } else { 1546 1544 error = gfs2_make_fs_rw(sdp); 1547 1545 if (error)
+2 -8
fs/gfs2/super.c
··· 587 587 * Returns: errno 588 588 */ 589 589 590 - int gfs2_make_fs_ro(struct gfs2_sbd *sdp) 590 + void gfs2_make_fs_ro(struct gfs2_sbd *sdp) 591 591 { 592 - int error = 0; 593 592 int log_write_allowed = test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags); 594 593 595 594 gfs2_flush_delete_work(sdp); ··· 623 624 624 625 if (!log_write_allowed) 625 626 sdp->sd_vfs->s_flags |= SB_RDONLY; 626 - 627 - return error; 628 627 } 629 628 630 629 /** ··· 634 637 static void gfs2_put_super(struct super_block *sb) 635 638 { 636 639 struct gfs2_sbd *sdp = sb->s_fs_info; 637 - int error; 638 640 struct gfs2_jdesc *jd; 639 641 640 642 /* No more recovery requests */ ··· 654 658 spin_unlock(&sdp->sd_jindex_spin); 655 659 656 660 if (!sb_rdonly(sb)) { 657 - error = gfs2_make_fs_ro(sdp); 658 - if (error) 659 - gfs2_io_error(sdp); 661 + gfs2_make_fs_ro(sdp); 660 662 } 661 663 WARN_ON(gfs2_withdrawing(sdp)); 662 664
+1 -1
fs/gfs2/super.h
··· 34 34 struct gfs2_inode **ipp); 35 35 36 36 extern int gfs2_make_fs_rw(struct gfs2_sbd *sdp); 37 - extern int gfs2_make_fs_ro(struct gfs2_sbd *sdp); 37 + extern void gfs2_make_fs_ro(struct gfs2_sbd *sdp); 38 38 extern void gfs2_online_uevent(struct gfs2_sbd *sdp); 39 39 extern int gfs2_statfs_init(struct gfs2_sbd *sdp); 40 40 extern void gfs2_statfs_change(struct gfs2_sbd *sdp, s64 total, s64 free,
+2
fs/gfs2/trans.c
··· 169 169 bd->bd_bh = bh; 170 170 bd->bd_gl = gl; 171 171 INIT_LIST_HEAD(&bd->bd_list); 172 + INIT_LIST_HEAD(&bd->bd_ail_st_list); 173 + INIT_LIST_HEAD(&bd->bd_ail_gl_list); 172 174 bh->b_private = bd; 173 175 return bd; 174 176 }
+11 -6
fs/gfs2/util.c
··· 119 119 static void signal_our_withdraw(struct gfs2_sbd *sdp) 120 120 { 121 121 struct gfs2_glock *live_gl = sdp->sd_live_gh.gh_gl; 122 - struct inode *inode = sdp->sd_jdesc->jd_inode; 123 - struct gfs2_inode *ip = GFS2_I(inode); 124 - struct gfs2_glock *i_gl = ip->i_gl; 125 - u64 no_formal_ino = ip->i_no_formal_ino; 122 + struct inode *inode; 123 + struct gfs2_inode *ip; 124 + struct gfs2_glock *i_gl; 125 + u64 no_formal_ino; 126 126 int log_write_allowed = test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags); 127 127 int ret = 0; 128 128 int tries; 129 129 130 - if (test_bit(SDF_NORECOVERY, &sdp->sd_flags)) 130 + if (test_bit(SDF_NORECOVERY, &sdp->sd_flags) || !sdp->sd_jdesc) 131 131 return; 132 + 133 + inode = sdp->sd_jdesc->jd_inode; 134 + ip = GFS2_I(inode); 135 + i_gl = ip->i_gl; 136 + no_formal_ino = ip->i_no_formal_ino; 132 137 133 138 /* Prevent any glock dq until withdraw recovery is complete */ 134 139 set_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags); ··· 161 156 ret = 0; 162 157 } 163 158 if (!ret) 164 - ret = gfs2_make_fs_ro(sdp); 159 + gfs2_make_fs_ro(sdp); 165 160 gfs2_freeze_unlock(&freeze_gh); 166 161 } 167 162