Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp771882ybc; Sat, 16 Nov 2019 08:24:51 -0800 (PST) X-Google-Smtp-Source: APXvYqzjndZVN3UbGlt7QUTgyCaqkuVlgWb4rzoae9YDJgWh/xonuNo+HgryjM5B9dGgooUdXldD X-Received: by 2002:a17:906:1354:: with SMTP id x20mr11184780ejb.131.1573921491288; Sat, 16 Nov 2019 08:24:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573921491; cv=none; d=google.com; s=arc-20160816; b=QZlgCLULMSHXA6Xy+8CLk3zTPWoc6DSbKs6KytnqIBusVtgi83LmYtKZRF0Z5BxC0W KVBU03e7ssCmch4yIrec4FWNbnyY8NfRlQlde0ZO5tQ1U7pIeCyNha+bpQEr0VJeUqxx DbnS6tfiQKzNj84N6xDNWqxbZjkhsjHW2pAk6SUTWPdMAffemSATsU+uMA31rHMW7Qak EU78E/IBRCsr4Bg888/URZDVazBXagpgT9Vi0r7kIO1hMFvxVryId/ZaCBjrRlRDsnr0 X1iTj48Csyt6m5nnXmnz0Aczrz3BEcIZnU+qNBbqeAfXGnjpwHWjsAvOtBDHHtF0rRoo k0Vw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VV/wOMD2eSLHoqAJMvCv3c00adfjAvtwgyaQszL4N1w=; b=k9tt1AaIyRgIV7YPtdtC1e66/bTneyUC87W3MAuIoNfmX1SuFNf1CTL8xb/EjOUL0r CzSBjGfxCRTdArKIOb5BOnVUvLMQPSzUEKOLuBKZqHzpU9mEqyDyraEuJQLzC6kGIlXb TFC8nw64EIYXUjyEdJLLCg6hevpNyGtoAJ4GlDiciR0SXvNNvurvbN/X16HukurRAIQ7 040WSe4RGlarovfEYc0wuW6TfaXSP0F+43GV/QMzeif9dvT0yKVqD6D63odfwmLbinDb pkmtCgbE0HVI2oViPwcc7SGm1k+VQJCu8tofqOrbWJ+qdUGa/btg9ZJQd7qJvLyRW9JM H8mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QApM3epZ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e18si7884773ejq.399.2019.11.16.08.24.26; Sat, 16 Nov 2019 08:24:51 -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=QApM3epZ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730138AbfKPQWG (ORCPT + 99 others); Sat, 16 Nov 2019 11:22:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:47352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728693AbfKPPnW (ORCPT ); Sat, 16 Nov 2019 10:43:22 -0500 Received: from sasha-vm.mshome.net (unknown [50.234.116.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B5523207DD; Sat, 16 Nov 2019 15:43:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573919002; bh=On0GqOyxsloTEVa6hsuBGk6Zfg6op1AFEmlN8rwIm8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QApM3epZXKxZXlA3fT7DxgTL1u3w5bzuDDYzbzjDfTkG1C5msEW1bh+iLgmUfqZoO QJnR29TAM4WdmTlmGGuwlVAxQ/866kOeqBJhLMzSqI8T7a7aX94mTwbma1UqWCBycz S53UZ2SP99xY14cZVCyp+ztDEeyKtzx0rCxksteM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Chao Yu , Jaegeuk Kim , Sasha Levin , linux-f2fs-devel@lists.sourceforge.net Subject: [PATCH AUTOSEL 4.19 105/237] f2fs: spread f2fs_set_inode_flags() Date: Sat, 16 Nov 2019 10:39:00 -0500 Message-Id: <20191116154113.7417-105-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191116154113.7417-1-sashal@kernel.org> References: <20191116154113.7417-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 fb216488d67a9..c9d19832426b1 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3387,7 +3387,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 d9106bbe7df63..7aefb2c35c48f 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1835,8 +1835,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); @@ -1861,7 +1860,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