Patch "xen/blkfront: Only check REQ_FUA for writes" has been added to the 6.3-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

    xen/blkfront: Only check REQ_FUA for writes

to the 6.3-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:
     xen-blkfront-only-check-req_fua-for-writes.patch
and it can be found in the queue-6.3 subdirectory.

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



commit 1e299be6c7d25a4d08b8df1c3f13d4ea9ea7514f
Author: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
Date:   Wed Apr 26 17:40:05 2023 +0100

    xen/blkfront: Only check REQ_FUA for writes
    
    [ Upstream commit b6ebaa8100090092aa602530d7e8316816d0c98d ]
    
    The existing code silently converts read operations with the
    REQ_FUA bit set into write-barrier operations. This results in data
    loss as the backend scribbles zeroes over the data instead of returning
    it.
    
    While the REQ_FUA bit doesn't make sense on a read operation, at least
    one well-known out-of-tree kernel module does set it and since it
    results in data loss, let's be safe here and only look at REQ_FUA for
    writes.
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
    Acked-by: Juergen Gross <jgross@xxxxxxxx>
    Link: https://lore.kernel.org/r/20230426164005.2213139-1-ross.lagerwall@xxxxxxxxxx
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 23ed258b57f0e..c1890c8a9f6e7 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -780,7 +780,8 @@ static int blkif_queue_rw_req(struct request *req, struct blkfront_ring_info *ri
 		ring_req->u.rw.handle = info->handle;
 		ring_req->operation = rq_data_dir(req) ?
 			BLKIF_OP_WRITE : BLKIF_OP_READ;
-		if (req_op(req) == REQ_OP_FLUSH || req->cmd_flags & REQ_FUA) {
+		if (req_op(req) == REQ_OP_FLUSH ||
+		    (req_op(req) == REQ_OP_WRITE && (req->cmd_flags & REQ_FUA))) {
 			/*
 			 * Ideally we can do an unordered flush-to-disk.
 			 * In case the backend onlysupports barriers, use that.



[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