Skip to content

Commit 20ca21d

Browse files
committed
Merge tag 'gfs2-v5.10-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2
Pull gfs2 fixes from Andreas Gruenbacher: "Fix jdata data corruption and glock reference leak" * tag 'gfs2-v5.10-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2: gfs2: Fix case in which ail writes are done to jdata holes Revert "gfs2: Ignore journal log writes for jdata holes" gfs2: fix possible reference leak in gfs2_check_blk_type
2 parents db7c953 + 4e79e3f commit 20ca21d

4 files changed

Lines changed: 10 additions & 12 deletions

File tree

fs/gfs2/aops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static int gfs2_get_block_noalloc(struct inode *inode, sector_t lblock,
7777
if (error)
7878
return error;
7979
if (!buffer_mapped(bh_result))
80-
return -EIO;
80+
return -ENODATA;
8181
return 0;
8282
}
8383

fs/gfs2/bmap.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,12 +1301,8 @@ int gfs2_block_map(struct inode *inode, sector_t lblock,
13011301
trace_gfs2_bmap(ip, bh_map, lblock, create, 1);
13021302

13031303
ret = gfs2_iomap_get(inode, pos, length, flags, &iomap, &mp);
1304-
if (!ret && iomap.type == IOMAP_HOLE) {
1305-
if (create)
1306-
ret = gfs2_iomap_alloc(inode, &iomap, &mp);
1307-
else
1308-
ret = -ENODATA;
1309-
}
1304+
if (create && !ret && iomap.type == IOMAP_HOLE)
1305+
ret = gfs2_iomap_alloc(inode, &iomap, &mp);
13101306
release_metapath(&mp);
13111307
if (ret)
13121308
goto out;

fs/gfs2/log.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ __acquires(&sdp->sd_ail_lock)
132132
spin_unlock(&sdp->sd_ail_lock);
133133
ret = generic_writepages(mapping, wbc);
134134
spin_lock(&sdp->sd_ail_lock);
135+
if (ret == -ENODATA) /* if a jdata write into a new hole */
136+
ret = 0; /* ignore it */
135137
if (ret || wbc->nr_to_write <= 0)
136138
break;
137139
return -EBUSY;

fs/gfs2/rgrp.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2529,13 +2529,13 @@ int gfs2_check_blk_type(struct gfs2_sbd *sdp, u64 no_addr, unsigned int type)
25292529

25302530
rbm.rgd = rgd;
25312531
error = gfs2_rbm_from_block(&rbm, no_addr);
2532-
if (WARN_ON_ONCE(error))
2533-
goto fail;
2534-
2535-
if (gfs2_testbit(&rbm, false) != type)
2536-
error = -ESTALE;
2532+
if (!WARN_ON_ONCE(error)) {
2533+
if (gfs2_testbit(&rbm, false) != type)
2534+
error = -ESTALE;
2535+
}
25372536

25382537
gfs2_glock_dq_uninit(&rgd_gh);
2538+
25392539
fail:
25402540
return error;
25412541
}

0 commit comments

Comments
 (0)