[RHEL7,COMMIT] fs/fuse kio_pcs: cleanup in truncate (backport)

Submitted by Konstantin Khorenko on Oct. 31, 2018, 1:03 p.m.

Details

Message ID 201810311303.w9VD3Lrg023626@finist-ce7.sw.ru
State New
Series "fs/fuse kio_pcs: cleanup in truncate (backport)"
Headers show

Commit Message

Konstantin Khorenko Oct. 31, 2018, 1:03 p.m.
The commit is pushed to "branch-rh7-3.10.0-862.14.4.vz7.72.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.14.4.vz7.72.15
------>
commit 6225b28dad57af2521f00caf99e48485c350a9d7
Author: Alexey Kuznetsov <kuznet@virtuozzo.com>
Date:   Wed Oct 31 16:03:20 2018 +0300

    fs/fuse kio_pcs: cleanup in truncate (backport)
    
    It was not a bug, the behaviour stays the same, but code looked really strange.
    Noticed by dmonakhov@
    
    Signed-off-by: Alexey Kuznetsov <kuznet@virtuozzo.com>
    Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_map.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/kio/pcs/pcs_map.c b/fs/fuse/kio/pcs/pcs_map.c
index 9e7d0dba2bbd..ec00cf238b1c 100644
--- a/fs/fuse/kio/pcs/pcs_map.c
+++ b/fs/fuse/kio/pcs/pcs_map.c
@@ -2481,14 +2481,13 @@  noinline void pcs_mapping_truncate(struct pcs_int_request *ireq, u64 old_size)
 	ireq->truncreq.offset = offset;
 	ireq->truncreq.phase = 0;
 
+	map_truncate_tail(&di->mapping, offset);
+
 	if (offset == 0) {
-		map_truncate_tail(&di->mapping, offset);
 		ireq_complete(ireq);
 		return;
 	}
 
-	map_truncate_tail(&di->mapping, offset + 1);
-
 	m = pcs_find_get_map(di, offset - 1);
 
 	FUSE_KTRACE(ireq->cc->fc, "mapping truncate %llu->%llu " DENTRY_FMT " %x", (unsigned long long)old_size,