linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] f2fs: fix to call put_page at the error handling routine
@ 2014-11-18  1:57 Jaegeuk Kim
  2014-11-18  1:57 ` [PATCH 2/2] f2fs: put the inode page when error was occurred Jaegeuk Kim
  2014-11-18  5:22 ` [f2fs-dev] [PATCH 1/2] f2fs: fix to call put_page at the error handling routine Chao Yu
  0 siblings, 2 replies; 5+ messages in thread
From: Jaegeuk Kim @ 2014-11-18  1:57 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: Jaegeuk Kim

The locked page should be released before returning the function.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/inline.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index 053d114..f26fb87 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -141,8 +141,8 @@ int f2fs_convert_inline_inode(struct inode *inode)
 
 	ipage = get_node_page(sbi, inode->i_ino);
 	if (IS_ERR(ipage)) {
-		f2fs_unlock_op(sbi);
-		return PTR_ERR(ipage);
+		err = PTR_ERR(ipage);
+		goto out;
 	}
 
 	set_new_dnode(&dn, inode, ipage, ipage, 0);
@@ -151,7 +151,7 @@ int f2fs_convert_inline_inode(struct inode *inode)
 		err = f2fs_convert_inline_page(&dn, page);
 
 	f2fs_put_dnode(&dn);
-
+out:
 	f2fs_unlock_op(sbi);
 
 	f2fs_put_page(page, 1);
-- 
2.1.1


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

* [PATCH 2/2] f2fs: put the inode page when error was occurred
  2014-11-18  1:57 [PATCH 1/2] f2fs: fix to call put_page at the error handling routine Jaegeuk Kim
@ 2014-11-18  1:57 ` Jaegeuk Kim
  2014-11-18  5:30   ` [f2fs-dev] " Chao Yu
  2014-11-18  5:22 ` [f2fs-dev] [PATCH 1/2] f2fs: fix to call put_page at the error handling routine Chao Yu
  1 sibling, 1 reply; 5+ messages in thread
From: Jaegeuk Kim @ 2014-11-18  1:57 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: Jaegeuk Kim

We should put the inode page when error was occurred.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/data.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 8f16443..12dd58a 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -963,22 +963,22 @@ repeat:
 		} else if (page->index == 0) {
 			err = f2fs_convert_inline_page(&dn, page);
 			if (err)
-				goto unlock_fail;
+				goto put_fail;
 		} else {
 			struct page *p = grab_cache_page(inode->i_mapping, 0);
 			if (!p) {
 				err = -ENOMEM;
-				goto unlock_fail;
+				goto put_fail;
 			}
 			err = f2fs_convert_inline_page(&dn, p);
 			f2fs_put_page(p, 1);
 			if (err)
-				goto unlock_fail;
+				goto put_fail;
 		}
 	}
 	err = f2fs_reserve_block(&dn, index);
 	if (err)
-		goto unlock_fail;
+		goto put_fail;
 put_next:
 	f2fs_put_dnode(&dn);
 	f2fs_unlock_op(sbi);
@@ -1021,6 +1021,8 @@ out:
 	clear_cold_data(page);
 	return 0;
 
+put_fail:
+	f2fs_put_dnode(&dn);
 unlock_fail:
 	f2fs_unlock_op(sbi);
 	f2fs_put_page(page, 1);
-- 
2.1.1


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

* RE: [f2fs-dev] [PATCH 1/2] f2fs: fix to call put_page at the error handling routine
  2014-11-18  1:57 [PATCH 1/2] f2fs: fix to call put_page at the error handling routine Jaegeuk Kim
  2014-11-18  1:57 ` [PATCH 2/2] f2fs: put the inode page when error was occurred Jaegeuk Kim
@ 2014-11-18  5:22 ` Chao Yu
  1 sibling, 0 replies; 5+ messages in thread
From: Chao Yu @ 2014-11-18  5:22 UTC (permalink / raw)
  To: 'Jaegeuk Kim', linux-kernel, linux-fsdevel, linux-f2fs-devel

> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> Sent: Tuesday, November 18, 2014 9:58 AM
> To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org;
> linux-f2fs-devel@lists.sourceforge.net
> Cc: Jaegeuk Kim
> Subject: [f2fs-dev] [PATCH 1/2] f2fs: fix to call put_page at the error handling routine
> 
> The locked page should be released before returning the function.

Good catch! I found this also, now removed from my patch set. :)

> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Reviewed-by: Chao Yu <chao2.yu@samsung.com>


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

* RE: [f2fs-dev] [PATCH 2/2] f2fs: put the inode page when error was occurred
  2014-11-18  1:57 ` [PATCH 2/2] f2fs: put the inode page when error was occurred Jaegeuk Kim
@ 2014-11-18  5:30   ` Chao Yu
  2014-11-19 22:33     ` Jaegeuk Kim
  0 siblings, 1 reply; 5+ messages in thread
From: Chao Yu @ 2014-11-18  5:30 UTC (permalink / raw)
  To: 'Jaegeuk Kim', linux-kernel, linux-fsdevel, linux-f2fs-devel

Hi Jaegeuk,

> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> Sent: Tuesday, November 18, 2014 9:58 AM
> To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org;
> linux-f2fs-devel@lists.sourceforge.net
> Cc: Jaegeuk Kim
> Subject: [f2fs-dev] [PATCH 2/2] f2fs: put the inode page when error was occurred
> 
> We should put the inode page when error was occurred.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

You can add Reviewed-by: Chao Yu <chao2.yu@samsung.com>
after the following issue is fixed.

> ---
>  fs/f2fs/data.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 8f16443..12dd58a 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -963,22 +963,22 @@ repeat:
>  		} else if (page->index == 0) {
>  			err = f2fs_convert_inline_page(&dn, page);
>  			if (err)
> -				goto unlock_fail;
> +				goto put_fail;
>  		} else {
>  			struct page *p = grab_cache_page(inode->i_mapping, 0);
>  			if (!p) {
>  				err = -ENOMEM;
> -				goto unlock_fail;
> +				goto put_fail;
>  			}
>  			err = f2fs_convert_inline_page(&dn, p);
>  			f2fs_put_page(p, 1);
>  			if (err)
> -				goto unlock_fail;
> +				goto put_fail;
>  		}
>  	}
>  	err = f2fs_reserve_block(&dn, index);
>  	if (err)
> -		goto unlock_fail;
> +		goto put_fail;

f2fs_reserve_block will do the clean work, we should not release dn again.

Thanks,
Yu

>  put_next:
>  	f2fs_put_dnode(&dn);
>  	f2fs_unlock_op(sbi);
> @@ -1021,6 +1021,8 @@ out:
>  	clear_cold_data(page);
>  	return 0;
> 
> +put_fail:
> +	f2fs_put_dnode(&dn);
>  unlock_fail:
>  	f2fs_unlock_op(sbi);
>  	f2fs_put_page(page, 1);
> --
> 2.1.1
> 
> 
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


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

* Re: [f2fs-dev] [PATCH 2/2] f2fs: put the inode page when error was occurred
  2014-11-18  5:30   ` [f2fs-dev] " Chao Yu
@ 2014-11-19 22:33     ` Jaegeuk Kim
  0 siblings, 0 replies; 5+ messages in thread
From: Jaegeuk Kim @ 2014-11-19 22:33 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-kernel, linux-fsdevel, linux-f2fs-devel

On Tue, Nov 18, 2014 at 01:30:46PM +0800, Chao Yu wrote:
> Hi Jaegeuk,
> 
> > -----Original Message-----
> > From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> > Sent: Tuesday, November 18, 2014 9:58 AM
> > To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org;
> > linux-f2fs-devel@lists.sourceforge.net
> > Cc: Jaegeuk Kim
> > Subject: [f2fs-dev] [PATCH 2/2] f2fs: put the inode page when error was occurred
> > 
> > We should put the inode page when error was occurred.
> > 
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> 
> You can add Reviewed-by: Chao Yu <chao2.yu@samsung.com>
> after the following issue is fixed.
> 
> > ---
> >  fs/f2fs/data.c | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > index 8f16443..12dd58a 100644
> > --- a/fs/f2fs/data.c
> > +++ b/fs/f2fs/data.c
> > @@ -963,22 +963,22 @@ repeat:
> >  		} else if (page->index == 0) {
> >  			err = f2fs_convert_inline_page(&dn, page);
> >  			if (err)
> > -				goto unlock_fail;
> > +				goto put_fail;
> >  		} else {
> >  			struct page *p = grab_cache_page(inode->i_mapping, 0);
> >  			if (!p) {
> >  				err = -ENOMEM;
> > -				goto unlock_fail;
> > +				goto put_fail;
> >  			}
> >  			err = f2fs_convert_inline_page(&dn, p);
> >  			f2fs_put_page(p, 1);
> >  			if (err)
> > -				goto unlock_fail;
> > +				goto put_fail;
> >  		}
> >  	}
> >  	err = f2fs_reserve_block(&dn, index);
> >  	if (err)
> > -		goto unlock_fail;
> > +		goto put_fail;
> 
> f2fs_reserve_block will do the clean work, we should not release dn again.

Well, I added this to handle errors consistently.
It's harmless, since f2fs_put_dnode removes the pointers after putting them.

Thanks,

> 
> Thanks,
> Yu
> 
> >  put_next:
> >  	f2fs_put_dnode(&dn);
> >  	f2fs_unlock_op(sbi);
> > @@ -1021,6 +1021,8 @@ out:
> >  	clear_cold_data(page);
> >  	return 0;
> > 
> > +put_fail:
> > +	f2fs_put_dnode(&dn);
> >  unlock_fail:
> >  	f2fs_unlock_op(sbi);
> >  	f2fs_put_page(page, 1);
> > --
> > 2.1.1
> > 
> > 
> > ------------------------------------------------------------------------------
> > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> > from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> > with Interactivity, Sharing, Native Excel Exports, App Integration & more
> > Get technology previously reserved for billion-dollar corporations, FREE
> > http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Linux-f2fs-devel mailing list
> > Linux-f2fs-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

end of thread, other threads:[~2014-11-19 22:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-18  1:57 [PATCH 1/2] f2fs: fix to call put_page at the error handling routine Jaegeuk Kim
2014-11-18  1:57 ` [PATCH 2/2] f2fs: put the inode page when error was occurred Jaegeuk Kim
2014-11-18  5:30   ` [f2fs-dev] " Chao Yu
2014-11-19 22:33     ` Jaegeuk Kim
2014-11-18  5:22 ` [f2fs-dev] [PATCH 1/2] f2fs: fix to call put_page at the error handling routine Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).