Patch "gfs2: Disable page faults during lockless buffered reads" has been added to the 5.17-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: Disable page faults during lockless buffered reads

to the 5.17-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-disable-page-faults-during-lockless-buffered-re.patch
and it can be found in the queue-5.17 subdirectory.

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



commit ed30b5c3e0530361fb1c6fc02ae7ed75fe4f546e
Author: Andreas Gruenbacher <agruenba@xxxxxxxxxx>
Date:   Mon Mar 14 18:32:02 2022 +0100

    gfs2: Disable page faults during lockless buffered reads
    
    [ Upstream commit 52f3f033a5dbd023307520af1ff551cadfd7f037 ]
    
    During lockless buffered reads, filemap_read() holds page cache page
    references while trying to copy data to the user-space buffer.  The
    calling process isn't holding the inode glock, but the page references
    it holds prevent those pages from being removed from the page cache, and
    that prevents the underlying inode glock from being moved to another
    node.  Thus, we can end up in the same kinds of distributed deadlock
    situations as with normal (non-lockless) buffered reads.
    
    Fix that by disabling page faults during lockless reads as well.
    
    Signed-off-by: Andreas Gruenbacher <agruenba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index fa071d738c78..c781c19303db 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -956,14 +956,16 @@ static ssize_t gfs2_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
 			return ret;
 		iocb->ki_flags &= ~IOCB_DIRECT;
 	}
+	pagefault_disable();
 	iocb->ki_flags |= IOCB_NOIO;
 	ret = generic_file_read_iter(iocb, to);
 	iocb->ki_flags &= ~IOCB_NOIO;
+	pagefault_enable();
 	if (ret >= 0) {
 		if (!iov_iter_count(to))
 			return ret;
 		written = ret;
-	} else {
+	} else if (ret != -EFAULT) {
 		if (ret != -EAGAIN)
 			return ret;
 		if (iocb->ki_flags & IOCB_NOWAIT)



[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