[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] xen/blkfront: Only check REQ_FUA for writes
- To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
- Date: Wed, 26 Apr 2023 17:40:05 +0100
- Authentication-results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
- Cc: <roger.pau@xxxxxxxxxx>, <jgross@xxxxxxxx>, <sstabellini@xxxxxxxxxx>, <oleksandr_tyshchenko@xxxxxxxx>, <axboe@xxxxxxxxx>, Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
- Delivery-date: Wed, 26 Apr 2023 16:40:41 +0000
- Ironport-data: A9a23:EYMLyaoEVUAP5LGv6qU1xyonDJNeBmIoZRIvgKrLsJaIsI4StFCzt garIBmFPPuJZWP1fYx+aIi/pE8CuZDUyoAwSldkryw3QS4T85uZCYyVIHmrMnLJJKUvbq7FA +Y2MYCccZ9uHhcwgj/3b9ANeFEljfngqoLUUbKCYWYpA1c/Ek/NsDo788YhmIlknNOlNA2Ev NL2sqX3NUSsnjV5KQr40YrawP9UlKm06WJwUmAWP6gR5weCzSdNVvrzGInqR5fGatgMdgKFb 76rIIGRpgvx4xorA9W5pbf3GmVirmn6ZFXmZtJ+AsBOszAazsAA+v9T2Mk0MC+7vw6hjdFpo OihgLTrIesf0g8gr8xGO/VQO3kW0aSrY9YrK1Dn2SCY5xWun3cBX5yCpaz5VGEV0r8fPI1Ay RAXAC0SMRm/ovCp+r74RuBqpP4bC9OxBapK7xmMzRmBZRonaZXKQqGM7t5ExjYgwMtJGJ4yZ eJAN2ApNk6ZJUQSZBFOUslWcOSA3xETdxVCr0mO464+7GXJ0wV11JDmMcbPe8zMTsJQ9qqdj jueoTSkWE9LbLRzzxKhtVW3o8X+sB//Sd4QSa+Hy9FK3Rqckzl75Bo+CgLg/KjRZlSFc8JSL QkY9zQjqYA29Ve3VZ/tUhugunmGsxUAHd1KHIUS6g6XzbHPyx2EHWVCRTlEAPQ9r9M/TzEu0 l6PnvvqCCZpvbnTTmiSnp+TqT6xIiETIXU1eT4fTQAF7t/gp6k+lhvKCN1kFcadh83/HjzYw D2QqiU6wbkQ5fPnzI3iowqB2Wj14MGUEEhsvF6/sn+ZAh1ReZH6brCN+0fh4bVMJYC7dGGmp iI9sp3LhAwRNq1hhBBhUc1UQuHzvKfYaGCM6bJ8N8J/rmrwohZPaagVuWgjfxkxb67obBezO CfuVRVtCIi/1ZdARYt+eMqPBssj1sAM/vy1B6mPPrKijnWcHTJrHR2ChmbKhQgBaGB2zckC1 W6zKK5A90oyB6V91yaRTOwAy7ItzS1W7TqNFcqnk0v5juTPNCX9pVI53LymN7hR0U95iF+Nr 4Y32zWikH2zr9ESkgGIqNVOfDjm3FAwBIzsqtw/S9Nv1jFOQTl7Y9eImONJRmCQt/gN/gs+1 i3nCxAwJZuWrSGvFDhmnVg5MuKzDM8u9yxmVcHuVH7xs0UejU+UxP93X/MKkXMPrrELISJcJ xXdR/i9Pw==
- Ironport-hdrordr: A9a23:15M3HaBMqRWZy0PlHemB55DYdb4zR+YMi2TDtnoBMiC9F/bzqy nApoV96faZslYssTQb6LO90cq7MBbhHPxOkO8s1N6ZNWGM2VdAbrsSj7cKqAeQYhEWmNQtrZ uIsJITNDQzNzVHZArBjzWQIpIA+p2p+LHtr+fSpk0dKT2CopsP0ztE
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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>
---
drivers/block/xen-blkfront.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 23ed258b57f0..c1890c8a9f6e 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.
--
2.31.1
|