Skip to content

Commit 4734417

Browse files
author
Miklos Szeredi
committed
fuse: release pipe buf after last use
Checking buf->flags should be done before the pipe_buf_release() is called on the pipe buffer, since releasing the buffer might modify the flags. This is exactly what page_cache_pipe_buf_release() does, and which results in the same VM_BUG_ON_PAGE(PageLRU(page)) that the original patch was trying to fix. Reported-by: Justin Forbes <[email protected]> Fixes: 712a951 ("fuse: fix page stealing") Cc: <[email protected]> # v2.6.35 Signed-off-by: Miklos Szeredi <[email protected]>
1 parent fa55b7d commit 4734417

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

fs/fuse/dev.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -847,17 +847,17 @@ static int fuse_try_move_page(struct fuse_copy_state *cs, struct page **pagep)
847847

848848
replace_page_cache_page(oldpage, newpage);
849849

850+
get_page(newpage);
851+
852+
if (!(buf->flags & PIPE_BUF_FLAG_LRU))
853+
lru_cache_add(newpage);
854+
850855
/*
851856
* Release while we have extra ref on stolen page. Otherwise
852857
* anon_pipe_buf_release() might think the page can be reused.
853858
*/
854859
pipe_buf_release(cs->pipe, buf);
855860

856-
get_page(newpage);
857-
858-
if (!(buf->flags & PIPE_BUF_FLAG_LRU))
859-
lru_cache_add(newpage);
860-
861861
err = 0;
862862
spin_lock(&cs->req->waitq.lock);
863863
if (test_bit(FR_ABORTED, &cs->req->flags))

0 commit comments

Comments
 (0)