Commit c5de16cc authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Miklos Szeredi
Browse files

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: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent e2653bd5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
		}
	}