Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1971454ima; Thu, 25 Oct 2018 07:45:45 -0700 (PDT) X-Google-Smtp-Source: AJdET5fVdpX0FfyS5JPnsuah0TW2Kx7dxx0RWYzC3DxdHufANcaXyxrShNAvEDLIEXoOTbaj4OKi X-Received: by 2002:a62:670f:: with SMTP id b15-v6mr1812907pfc.243.1540478745508; Thu, 25 Oct 2018 07:45:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540478745; cv=none; d=google.com; s=arc-20160816; b=d8xbjUn6zVHBfkSPldKvpfJTXfyAGv5nJgc8S7/OE3LXaMqbvvsdRKqWru3YR4RVqP wIuSAA++Drl5JqwlaVQZbOi1vWbt+D7GOzw6hhID07NsZW0Ct7/UtT91ULJXCruApbDD ybTNwNqYG3HToFPVDoxh7bq5rbpS8xYuWiEbimg5ws93FzqURI7gHtjtvdBevarOQF58 CmES9PPmCMOXWJZpog/BopjdZ+jfoLzjJ8Njrs4PRxcXV6hjO0xE76CIFyVFmHtDsKOv E1V85hjmDODNBC1KuYumRxgzPZXZnL8gO8jP3ZjigWxXpPjILIUzxrs94UoJN7dNv6jg z39g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=XPuLCAIo3FnmMcb2RIfmJTY2pkpZEBvXGOf8GKKCwqo=; b=LFdGXfFhWZvAM8gUXwBnjPO8Vcr1exBaUzV+9FM0L1qiW2YPhLvqgGPYOGlsx8mFKO fnA9TwJeW0/qqxPRGOH9Lq689emjw0CX0uFD2o0MZz3TxckMe92LPDOwpV+D0LDu0nXT MQxDW7IMpi8zd+r2aFpjGWrAcBFXKzM4WFb7eKjGqDyPNBva18MWmAp3yAo7ITNPUx5x m01+J6XjDzcPiSISPwg2MSn3Cyn4sgTg8JV8xPNS+JYTcSU3DwIb3vonX8spLzOfypwZ iBE6xh6XtSpQmKk0wohpVjDPd55dhkpxfmuyGk5FiOCS2pWnJWcXrlmZQ6XjUjIsq8JI l8yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EWWvLIV2; 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 b137-v6si34991pfb.144.2018.10.25.07.45.27; Thu, 25 Oct 2018 07:45:45 -0700 (PDT) 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=EWWvLIV2; 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 S1728559AbeJYWre (ORCPT + 99 others); Thu, 25 Oct 2018 18:47:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:55596 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728532AbeJYWrd (ORCPT ); Thu, 25 Oct 2018 18:47:33 -0400 Received: from sasha-vm.mshome.net (unknown [167.98.65.38]) (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 1360820856; Thu, 25 Oct 2018 14:14:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540476877; bh=r+BP4uZoLG1zK5wUhXp9vFFcPCLQIBwbaCPHVBnpjKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EWWvLIV2lrAl5IysfXGhQxO4pHNR5L6EXVb5HyVc0UEAhQ9qyezenQLbYnOBudUIe 4kTEynoaOi2pV5HtCcWJKB07OGrSSLcM/MlHKui2norX+U6egBySBIhDsZCXnQEEh3 v1ujCrCaKAYCTgVHipzGP7ML2MhtxVn4oCxh1I/s= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sheng Yong , Jaegeuk Kim , Sasha Levin Subject: [PATCH AUTOSEL 4.9 06/98] f2fs: fix multiple f2fs_add_link() having same name for inline dentry Date: Thu, 25 Oct 2018 10:12:51 -0400 Message-Id: <20181025141423.213774-6-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025141423.213774-1-sashal@kernel.org> References: <20181025141423.213774-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sheng Yong [ Upstream commit d3bb910c15d75ee3340311c64a1c05985bb663a3 ] Commit 88c5c13a5027 (f2fs: fix multiple f2fs_add_link() calls having same name) does not cover the scenario where inline dentry is enabled. In that case, F2FS_I(dir)->task will be NULL, and __f2fs_add_link will lookup dentries one more time. This patch fixes it by moving the assigment of current task to a upper level to cover both normal and inline dentry. Cc: Fixes: 88c5c13a5027 (f2fs: fix multiple f2fs_add_link() calls having same name) Signed-off-by: Sheng Yong Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/dir.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 8add4e8bab99..af719d93507e 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -212,13 +212,9 @@ static struct f2fs_dir_entry *find_in_level(struct inode *dir, f2fs_put_page(dentry_page, 0); } - /* This is to increase the speed of f2fs_create */ - if (!de && room) { - F2FS_I(dir)->task = current; - if (F2FS_I(dir)->chash != namehash) { - F2FS_I(dir)->chash = namehash; - F2FS_I(dir)->clevel = level; - } + if (!de && room && F2FS_I(dir)->chash != namehash) { + F2FS_I(dir)->chash = namehash; + F2FS_I(dir)->clevel = level; } return de; @@ -259,6 +255,9 @@ struct f2fs_dir_entry *__f2fs_find_entry(struct inode *dir, break; } out: + /* This is to increase the speed of f2fs_create */ + if (!de) + F2FS_I(dir)->task = current; return de; } -- 2.17.1