Skip to content

Commit af269cf

Browse files
Miklos Szeredijosephhz
authored andcommitted
fuse: release pipe buf after last use
ANBZ: torvalds#208 commit 4734417 upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Hongnan Li <[email protected]> Reviewed-by: Joseph Qi <[email protected]>
1 parent ebf104f commit af269cf

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
@@ -931,17 +931,17 @@ static int fuse_try_move_page(struct fuse_copy_state *cs, struct page **pagep)
931931
goto out_put_old;
932932
}
933933

934+
get_page(newpage);
935+
936+
if (!(buf->flags & PIPE_BUF_FLAG_LRU))
937+
lru_cache_add(newpage);
938+
934939
/*
935940
* Release while we have extra ref on stolen page. Otherwise
936941
* anon_pipe_buf_release() might think the page can be reused.
937942
*/
938943
pipe_buf_release(cs->pipe, buf);
939944

940-
get_page(newpage);
941-
942-
if (!(buf->flags & PIPE_BUF_FLAG_LRU))
943-
lru_cache_add(newpage);
944-
945945
err = 0;
946946
spin_lock(&cs->req->waitq.lock);
947947
if (test_bit(FR_ABORTED, &cs->req->flags))

0 commit comments

Comments
 (0)