Skip to content

Commit

Permalink
fuse: get page reference for readpages
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Miklos Szeredi committed May 25, 2010
1 parent 1bf94ca commit b5dd328
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ static void fuse_readpages_end(struct fuse_conn *fc, struct fuse_req *req)
else
SetPageError(page);
unlock_page(page);
page_cache_release(page);
}
if (req->ff)
fuse_file_put(req->ff);
Expand Down Expand Up @@ -589,6 +590,7 @@ static int fuse_readpages_fill(void *_data, struct page *page)
return PTR_ERR(req);
}
}
page_cache_get(page);
req->pages[req->num_pages] = page;
req->num_pages++;
return 0;
Expand Down

0 comments on commit b5dd328

Please sign in to comment.