mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] ceph: properly release page upon error
@ 2015-03-20 21:36 Taesoo Kim
  2015-03-23  3:37 ` 严正
  0 siblings, 1 reply; 2+ messages in thread
From: Taesoo Kim @ 2015-03-20 21:36 UTC (permalink / raw)
  To: zyan, sage, ceph-devel, linux-kernel
  Cc: taesoo, changwoo, sanidhya, blee, csong84, Taesoo Kim

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;
-- 
2.3.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] ceph: properly release page upon error
  2015-03-20 21:36 [PATCH 1/1] ceph: properly release page upon error Taesoo Kim
@ 2015-03-23  3:37 ` 严正
  0 siblings, 0 replies; 2+ messages in thread
From: 严正 @ 2015-03-23  3:37 UTC (permalink / raw)
  To: Taesoo Kim
  Cc: sage, Ceph Development, linux-kernel, taesoo, changwoo, sanidhya,
	blee, csong84


> 在 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
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-23  3:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-20 21:36 [PATCH 1/1] ceph: properly release page upon error Taesoo Kim
2015-03-23  3:37 ` 严正

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®