Skip to content

Commit b5dd328

Browse files
author
Miklos Szeredi
committed
fuse: get page reference for readpages
Acquire a page ref on pages in ->readpages() and release them when the read has finished. Not acquiring a reference didn't seem to cause any trouble since the page is locked and will not be kicked out of the page cache during the read. However the following patches will want to remove the page from the cache so a separate ref is needed. Making the reference in req->pages explicit also makes the code easier to understand. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
1 parent 1bf94ca commit b5dd328

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎fs/fuse/file.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,7 @@ static void fuse_readpages_end(struct fuse_conn *fc, struct fuse_req *req)
536536
else
537537
SetPageError(page);
538538
unlock_page(page);
539+
page_cache_release(page);
539540
}
540541
if (req->ff)
541542
fuse_file_put(req->ff);
@@ -589,6 +590,7 @@ static int fuse_readpages_fill(void *_data, struct page *page)
589590
return PTR_ERR(req);
590591
}
591592
}
593+
page_cache_get(page);
592594
req->pages[req->num_pages] = page;
593595
req->num_pages++;
594596
return 0;

0 commit comments

Comments
 (0)