Commit 72523425 authored by Miklos Szeredi's avatar Miklos Szeredi

fuse: don't BUG on no write file

Don't bug if there's no writable files found for page writeback.  If ever
this is triggered, a WARN_ON helps debugging it much better then a BUG_ON.
Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
parent cca24370
...@@ -1505,12 +1505,14 @@ static void fuse_writepage_end(struct fuse_conn *fc, struct fuse_req *req) ...@@ -1505,12 +1505,14 @@ static void fuse_writepage_end(struct fuse_conn *fc, struct fuse_req *req)
static struct fuse_file *fuse_write_file(struct fuse_conn *fc, static struct fuse_file *fuse_write_file(struct fuse_conn *fc,
struct fuse_inode *fi) struct fuse_inode *fi)
{ {
struct fuse_file *ff; struct fuse_file *ff = NULL;
spin_lock(&fc->lock); spin_lock(&fc->lock);
BUG_ON(list_empty(&fi->write_files)); if (!WARN_ON(list_empty(&fi->write_files))) {
ff = list_entry(fi->write_files.next, struct fuse_file, write_entry); ff = list_entry(fi->write_files.next, struct fuse_file,
write_entry);
fuse_file_get(ff); fuse_file_get(ff);
}
spin_unlock(&fc->lock); spin_unlock(&fc->lock);
return ff; return ff;
...@@ -1524,6 +1526,7 @@ static int fuse_writepage_locked(struct page *page) ...@@ -1524,6 +1526,7 @@ static int fuse_writepage_locked(struct page *page)
struct fuse_inode *fi = get_fuse_inode(inode); struct fuse_inode *fi = get_fuse_inode(inode);
struct fuse_req *req; struct fuse_req *req;
struct page *tmp_page; struct page *tmp_page;
int error = -ENOMEM;
set_page_writeback(page); set_page_writeback(page);
...@@ -1536,7 +1539,11 @@ static int fuse_writepage_locked(struct page *page) ...@@ -1536,7 +1539,11 @@ static int fuse_writepage_locked(struct page *page)
if (!tmp_page) if (!tmp_page)
goto err_free; goto err_free;
error = -EIO;
req->ff = fuse_write_file(fc, fi); req->ff = fuse_write_file(fc, fi);
if (!req->ff)
goto err_free;
fuse_write_fill(req, req->ff, page_offset(page), 0); fuse_write_fill(req, req->ff, page_offset(page), 0);
copy_highpage(tmp_page, page); copy_highpage(tmp_page, page);
...@@ -1566,7 +1573,7 @@ static int fuse_writepage_locked(struct page *page) ...@@ -1566,7 +1573,7 @@ static int fuse_writepage_locked(struct page *page)
fuse_request_free(req); fuse_request_free(req);
err: err:
end_page_writeback(page); end_page_writeback(page);
return -ENOMEM; return error;
} }
static int fuse_writepage(struct page *page, struct writeback_control *wbc) static int fuse_writepage(struct page *page, struct writeback_control *wbc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment