Skip to content

Commit 4e79e3f

Browse files
AstralBobAndreas Gruenbacher
authored andcommitted
gfs2: Fix case in which ail writes are done to jdata holes
Patch b2a846d ("gfs2: Ignore journal log writes for jdata holes") tried (unsuccessfully) to fix a case in which writes were done to jdata blocks, the blocks are sent to the ail list, then a punch_hole or truncate operation caused the blocks to be freed. In other words, the ail items are for jdata holes. Before b2a846d, the jdata hole caused function gfs2_block_map to return -EIO, which was eventually interpreted as an IO error to the journal, and then withdraw. This patch changes function gfs2_get_block_noalloc, which is only used for jdata writes, so it returns -ENODATA rather than -EIO, and when -ENODATA is returned to gfs2_ail1_start_one, the error is ignored. We can safely ignore it because gfs2_ail1_start_one is only called when the jdata pages have already been written and truncated, so the ail1 content no longer applies. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent d3039c0 commit 4e79e3f

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

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/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;

0 commit comments

Comments
 (0)