Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp278931ybg; Wed, 3 Jun 2020 00:08:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyL82P2bAl8Q3P9T1EU5gWH7eG3/vts2yw3qSqtrMot9KQvXKhpzsDjaLAzKzc3cnQyVk9W X-Received: by 2002:a50:ee8f:: with SMTP id f15mr30210968edr.168.1591168123233; Wed, 03 Jun 2020 00:08:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591168123; cv=none; d=google.com; s=arc-20160816; b=M8D0g+Gx834X3Opznn1GTsxxq+xVqDUwTxKnEeHzJ06gP6sk43ag8aLGcfIcClH3Jj +CDY1cTB5tX706a8CqgaNRcVqebzUKRyblG3XNch6XljQrASizBMJYUgiEi2aikY70qD XtxYKbhg5mXlsNxQ436qvnv4Gq4UrRkGkwlRvzzY/+bArakYm53r0FIM9XLN/1bcpS63 BbWIOTeA9ZPJDkJ60ZJhBj+GU1x66w7U8nrSot7bXykU2K72TG8E1aBLOq/0UgmHy/aM sTZSHPDRNwswsGXSeuVnn20WpPgj7xmu6WuwMoXmaisLpeU8X58eufPg4BQfzhdd+J2e vjpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=UFCTIuaj8xz+aKHpreeFlNyCdIKgQpq07UVVXvstL7I=; b=pdbuIRDON2ncq7GeY/hkXaRdikPtD3zJExLM4Vk8Tyj9Uyf+tEUduNSUuPQ5RC+O22 frio3VNaqyCKnDWLSx7hkmFx9yNNAHKopsfo8WMVSsYcdWAiTF8FpAmgwZKdHaspVZ6Q 1Aqgz0WkKAM49HRhJf5DY32QFWA2TPl4V4SEv7LVRUV/rKmDLKsqvnlaIDxv46WEJInm FDlRjvG8lxTlJZNRMCw5M0VdS5Azo8tKx71uHrs5jmjfZ/3RnETDcLBvXkjhhY8HlMUq iH+xYEuarMLq49slKTcyFGfx/z8yV1lKJ7rQWUwGIh/RJpejpT4izl5EQfvnK43kzLkb qW8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UxBiurAZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dt5si763583ejc.335.2020.06.03.00.08.15; Wed, 03 Jun 2020 00:08:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UxBiurAZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725905AbgFCHGb (ORCPT + 99 others); Wed, 3 Jun 2020 03:06:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725854AbgFCHGb (ORCPT ); Wed, 3 Jun 2020 03:06:31 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9510CC05BD43 for ; Wed, 3 Jun 2020 00:06:29 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id u16so621907lfl.8 for ; Wed, 03 Jun 2020 00:06:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=UFCTIuaj8xz+aKHpreeFlNyCdIKgQpq07UVVXvstL7I=; b=UxBiurAZREXPM1HURsDXeYCy3qhAcKEZrySeaFpPyV87adNdAKo0BKKYlwWq2IHwfm 0yQSrZDcAsHv8HDwYjfllWB/TnnK1+gQYE9/JODt80oWHfaCr74epyYzWYK4UGPOLo6I TfpZjUzYdLG8NiurklMPPvLtL5jUecgKiBdluuf9d7aCk5EGzoZqIf2PURl3j+vsdfci idmGOrK1kTD/Qdia/QpWXC2sYkeUCZ+KMNfElBydHvXfi+HJyJA/xdNN7SD9CDeLWAPm 5MaaaYe/msa6giALcnqvYPEplF7GnA9QFk3USsXLxptgYah4UkV3zrwmF0LOvtpEm/5a 8sqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=UFCTIuaj8xz+aKHpreeFlNyCdIKgQpq07UVVXvstL7I=; b=Rua2bzyiu2H1Zp8amBghoAVPyVSohPBuIJk1aO1dsW7DgA8iPg1PpJ6smIjUCfqJaD 3EKnch9x5rCWS+JuFWgdTsgf0w58CVzVR6k3L55bE99JHcQA1CiqDEfR8OGPRHD+G2zR A+La628twL3YM2C8yWgEikCSLaYUgPPhTOdMMMrWqVv6fY5J7wP9FFhN5fQEOACYVvNO xiA/DG2uZdN0UiZiIIWz854gSR4GR0AfM9LRCampeDuYkobovHSXHcZpGqCu49LgZ8gP fiWLr3JS7QyUt/rrnbj24Gww5xrPVutRZo/BnifX3BttT3iB0Q8LRWL60zNZ2GhJOKVT YfnQ== X-Gm-Message-State: AOAM533k8paU1b0TjO+/wRGfflsYntyUyAYwNvQj5RUm5A45Ego2hdMc gHBScWNt1SIyX6ni/QXT6qrzmyEA78CtIL9PdGo= X-Received: by 2002:a19:fc15:: with SMTP id a21mr1641142lfi.121.1591167987856; Wed, 03 Jun 2020 00:06:27 -0700 (PDT) MIME-Version: 1.0 References: <20200601030347.112984-1-daeho43@gmail.com> In-Reply-To: From: Daeho Jeong Date: Wed, 3 Jun 2020 16:06:15 +0900 Message-ID: Subject: Re: [PATCH] f2fs: protect new segment allocation in expand_inode_data To: Chao Yu Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com, Daeho Jeong Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Oh, thanks for notification! 2020=EB=85=84 6=EC=9B=94 3=EC=9D=BC (=EC=88=98) =EC=98=A4=ED=9B=84 3:59, Ch= ao Yu =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > On 2020/6/1 11:03, Daeho Jeong wrote: > > From: Daeho Jeong > > > > Found a new segemnt allocation without f2fs_lock_op() in > > expand_inode_data(). So, when we do fallocate() for a pinned file > > and trigger checkpoint very frequently and simultaneously. F2FS gets > > stuck in the below code of do_checkpoint() forever. > > > > f2fs_sync_meta_pages(sbi, META, LONG_MAX, FS_CP_META_IO); > > /* Wait for all dirty meta pages to be submitted for IO */ > > <=3D if fallocate() her= e, > > f2fs_wait_on_all_pages(sbi, F2FS_DIRTY_META); <=3D it'll wait forever= . > > > > Signed-off-by: Daeho Jeong > > Reviewed-by: Chao Yu > > Daeho, > > I guess Jaegeuk could add the tag when merging this patch, we don't have > to resend the patch if there is no updates on code and message. > > Thanks, > > > --- > > fs/f2fs/file.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > > index f7de2a1da528..14ace885baa9 100644 > > --- a/fs/f2fs/file.c > > +++ b/fs/f2fs/file.c > > @@ -1660,7 +1660,11 @@ static int expand_inode_data(struct inode *inode= , loff_t offset, > > > > down_write(&sbi->pin_sem); > > map.m_seg_type =3D CURSEG_COLD_DATA_PINNED; > > + > > + f2fs_lock_op(sbi); > > f2fs_allocate_new_segments(sbi, CURSEG_COLD_DATA); > > + f2fs_unlock_op(sbi); > > + > > err =3D f2fs_map_blocks(inode, &map, 1, F2FS_GET_BLOCK_PR= E_DIO); > > up_write(&sbi->pin_sem); > > > >