Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6017776ybc; Wed, 27 Nov 2019 13:29:31 -0800 (PST) X-Google-Smtp-Source: APXvYqxFyP8lkgN4cWHdnK2XPRA9G8ZuB0MXmHSQmpexqToQN5UOREtZb2ZOnBD/Dfc7Shim+x4U X-Received: by 2002:a17:906:40a:: with SMTP id d10mr2424992eja.65.1574890171455; Wed, 27 Nov 2019 13:29:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574890171; cv=none; d=google.com; s=arc-20160816; b=ZLMv2K03tM0MpoLQx5y55ssHGE+9M3W3WhzXd1GgRLizsHRom+6oWJBoydB3oNo84n 8siD+5tBpGYFUCHfTK0wi4GoSg+8A18aMW4Z8J2MA9lC037HB64M59NYhpKr8Twp16Xn p/ruobO6GjLVb8TymdL4Indo/denwNdDpuEwpv1di6buDBC5IiDaBaiOL5J1dopiEmNJ n+CuWaGG+1c4h0/8vsE/Jm39uJBDMlevYW3xiRrvRJ1UsPrsCgxxanmzD22BHu5LHATN 41V/sko/MrlDT68CKvT17rsQrSxdj3BF+CuL8wmnVmZgrNyOQPyPVGwhQ0ZU4Wc5otD3 JT9A== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=L1W9i6pd8jqIsoBHI7VGCULOQc+gBzkyhHHOOALcBuc=; b=gWWBphVD2e0tI8WgEz5IRe/Q1QAKPwwWkBf3e9N6DkXlIDh6ZpVqiWod40etV28++j q6lk2yLWyNlXBu10Fo7iaR9GhgZJgPPMdhXl0x/G5xPO96BpftlkTsKRYCjoQvQsJ+3P TpbOgUba5d2/Q+hr0cEC/u8grbCKVqyznFcANSPoQlOH+W0AocsL999eUs8Q5ZlR5zAP VOwkjqlNZet2HlZhNsKTKFO9b1HGjUPuEa31gZm+vmGdKnsEr40fs6h23Dy02pxS8SJw LXiGkFeFn7iE+52b1GE6nP1R9Wa9uBGQtyjcYYNBnWH60F2UPLXP2r/quVZ43ZjATkD2 prKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LGKuMGAA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e24si10356918ejx.220.2019.11.27.13.29.07; Wed, 27 Nov 2019 13:29:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LGKuMGAA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730749AbfK0VAQ (ORCPT + 99 others); Wed, 27 Nov 2019 16:00:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:51906 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731269AbfK0VAK (ORCPT ); Wed, 27 Nov 2019 16:00:10 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 65CE02084B; Wed, 27 Nov 2019 21:00:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888409; bh=b6JKrXfZ3sW46mtc8cUPJf+7pJXsH6mrbwPNqmM5xCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LGKuMGAAU/MJblrJ5TrBN2n4th4QSRqbYt+yNhxuVP5/wIUUxmqzjrlATLptNHPQR xLbn525GaN2+sOvGREe/k6IoxN8/zBXFqbNGt11fLQLh/kNkWu33ywg9IGIt7anOQm 91cVLuUTy82u/BuSWZvQpwTygds5juZ39aheqsSs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 4.19 123/306] f2fs: spread f2fs_set_inode_flags() Date: Wed, 27 Nov 2019 21:29:33 +0100 Message-Id: <20191127203124.116784284@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chao Yu [ Upstream commit 9149a5eb606152df158eb7d7da5a34e84b574189 ] This patch changes codes as below: - use f2fs_set_inode_flags() to update i_flags atomically to avoid potential race. - synchronize F2FS_I(inode)->i_flags to inode->i_flags in f2fs_new_inode(). - use f2fs_set_inode_flags() to simply codes in f2fs_quota_{on,off}. Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/f2fs.h | 2 +- fs/f2fs/namei.c | 2 ++ fs/f2fs/super.c | 5 ++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 2dc49a5419070..34e48bcf50874 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3388,7 +3388,7 @@ static inline void f2fs_set_encrypted_inode(struct inode *inode) { #ifdef CONFIG_F2FS_FS_ENCRYPTION file_set_encrypt(inode); - inode->i_flags |= S_ENCRYPTED; + f2fs_set_inode_flags(inode); #endif } diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 1f67e389169f5..6b23dcbf52f45 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -124,6 +124,8 @@ static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode) if (F2FS_I(inode)->i_flags & F2FS_PROJINHERIT_FL) set_inode_flag(inode, FI_PROJ_INHERIT); + f2fs_set_inode_flags(inode); + trace_f2fs_new_inode(inode, 0); return inode; diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 15779123d0895..7a9cc64f5ca37 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1837,8 +1837,7 @@ static int f2fs_quota_on(struct super_block *sb, int type, int format_id, inode_lock(inode); F2FS_I(inode)->i_flags |= F2FS_NOATIME_FL | F2FS_IMMUTABLE_FL; - inode_set_flags(inode, S_NOATIME | S_IMMUTABLE, - S_NOATIME | S_IMMUTABLE); + f2fs_set_inode_flags(inode); inode_unlock(inode); f2fs_mark_inode_dirty_sync(inode, false); @@ -1863,7 +1862,7 @@ static int f2fs_quota_off(struct super_block *sb, int type) inode_lock(inode); F2FS_I(inode)->i_flags &= ~(F2FS_NOATIME_FL | F2FS_IMMUTABLE_FL); - inode_set_flags(inode, 0, S_NOATIME | S_IMMUTABLE); + f2fs_set_inode_flags(inode); inode_unlock(inode); f2fs_mark_inode_dirty_sync(inode, false); out_put: -- 2.20.1