Skip to content

Commit 8f4d071

Browse files
Miklos Szeredigregkh
authored andcommitted
fuse: release pipe buf after last use
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 <jmforbes@linuxtx.org> Fixes: 712a951 ("fuse: fix page stealing") Cc: <stable@vger.kernel.org> # v2.6.35 Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8d0163c commit 8f4d071

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎fs/fuse/dev.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -851,17 +851,17 @@ static int fuse_try_move_page(struct fuse_copy_state *cs, struct page **pagep)
851851
goto out_put_old;
852852
}
853853

854+
get_page(newpage);
855+
856+
if (!(buf->flags & PIPE_BUF_FLAG_LRU))
857+
lru_cache_add(newpage);
858+
854859
/*
855860
* Release while we have extra ref on stolen page. Otherwise
856861
* anon_pipe_buf_release() might think the page can be reused.
857862
*/
858863
pipe_buf_release(cs->pipe, buf);
859864

860-
get_page(newpage);
861-
862-
if (!(buf->flags & PIPE_BUF_FLAG_LRU))
863-
lru_cache_add(newpage);
864-
865865
err = 0;
866866
spin_lock(&cs->req->waitq.lock);
867867
if (test_bit(FR_ABORTED, &cs->req->flags))

0 commit comments

Comments
 (0)