Skip to content

Commit 02aee81

Browse files
committed
Merge tag 'gfs2-v6.4-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2
Pull gfs2 fixes from Andreas Gruenbacher: - Fix a freeze consistency check in gfs2_trans_add_meta() - Don't use filemap_splice_read as it can cause deadlocks on gfs2 * tag 'gfs2-v6.4-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2: gfs2: Don't use filemap_splice_read gfs2: Fix freeze consistency check in gfs2_trans_add_meta
2 parents da703fe + 0be8432 commit 02aee81

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

fs/gfs2/file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,7 +1578,7 @@ const struct file_operations gfs2_file_fops = {
15781578
.fsync = gfs2_fsync,
15791579
.lock = gfs2_lock,
15801580
.flock = gfs2_flock,
1581-
.splice_read = filemap_splice_read,
1581+
.splice_read = copy_splice_read,
15821582
.splice_write = gfs2_file_splice_write,
15831583
.setlease = simple_nosetlease,
15841584
.fallocate = gfs2_fallocate,
@@ -1609,7 +1609,7 @@ const struct file_operations gfs2_file_fops_nolock = {
16091609
.open = gfs2_open,
16101610
.release = gfs2_release,
16111611
.fsync = gfs2_fsync,
1612-
.splice_read = filemap_splice_read,
1612+
.splice_read = copy_splice_read,
16131613
.splice_write = gfs2_file_splice_write,
16141614
.setlease = generic_setlease,
16151615
.fallocate = gfs2_fallocate,

fs/gfs2/trans.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,11 @@ void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh)
230230
{
231231

232232
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
233+
struct super_block *sb = sdp->sd_vfs;
233234
struct gfs2_bufdata *bd;
234235
struct gfs2_meta_header *mh;
235236
struct gfs2_trans *tr = current->journal_info;
237+
bool withdraw = false;
236238

237239
lock_buffer(bh);
238240
if (buffer_pinned(bh)) {
@@ -266,13 +268,15 @@ void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh)
266268
(unsigned long long)bd->bd_bh->b_blocknr);
267269
BUG();
268270
}
269-
if (unlikely(test_bit(SDF_FROZEN, &sdp->sd_flags))) {
270-
fs_info(sdp, "GFS2:adding buf while frozen\n");
271-
gfs2_assert_withdraw(sdp, 0);
272-
}
273271
if (unlikely(gfs2_withdrawn(sdp))) {
274272
fs_info(sdp, "GFS2:adding buf while withdrawn! 0x%llx\n",
275273
(unsigned long long)bd->bd_bh->b_blocknr);
274+
goto out_unlock;
275+
}
276+
if (unlikely(sb->s_writers.frozen == SB_FREEZE_COMPLETE)) {
277+
fs_info(sdp, "GFS2:adding buf while frozen\n");
278+
withdraw = true;
279+
goto out_unlock;
276280
}
277281
gfs2_pin(sdp, bd->bd_bh);
278282
mh->__pad0 = cpu_to_be64(0);
@@ -281,6 +285,8 @@ void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh)
281285
tr->tr_num_buf_new++;
282286
out_unlock:
283287
gfs2_log_unlock(sdp);
288+
if (withdraw)
289+
gfs2_assert_withdraw(sdp, 0);
284290
out:
285291
unlock_buffer(bh);
286292
}

0 commit comments

Comments
 (0)