This commit is contained in:
Miklos Szeredi 2004-11-14 01:02:44 +00:00
parent c149266326
commit 3f2fb4a05a
4 changed files with 19 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2004-11-14 Miklos Szeredi <miklos@szeredi.hu>
* Fix bug in fuse_readpages() causing Oops in certain situations.
Bug found by Vincenzo Ciancia.
2004-11-11 Miklos Szeredi <miklos@szeredi.hu> 2004-11-11 Miklos Szeredi <miklos@szeredi.hu>
* Check kernel interface version in fusermount to prevent * Check kernel interface version in fusermount to prevent

View File

@ -131,24 +131,22 @@ static struct fuse_req *do_get_request(struct fuse_conn *fc)
struct fuse_req *fuse_get_request(struct fuse_conn *fc) struct fuse_req *fuse_get_request(struct fuse_conn *fc)
{ {
struct fuse_req *req;
if (down_interruptible(&fc->unused_sem)) if (down_interruptible(&fc->unused_sem))
return NULL; return NULL;
return do_get_request(fc);
}
req = do_get_request(fc); struct fuse_req *fuse_get_request_nonint(struct fuse_conn *fc)
return req; {
down(&fc->unused_sem);
return do_get_request(fc);
} }
struct fuse_req *fuse_get_request_nonblock(struct fuse_conn *fc) struct fuse_req *fuse_get_request_nonblock(struct fuse_conn *fc)
{ {
struct fuse_req *req;
if (down_trylock(&fc->unused_sem)) if (down_trylock(&fc->unused_sem))
return NULL; return NULL;
return do_get_request(fc);
req = do_get_request(fc);
return req;
} }
void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req) void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req)

View File

@ -375,7 +375,7 @@ static int fuse_readpages_fill(void *_data, struct page *page)
req->pages[req->num_pages - 1]->index + 1 != page->index)) { req->pages[req->num_pages - 1]->index + 1 != page->index)) {
struct fuse_conn *fc = INO_FC(page->mapping->host); struct fuse_conn *fc = INO_FC(page->mapping->host);
fuse_send_readpages(req, data->file, inode); fuse_send_readpages(req, data->file, inode);
data->req = req = fuse_get_request(fc); data->req = req = fuse_get_request_nonint(fc);
} }
req->pages[req->num_pages] = page; req->pages[req->num_pages] = page;
req->num_pages ++; req->num_pages ++;
@ -389,7 +389,7 @@ static int fuse_readpages(struct file *file, struct address_space *mapping,
struct fuse_conn *fc = INO_FC(inode); struct fuse_conn *fc = INO_FC(inode);
struct fuse_readpages_data data; struct fuse_readpages_data data;
data.req = fuse_get_request(fc); data.req = fuse_get_request_nonint(fc);
data.file = file; data.file = file;
data.inode = inode; data.inode = inode;

View File

@ -343,6 +343,11 @@ void fuse_reset_request(struct fuse_req *req);
*/ */
struct fuse_req *fuse_get_request(struct fuse_conn *fc); struct fuse_req *fuse_get_request(struct fuse_conn *fc);
/**
* Reserve a preallocated request, non-interruptible
*/
struct fuse_req *fuse_get_request_nonint(struct fuse_conn *fc);
/** /**
* Reserve a preallocated request, non-blocking * Reserve a preallocated request, non-blocking
*/ */