Commit 77fe2d67 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] unlock_page when get_swap_bio fails

Patch from Hugh Dickins <hugh@veritas.com>

swap_readpage and swap_writepage forgot
to unlock_page if get_swap_bio failed.
parent 3d3f3c51
...@@ -97,6 +97,7 @@ int swap_writepage(struct page *page) ...@@ -97,6 +97,7 @@ int swap_writepage(struct page *page)
bio = get_swap_bio(GFP_NOIO, page, end_swap_bio_write); bio = get_swap_bio(GFP_NOIO, page, end_swap_bio_write);
if (bio == NULL) { if (bio == NULL) {
set_page_dirty(page); set_page_dirty(page);
unlock_page(page);
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
...@@ -116,6 +117,7 @@ int swap_readpage(struct file *file, struct page *page) ...@@ -116,6 +117,7 @@ int swap_readpage(struct file *file, struct page *page)
ClearPageUptodate(page); ClearPageUptodate(page);
bio = get_swap_bio(GFP_KERNEL, page, end_swap_bio_read); bio = get_swap_bio(GFP_KERNEL, page, end_swap_bio_read);
if (bio == NULL) { if (bio == NULL) {
unlock_page(page);
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
......
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