diff mbox

[1/1] ceph: properly release page upon error

Message ID 1426887416-27312-1-git-send-email-tsgatesv@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Taesoo Kim March 20, 2015, 9:36 p.m. UTC
When ceph_update_writeable_page fails (including -EAGAIN), it
unlocks (w/ unlock_page) the page but does not 'release'
(w/ page_cache_release) properly.

Upon error, properly set *pagep to NULL, indicating an error.

Signed-off-by: Taesoo Kim <tsgatesv@gmail.com>
---
 fs/ceph/addr.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Yan, Zheng March 23, 2015, 3:37 a.m. UTC | #1
> ? 2015?3?21??05:36?Taesoo Kim <tsgatesv@gmail.com> ???
> 
> When ceph_update_writeable_page fails (including -EAGAIN), it
> unlocks (w/ unlock_page) the page but does not 'release'
> (w/ page_cache_release) properly.
> 
> Upon error, properly set *pagep to NULL, indicating an error.
> 
> Signed-off-by: Taesoo Kim <tsgatesv@gmail.com>
> ---
> fs/ceph/addr.c | 4 ++++
> 1 file changed, 4 insertions(+)
> 
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index fd5599d..89091e3 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -1146,6 +1146,10 @@ static int ceph_write_begin(struct file *file, struct address_space *mapping,
> 		     inode, page, (int)pos, (int)len);
> 
> 		r = ceph_update_writeable_page(file, pos, len, page);
> +		if (r) {
> +			page_cache_release(page);
> +			*pagep = NULL;
> +		}
> 	} while (r == -EAGAIN);
> 
> 	return r;
> -- 

Added to our testing branch. Thank you

Yan, Zheng
> 

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index fd5599d..89091e3 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -1146,6 +1146,10 @@  static int ceph_write_begin(struct file *file, struct address_space *mapping,
 		     inode, page, (int)pos, (int)len);
 
 		r = ceph_update_writeable_page(file, pos, len, page);
+		if (r) {
+			page_cache_release(page);
+			*pagep = NULL;
+		}
 	} while (r == -EAGAIN);
 
 	return r;