[PATCH] f2fs: get parent inode when recovering pino
From: Jaegeuk Kim
Date: Tue May 05 2020 - 11:31:42 EST
We had to grab the inode before retrieving i_ino.
Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>
---
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