Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp852885ybj; Tue, 5 May 2020 08:33:30 -0700 (PDT) X-Google-Smtp-Source: APiQypLKDqf5+jCePrqp10rt+2DOHMPqfYjwvx4CfdZHbkjNUBsXVqdHNwTOlydydJMzEdvgEKQL X-Received: by 2002:a17:906:4356:: with SMTP id z22mr3200806ejm.334.1588692810402; Tue, 05 May 2020 08:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588692810; cv=none; d=google.com; s=arc-20160816; b=jWjLXOETVgJ2MvUtlbVWMsom5RvapbOnsdMZBFQ7UWLTuHe1yThprRy1/0iTm80jEA MY3Crn/IPSU/wHQl55JggzRMYAielGlsZLIAGZV0Qi6zadTdV5WOXNhBjTD354QWjGFf t865DaP1fjjE2CcF2Yvzkg+smppJbfrutmEa1nXZEImpGsikWYnBydOZPKol+c1yNFaN q9xSqPcuc29uqlab5R+nna6AaPe9muFOdDFVSESuS6mq4EEthV+dXLlrOhy3ePajmmfr 4l+xHOM12pQrQATBWB/dL6dKPDc4J3+/QrLjulTQAQ6nsOj5zr5EdUx9nCrbjWCX0Nga ytLQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=qRMqs1NWT0EJoNLiZi9tch/aJJEOCcUJnI2JM4phLRM=; b=hk/uw5UU/NfCWs4pYoaRjOuaJ76tPjPV7YKaLszM0wBNUdJVPi0cUJCMTT7cLs5+92 KdMJsFp08OAfQ7L5MJhQ8ZwyKWqhHAWVx4uOcaQ9kT8Y9SDVBaXR6Fdt42xdAwevX1BN d8825VwIMrg4+V/to2wNIKIZrXMJ6HFjSFnod5EEsPTq44t6MlnVoAcKWJ6SESWKHPhR bOag9aexjo8IsAZy0KnXyg4RIqSx0wuw11FTeyrCtR9MxPtbI5naqDsPbldlFVFM2aEw pNI8r8DCGzLXnnLDA7rcpe0nwj1n3k+c11UtntK6bFWTXWG3ko6+/DWcIp5kalZs2aNd kQrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HVY0pEgb; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn6si1484205edb.514.2020.05.05.08.33.06; Tue, 05 May 2020 08:33:30 -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=@kernel.org header.s=default header.b=HVY0pEgb; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729729AbgEEPbk (ORCPT + 99 others); Tue, 5 May 2020 11:31:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:59980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729281AbgEEPbk (ORCPT ); Tue, 5 May 2020 11:31:40 -0400 Received: from localhost (unknown [104.132.1.66]) (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 3EDF92078C; Tue, 5 May 2020 15:31:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588692700; bh=10UQQl3GPfT8mcIMbnLtvCSvPWaMAUPM/kBH8ajFl40=; h=From:To:Cc:Subject:Date:From; b=HVY0pEgbAVyz6IqLvBZ+IAFiCCA7HoCpCBshkAB7xGhGO4uSDrUtwD2ZVCZ9I4C+C jbloa10/2h+K7Ygp7jK04JFUsG6e0EtkkH/eTnRXAMrtKnRkaoO6ETvjAO0Z9+36t5 aVt+W3WZEw3RkFaT4DxJJAMSc7dYncstrhRsW7bA= From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com Cc: Jaegeuk Kim Subject: [PATCH] f2fs: get parent inode when recovering pino Date: Tue, 5 May 2020 08:31:39 -0700 Message-Id: <20200505153139.201697-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We had to grab the inode before retrieving i_ino. Signed-off-by: Jaegeuk Kim --- fs/f2fs/file.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index a0a4413d6083b..9d4c3e3503567 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -168,6 +168,7 @@ static const struct vm_operations_struct f2fs_file_vm_ops = { static int get_parent_ino(struct inode *inode, nid_t *pino) { struct dentry *dentry; + struct inode *parent; inode = igrab(inode); dentry = d_find_any_alias(inode); @@ -175,8 +176,13 @@ static int get_parent_ino(struct inode *inode, nid_t *pino) if (!dentry) return 0; - *pino = parent_ino(dentry); + parent = igrab(d_inode(dentry->d_parent)); dput(dentry); + if (!parent) + return 0; + + *pino = parent->i_ino; + iput(parent); return 1; } -- 2.26.2.526.g744177e7f7-goog