diff options
Diffstat (limited to 'fs/fuse/file.c')
-rw-r--r-- | fs/fuse/file.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index a7ef5e716f3c..6f05379b0a0d 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -116,9 +116,14 @@ int fuse_open_common(struct inode *inode, struct file *file, int isdir) | |||
116 | /* Special case for failed iget in CREATE */ | 116 | /* Special case for failed iget in CREATE */ |
117 | static void fuse_release_end(struct fuse_conn *fc, struct fuse_req *req) | 117 | static void fuse_release_end(struct fuse_conn *fc, struct fuse_req *req) |
118 | { | 118 | { |
119 | u64 nodeid = req->in.h.nodeid; | 119 | /* If called from end_io_requests(), req has more than one |
120 | fuse_reset_request(req); | 120 | reference and fuse_reset_request() cannot work */ |
121 | fuse_send_forget(fc, req, nodeid, 1); | 121 | if (fc->connected) { |
122 | u64 nodeid = req->in.h.nodeid; | ||
123 | fuse_reset_request(req); | ||
124 | fuse_send_forget(fc, req, nodeid, 1); | ||
125 | } else | ||
126 | fuse_put_request(fc, req); | ||
122 | } | 127 | } |
123 | 128 | ||
124 | void fuse_send_release(struct fuse_conn *fc, struct fuse_file *ff, | 129 | void fuse_send_release(struct fuse_conn *fc, struct fuse_file *ff, |
@@ -335,9 +340,14 @@ static void fuse_send_readpages(struct fuse_req *req, struct file *file, | |||
335 | loff_t pos = page_offset(req->pages[0]); | 340 | loff_t pos = page_offset(req->pages[0]); |
336 | size_t count = req->num_pages << PAGE_CACHE_SHIFT; | 341 | size_t count = req->num_pages << PAGE_CACHE_SHIFT; |
337 | req->out.page_zeroing = 1; | 342 | req->out.page_zeroing = 1; |
338 | req->end = fuse_readpages_end; | ||
339 | fuse_read_fill(req, file, inode, pos, count, FUSE_READ); | 343 | fuse_read_fill(req, file, inode, pos, count, FUSE_READ); |
340 | request_send_background(fc, req); | 344 | if (fc->async_read) { |
345 | req->end = fuse_readpages_end; | ||
346 | request_send_background(fc, req); | ||
347 | } else { | ||
348 | request_send(fc, req); | ||
349 | fuse_readpages_end(fc, req); | ||
350 | } | ||
341 | } | 351 | } |
342 | 352 | ||
343 | struct fuse_readpages_data { | 353 | struct fuse_readpages_data { |