Commit 8de819f8 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix __bch2_buffered_write() returning -ENOMEM

When grab_cache_page_write_begin() fails but we did pin some pages, we
shouldn't return -ENOMEM, we should do a partial write.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 6988e85b
...@@ -1606,8 +1606,13 @@ static int __bch2_buffered_write(struct bch_inode_info *inode, ...@@ -1606,8 +1606,13 @@ static int __bch2_buffered_write(struct bch_inode_info *inode,
pages[i] = grab_cache_page_write_begin(mapping, index + i); pages[i] = grab_cache_page_write_begin(mapping, index + i);
if (!pages[i]) { if (!pages[i]) {
nr_pages = i; nr_pages = i;
ret = -ENOMEM; if (!i) {
goto out; ret = -ENOMEM;
goto out;
}
len = min_t(unsigned, len,
nr_pages * PAGE_SIZE - offset);
break;
} }
} }
......
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