Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751382AbbG2JdH (ORCPT ); Wed, 29 Jul 2015 05:33:07 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:35846 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751101AbbG2JdF (ORCPT ); Wed, 29 Jul 2015 05:33:05 -0400 X-AuditID: cbfee61b-f79706d000001b96-bf-55b89dc521c6 From: Chao Yu To: "'Jaegeuk Kim'" Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net References: <1437870077-46892-1-git-send-email-jaegeuk@kernel.org> <1437870077-46892-2-git-send-email-jaegeuk@kernel.org> <00e301d0c91f$d303dfc0$790b9f40$@samsung.com> <20150728155705.GA57016@jaegeuk-mac02.hsd1.ca.comcast.net> In-reply-to: <20150728155705.GA57016@jaegeuk-mac02.hsd1.ca.comcast.net> Subject: RE: [f2fs-dev] [PATCH 2/2] f2fs: handle error cases in commit_inmem_pages Date: Wed, 29 Jul 2015 17:32:00 +0800 Message-id: <011a01d0c9e1$8ead48d0$ac07da70$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AQIpV6pP3uJp8GhJxVQThoJEA1KeQAKfPjODAuGNZPMAnboQJ50P99/A Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRmVeSWpSXmKPExsVy+t9jAd2jc3eEGrztNrJ4sn4Ws8WlRe4W e/aeZLG4vGsOmwOLx6ZVnWweuxd8ZvL4vEkugDmKyyYlNSezLLVI3y6BK2PHs7dsBR+FK24+ W8XawPiRv4uRk0NCwETi7/HfrBC2mMSFe+vZuhi5OIQEljJKdB7bwwrhvGKUeHb/PDtIFZuA isTyjv9MILaIgJpE774pYDazQKbEhP4XYDVCAi8YJa7dlwGxOQXcJdbcWcMCYgsLhEhcm3YD rJ5FQFXi04IdYHFeAUuJGc9nMkLYghI/Jt9jgZipJbF+53Go+fISm9e8ZYa4VEFix9nXjBA3 uEm8/zyFEaJGXGLjkVssExiFZiEZNQvJqFlIRs1C0rKAkWUVo0RqQXJBcVJ6rlFearlecWJu cWleul5yfu4mRnAEPJPewXh4l/shRgEORiUe3hk6O0KFWBPLiitzDzFKcDArifAGzQAK8aYk VlalFuXHF5XmpBYfYpTmYFES59U32RQqJJCeWJKanZpakFoEk2Xi4JRqYLQssDrA8mPOuRKp uYFZe5m1zxVtUVuZznFkZUeWzP8n3UXbFx8tyD3OV6zJJP414UF4ctSWL1s6lTeHRd+Mm2G1 8waP5aP5J6rcw56xPs3mTT0SlyoncXPaxQa++WGX60S7cypTz+iVTvF3vLdC3mHrvmvL5Ww3 nJ2ubHhz8pMJT503Zy42SFNiKc5INNRiLipOBAB9c4/sfAIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2720 Lines: 75 Hi Jaegeuk, > -----Original Message----- > From: Jaegeuk Kim [mailto:jaegeuk@kernel.org] > Sent: Tuesday, July 28, 2015 11:57 PM > To: Chao Yu > Cc: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org; > linux-f2fs-devel@lists.sourceforge.net > Subject: Re: [f2fs-dev] [PATCH 2/2] f2fs: handle error cases in commit_inmem_pages > > On Tue, Jul 28, 2015 at 06:25:26PM +0800, Chao Yu wrote: > > Hi Jaegeuk, > > > > > -----Original Message----- > > > From: Jaegeuk Kim [mailto:jaegeuk@kernel.org] > > > Sent: Sunday, July 26, 2015 8:21 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: handle error cases in commit_inmem_pages > > > > > > This patch adds to handle error cases in commit_inmem_pages. > > > If an error occurs, it stops to write the pages and return the error right > > > away. > > > > > > Signed-off-by: Jaegeuk Kim > > > --- > > > fs/f2fs/f2fs.h | 2 +- > > > fs/f2fs/file.c | 6 ++++-- > > > fs/f2fs/segment.c | 10 ++++++++-- > > > 3 files changed, 13 insertions(+), 5 deletions(-) > > > > > > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > > > index e73f2e2..58b05b5 100644 > > > --- a/fs/f2fs/f2fs.h > > > +++ b/fs/f2fs/f2fs.h > > > @@ -1697,7 +1697,7 @@ void destroy_node_manager_caches(void); > > > * segment.c > > > */ > > > void register_inmem_page(struct inode *, struct page *); > > > -void commit_inmem_pages(struct inode *, bool); > > > +int commit_inmem_pages(struct inode *, bool); > > > void f2fs_balance_fs(struct f2fs_sb_info *); > > > void f2fs_balance_fs_bg(struct f2fs_sb_info *); > > > int f2fs_issue_flush(struct f2fs_sb_info *); > > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > > > index 25d1a2f..a2b3656 100644 > > > --- a/fs/f2fs/file.c > > > +++ b/fs/f2fs/file.c > > > @@ -1358,7 +1358,9 @@ static int f2fs_ioc_commit_atomic_write(struct file *filp) > > > > > > if (f2fs_is_atomic_file(inode)) { > > > clear_inode_flag(F2FS_I(inode), FI_ATOMIC_FILE); > > > - commit_inmem_pages(inode, false); > > > + ret = commit_inmem_pages(inode, false); > > > + if (ret) > > > + return ret; It looks we forget to call mnt_drop_write_file before return. [snip] > This entry is not removed from the list. > So, after failure, the abort path will put the page and remove it from the list. Oh, you're right, thanks for your explanation! :) Thanks, -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/