[RHEL7,COMMIT] fs/fuse kio_pcs: fix missing hbuf.uid update for ireq split case

Submitted by Konstantin Khorenko on June 27, 2018, 3:49 p.m.

Details

Message ID 201806271549.w5RFnKJM016969@finist_ce7.work
State New
Series "fs/fuse kio_pcs: fix missing hbuf.uid update for ireq split case"
Headers show

Commit Message

Konstantin Khorenko June 27, 2018, 3:49 p.m.
The commit is pushed to "branch-rh7-3.10.0-862.3.2.vz7.61.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.3.2.vz7.61.5
------>
commit 1f3d517b9e86f70b82b99083fdd0a6b30a65e9c2
Author: Pavel Butsykin <pbutsykin@virtuozzo.com>
Date:   Wed Jun 27 18:49:20 2018 +0300

    fs/fuse kio_pcs: fix missing hbuf.uid update for ireq split case
    
    After receiving the new mapping, we need to update uid and map_version in cs
    requests. It's done in map_submit():
            if (ireq->type == PCS_IREQ_IOCHUNK) {
                    ireq->iochunk.hbuf.map_version = m->version;
                    ireq->iochunk.hbuf.uid = ireq->iochunk.map->id;
    
    But updating uid missed in the case of split request by pcs_ireq_split(). Let's
    move update uid to more common place pcs_cs_submit() to fix.
    
    https://pmc.acronis.com/browse/VSTOR-11315
    
    Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
    Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
    Acked-by: Alexey Kuznetsov <kuznet@virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_cs.c  | 4 ++++
 fs/fuse/kio/pcs/pcs_map.c | 5 ++---
 2 files changed, 6 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/kio/pcs/pcs_cs.c b/fs/fuse/kio/pcs/pcs_cs.c
index 6efa54f0056f..bea8e5c16f5c 100644
--- a/fs/fuse/kio/pcs/pcs_cs.c
+++ b/fs/fuse/kio/pcs/pcs_cs.c
@@ -545,6 +545,10 @@  void pcs_cs_submit(struct pcs_cs *cs, struct pcs_int_request *ireq)
 	}
 
 	ioh->map_version = csl->version;
+	/* vstorage never changes once allocated chunk id, so we can copy it
+	 * directly from map.
+	 */
+	ioh->uid = map->id;
 	if (pcs_req_direction(ireq->iochunk.cmd))
 		msg->timeout = csl->write_timeout;
 	else
diff --git a/fs/fuse/kio/pcs/pcs_map.c b/fs/fuse/kio/pcs/pcs_map.c
index f2ae087d5286..5c68a01524b8 100644
--- a/fs/fuse/kio/pcs/pcs_map.c
+++ b/fs/fuse/kio/pcs/pcs_map.c
@@ -2308,10 +2308,9 @@  void map_submit(struct pcs_map_entry * m, struct pcs_int_request *ireq)
 		struct pcs_cs_list *csl = NULL;
 
 		spin_lock(&m->lock);
-		if (ireq->type == PCS_IREQ_IOCHUNK && !(ireq->flags & IREQ_F_MAPPED)) {
+		if (ireq->type == PCS_IREQ_IOCHUNK && !(ireq->flags & IREQ_F_MAPPED))
 			ireq->iochunk.hbuf.map_version = m->version;
-			ireq->iochunk.hbuf.uid = ireq->iochunk.map->id;
-		}
+
 		if (!(m->state & (1 << direction))) {
 			spin_unlock(&m->lock);
 			pcs_map_queue_resolve(m, ireq, direction);