aboutsummaryrefslogtreecommitdiff
path: root/fs/fuse
diff options
context:
space:
mode:
authorKirill Tkhai2018-11-26 12:46:20 +0300
committerMiklos Szeredi2019-02-13 13:15:12 +0100
commitc5de16cca2d7268833abfd6456d73fbba447c19b (patch)
tree3a2ab598c9b47a130a397b3369da4fccf8e8ef82 /fs/fuse
parente2653bd53a98412ff2fc6fa6a6ed3934da04a3f3 (diff)
fuse: Replace page without copying in fuse_writepage_in_flight()
It looks like we can optimize page replacement and avoid copying by simple updating the request's page. [SzM: swap with new request's tmp page to avoid use after free.] Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index ee59599f4947..6b6e2574e733 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1789,7 +1789,7 @@ static bool fuse_writepage_in_flight(struct fuse_req *new_req,
if (curr_index == page->index) {
WARN_ON(tmp->num_pages != 1);
WARN_ON(!test_bit(FR_PENDING, &tmp->flags));
- copy_highpage(tmp->pages[0], page);
+ swap(tmp->pages[0], new_req->pages[0]);
break;
}
}