From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752693AbcE0MXd (ORCPT ); Fri, 27 May 2016 08:23:33 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:42801 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751063AbcE0MXc (ORCPT ); Fri, 27 May 2016 08:23:32 -0400 Subject: Re: [PATCH] f2fs: Return the errno to the caller to avoid using a wrong page To: Jaegeuk Kim References: <1464181261-3980-1-git-send-email-yunlong.song@huawei.com> <20160525165438.GB47096@jaegeuk.gateway> CC: , , , , , , , , , , From: Yunlong Song Message-ID: <57483BEC.8020402@huawei.com> Date: Fri, 27 May 2016 20:22:04 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20160525165438.GB47096@jaegeuk.gateway> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.74.205] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090204.57483C08.010D,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 49c3eacc54f2469649749e5f3764c36b Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016/5/26 0:54, Jaegeuk Kim wrote: > Hi Yunlong, > > Do we have a bug report in terms of this? > Hi Kim, I found the old following patch, you have mentioned one reason why "nid != nid_of_node(page)" in that commit message. http://git.kernel.org/cgit/linux/kernel/git/jaegeuk/f2fs.git/commit/?h=dev&id=3bb5e2c8fe2296ddd9d864dcfb5ee1b77135f3ec commit 3bb5e2c8fe2296ddd9d864dcfb5ee1b77135f3ec Author: Jaegeuk Kim Date: Tue Apr 1 17:38:26 2014 +0900 f2fs: return -EIO when node id is not matched During the cleaing of node segments, F2FS can get errored node blocks due to data race between node page lock and its valid bitmap operations. In that case, it needs to return an error to skip such the obsolete block copy. Signed-off-by: Jaegeuk Kim diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index eced8d7..065cd99 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -958,7 +958,7 @@ repeat: goto got_it; lock_page(page); - if (unlikely(!PageUptodate(page))) { + if (unlikely(!PageUptodate(page) || nid != nid_of_node(page))) { f2fs_put_page(page, 1); return ERR_PTR(-EIO); } @@ -967,7 +967,6 @@ repeat: goto repeat; } got_it: - f2fs_bug_on(nid != nid_of_node(page)); mark_page_accessed(page); return page; } -- Thanks, Yunlong Song