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,9 +1606,14 @@ static int __bch2_buffered_write(struct bch_inode_info *inode,
pages[i] = grab_cache_page_write_begin(mapping, index + i);
if (!pages[i]) {
nr_pages = i;
if (!i) {
ret = -ENOMEM;
goto out;
}
len = min_t(unsigned, len,
nr_pages * PAGE_SIZE - offset);
break;
}
}
if (offset && !PageUptodate(pages[0])) {
......
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