From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751559AbdFGJlS (ORCPT ); Wed, 7 Jun 2017 05:41:18 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:7767 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751441AbdFGJlQ (ORCPT ); Wed, 7 Jun 2017 05:41:16 -0400 Subject: Re: [PATCH v2 1/2] f2fs: dax: fix races between page faults and truncating pages To: sunqiuyang , , , References: <1495076805-18082-1-git-send-email-sunqiuyang@huawei.com> From: Chao Yu Message-ID: <29f704b5-b187-9c26-c60e-8459fa03a710@huawei.com> Date: Wed, 7 Jun 2017 17:41:07 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <1495076805-18082-1-git-send-email-sunqiuyang@huawei.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.134.22.195] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.5937CA3A.008E,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: c5480c857a06ab5d7362a2a9c2334ea1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017/5/18 11:06, sunqiuyang wrote: > From: Qiuyang Sun > > Currently in F2FS, page faults and operations that truncate the pagecahe > or data blocks, are completely unsynchronized. This can result in page > fault faulting in a page into a range that we are changing after > truncating, and thus we can end up with a page mapped to disk blocks that > will be shortly freed. Filesystem corruption will shortly follow. > > This patch fixes the problem by creating new rw semaphore i_mmap_sem in > f2fs_inode_info and grab it for functions removing blocks from extent tree > and for read over page faults. The mechanism is similar to that in ext4. > > Signed-off-by: Qiuyang Sun Reviewed-by: Chao Yu