Patch "gfs2: Fix case in which ail writes are done to jdata holes" has been added to the 5.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    gfs2: Fix case in which ail writes are done to jdata holes

to the 5.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     gfs2-fix-case-in-which-ail-writes-are-done-to-jdata-.patch
and it can be found in the queue-5.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 996f9d963d93bb111bdc188c9aace8d09078398f
Author: Bob Peterson <rpeterso@xxxxxxxxxx>
Date:   Thu Nov 12 10:02:48 2020 -0600

    gfs2: Fix case in which ail writes are done to jdata holes
    
    [ Upstream commit 4e79e3f08e576acd51dffb4520037188703238b3 ]
    
    Patch b2a846dbef4e ("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 b2a846dbef4e, 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@xxxxxxxxxx>
    Signed-off-by: Andreas Gruenbacher <agruenba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index d4af283fc8886..317a47d49442b 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -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;
 }
 
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 93032feb51599..1ceeec0ffb16c 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -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;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux