f2fs: fix to call put_page at the error handling routine
Subsystems (2)
Jaegeuk Kim
maintainerPATCH 1/2 f2fs: fix to call put_page at the error handling routine
The locked page should be released before returning the function.
--- fs/f2fs/inline.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/f2fs/inline.c +3 -3
@@ -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 );
Signature · 1 line
2.1.1
Jaegeuk Kim
maintainerPATCH 2/2 f2fs: put the inode page when error was occurred
We should put the inode page when error was occurred.
--- fs/f2fs/data.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
fs/f2fs/data.c +6 -4
@@ -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 );
Signature · 1 line
2.1.1
RE: [f2fs-dev] [PATCH 2/2] f2fs: put the inode page when error was occurred
Hi Jaegeuk,
Quoted 11 lines
-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Tuesday, November 18, 2014 9:58 AM
To: [email protected]; [email protected]; [email protected]
Cc: Jaegeuk Kim
Subject: [f2fs-dev] [PATCH 2/2] f2fs: put the inode page when error was occurredWe should put the inode page when error was occurred.
Signed-off-by Jaegeuk Kim <[email protected]>
You can add Reviewed-by: Chao Yu <[email protected]> after the following issue is fixed.
Quoted 22 lines
--- fs/f2fs/data.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)fs/f2fs/data.c +2
-2@@ -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);
fs/f2fs/data.c repeat: · line 981
Quoted 10 lines
fs/f2fs/data.c +2
-2f2fs_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
Quoted 26 lines
fs/f2fs/data.c +2
-1put_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 [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Jaegeuk Kim
maintainerRe: [f2fs-dev] [PATCH 2/2] f2fs: put the inode page when error was occurred
Quoted 43 lines · Chao Yu
Hi Jaegeuk,
Quoted 11 lines
-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Tuesday, November 18, 2014 9:58 AM
To: [email protected]; [email protected]; [email protected]
Cc: Jaegeuk Kim
Subject: [f2fs-dev] [PATCH 2/2] f2fs: put the inode page when error was occurredWe should put the inode page when error was occurred.
Signed-off-by Jaegeuk Kim <[email protected]>You can add Reviewed-by: Chao Yu <[email protected]> after the following issue is fixed.
Quoted 26 lines
--- fs/f2fs/data.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)fs/f2fs/data.c +3
-3@@ -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;
Quoted 8 lines
fs/f2fs/data.c repeat: · line 981
Quoted 6 lines
fs/f2fs/data.c +1
-1} } err =f2fs_reserve_block (&dn, index);if (err) - goto unlock_fail; + goto put_fail;
f2fs_reserve_blockwill 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,
Quoted 20 lines
Thanks,
YuQuoted 16 lines
fs/f2fs/data.c +2
-1put_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
Quoted 10 lines
Quoted 10 lines
------------------------------------------------------------------------------
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
------------------------------------------------------------------------------
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
Quoted 9 lines
-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Tuesday, November 18, 2014 9:58 AM
To: [email protected]; [email protected]; [email protected]
Cc: Jaegeuk Kim
Subject: [f2fs-dev] [PATCH 1/2] f2fs: fix to callput_pageat the error handling routineThe locked page should be released before returning the function.
Good catch! I found this also, now removed from my patch set. :)
Quoted 2 lines
Signed-off-by Jaegeuk Kim <[email protected]>