]> git.baikalelectronics.ru Git - kernel.git/commitdiff
gfs2: Fix case in which ail writes are done to jdata holes
authorBob Peterson <rpeterso@redhat.com>
Thu, 12 Nov 2020 16:02:48 +0000 (10:02 -0600)
committerAndreas Gruenbacher <agruenba@redhat.com>
Thu, 12 Nov 2020 17:55:20 +0000 (18:55 +0100)
Patch b7fd945ba949 ("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 b7fd945ba949, 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>
fs/gfs2/aops.c
fs/gfs2/log.c

index 9cd2ecad07dbd0576ad92870d3de6485716119f6..cc4f987687f3c1ff611d968b311e9724aeca7f4f 100644 (file)
@@ -77,7 +77,7 @@ static int gfs2_get_block_noalloc(struct inode *inode, sector_t lblock,
        if (error)
                return error;
        if (!buffer_mapped(bh_result))
-               return -EIO;
+               return -ENODATA;
        return 0;
 }
 
index 9133b317867755497969ad490bd267573b7dc5de..2e9314091c81d0c472e374b2acb93dd353b94b5c 100644 (file)
@@ -132,6 +132,8 @@ __acquires(&sdp->sd_ail_lock)
                spin_unlock(&sdp->sd_ail_lock);
                ret = generic_writepages(mapping, wbc);
                spin_lock(&sdp->sd_ail_lock);
+               if (ret == -ENODATA) /* if a jdata write into a new hole */
+                       ret = 0; /* ignore it */
                if (ret || wbc->nr_to_write <= 0)
                        break;
                return -EBUSY;