diff options
| author | Andreas Gruenbacher <agruenba@redhat.com> | 2026-04-03 14:42:18 +0200 |
|---|---|---|
| committer | Andreas Gruenbacher <agruenba@redhat.com> | 2026-04-07 22:19:59 +0200 |
| commit | f4e4c4e6acdc20a9065064dd164db52e2e0d44ad (patch) | |
| tree | 211aaebfbecaae62f8dd4806e8fdf6cc02ff6c7d /fs/gfs2/log.c | |
| parent | 7d2da6ed172680a7ef06acfe3e44a2326977573f (diff) | |
| download | linux-next-f4e4c4e6acdc20a9065064dd164db52e2e0d44ad.tar.gz linux-next-f4e4c4e6acdc20a9065064dd164db52e2e0d44ad.zip | |
gfs2: fix address space truncation during withdraw
When a withdrawn filesystem's inodes are being evicted, the address spaces of
those inodes still need to be truncated but we can no longer start new
transactions. We still don't want gfs2_invalidate_folio() to race with
gfs2_log_flush(), so take a read lock on sdp->sd_log_flush_lock in that case.
(It may not be obvious, but gfs2_invalidate_folio() is a jdata-only address
space operation.)
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'fs/gfs2/log.c')
| -rw-r--r-- | fs/gfs2/log.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 8397d34527a4..31ee7a0e86a2 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c @@ -1024,17 +1024,22 @@ void gfs2_remove_from_journal(struct buffer_head *bh, int meta) trace_gfs2_pin(bd, 0); atomic_dec(&sdp->sd_log_pinned); list_del_init(&bd->bd_list); - if (meta == REMOVE_META) - tr->tr_num_buf_rm++; - else - tr->tr_num_databuf_rm++; - set_bit(TR_TOUCHED, &tr->tr_flags); + if (tr) { + if (meta == REMOVE_META) + tr->tr_num_buf_rm++; + else + tr->tr_num_databuf_rm++; + set_bit(TR_TOUCHED, &tr->tr_flags); + } was_pinned = 1; brelse(bh); } if (bd) { if (bd->bd_tr) { - gfs2_trans_add_revoke(sdp, bd); + if (tr) + gfs2_trans_add_revoke(sdp, bd); + else + gfs2_remove_from_ail(bd); } else if (was_pinned) { bh->b_private = NULL; kmem_cache_free(gfs2_bufdata_cachep, bd); |
