Skip to content

Commit

Permalink
[PATCH] fuse: fix oops in fuse_send_readpages()
Browse files Browse the repository at this point in the history
During heavy parallel filesystem activity it was possible to Oops the kernel.
The reason is that read_cache_pages() could skip pages which have already been
inserted into the cache by another task.  Occasionally this may result in zero
pages actually being sent, while fuse_send_readpages() relies on at least one
page being in the request.

So check this corner case and just free the request instead of trying to send
it.

Reported and tested by Konstantin Isakov.

Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Miklos Szeredi authored and Linus Torvalds committed Apr 11, 2006
1 parent 3e16f6a commit d3406ff
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,12 @@ static int fuse_readpages(struct file *file, struct address_space *mapping,
return -EINTR;

err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data);
if (!err)
fuse_send_readpages(data.req, file, inode);
if (!err) {
if (data.req->num_pages)
fuse_send_readpages(data.req, file, inode);
else
fuse_put_request(fc, data.req);
}
return err;
}

Expand Down

0 comments on commit d3406ff

Please sign in to comment.