Skip to contentSkip to conversation

f2fs: Fix for parent inode information during server cache eviction

PATCH In review Namjae Jeon 2 participants 8 messages Dec 8, 2012 – Dec 10, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 5/5 f2fs: Fix for parent inode information during server cache eviction

From: Namjae Jeon <[email protected]>

Test Case:
[NFS Client]
ls -lR .

[NFS Server]
while [ 1 ]
do
echo 3 > /proc/sys/vm/drop_caches
done

Error: "No such file or directory"

When cache is dropped at the server, it results in lookup failure at the NFS client. Even though the file exists. Looking at the code to rebuild the inode in case of cache eviction. It tries to initiate a lookup operation for ".." to get the parent information using the on-disk inode number.

But, in case of f2fs we do not need to perform a lookup based upon name. As for f2fs layout - the f2fs inode already has reference to the parent inode number. So, like a normal inode build-up, parent inode can also be regenerated by reading parent inode number.

f2fs_inode_info represents the in-memory inode, while f2fs_inode represents the on-disk. So, we introduce the parent inode number in the f2fs_inode_info also. Whild doing do_read_inode() reading on-disk information, we populate the parent inode number also.This way whenever we reference f2fs_inode using F2FS_I over VFS inode. We are sure to get the parent inode in the inode.

---
 fs/f2fs/dir.c   |   16 ----------------
 fs/f2fs/f2fs.h  |    1 +
 fs/f2fs/inode.c |    1 +
 fs/f2fs/namei.c |    5 +++--
 4 files changed, 5 insertions(+), 18 deletions(-)
fs/f2fs/dir.c +0 -16
index d900c08..a4c9c9d 100644
@@ -226,22 +226,6 @@ struct f2fs_dir_entry *f2fs_parent_dir(struct inode *dir, struct page **p)
 	return de;
 }
 
-ino_t f2fs_inode_by_name(struct inode *dir, struct qstr *qstr)
-{
-	ino_t res = 0;
-	struct f2fs_dir_entry *de;
-	struct page *page;
-
-	de = f2fs_find_entry(dir, qstr, &page);
-	if (de) {
-		res = le32_to_cpu(de->ino);
-		kunmap(page);
-		f2fs_put_page(page, 0);
-	}
-
-	return res;
-}
-
 void f2fs_set_link(struct inode *dir, struct f2fs_dir_entry *de,
 		struct page *page, struct inode *inode)
 {
fs/f2fs/f2fs.h +1 -0
index 8c3f1ef..0b56cbb 100644
@@ -146,6 +146,7 @@ struct f2fs_inode_info {
 	unsigned int clevel;		/* maximum level of given file name */
 	nid_t i_xattr_nid;		/* node id that contains xattrs */
 	struct extent_info ext;		/* in-memory extent cache entry */
+	unsigned long parent_ino;
 };
 
 static inline void get_extent_info(struct extent_info *ext,
fs/f2fs/inode.c +1 -0
index aa4ef4f..1880d8a 100644
@@ -107,6 +107,7 @@ static int do_read_inode(struct inode *inode)
 	fi->flags = 0;
 	fi->data_version = le64_to_cpu(F2FS_CKPT(sbi)->checkpoint_ver) - 1;
 	fi->i_advise = ri->i_advise;
+	fi->parent_ino = le32_to_cpu(ri->i_pino);
 	get_extent_info(&fi->ext, ri->i_ext);
 	f2fs_put_page(node_page, 1);
 	return 0;
fs/f2fs/namei.c +3 -2
index 89b7675..ab021cc 100644
@@ -183,8 +183,9 @@ out:
 
 struct dentry *f2fs_get_parent(struct dentry *child)
 {
-	struct qstr dotdot = QSTR_INIT("..", 2);
-	unsigned long ino = f2fs_inode_by_name(child->d_inode, &dotdot);
+	unsigned long ino;
+	struct f2fs_inode_info *fi = F2FS_I(child->d_inode);
+	ino = fi->parent_ino;
 	if (!ino)
 		return ERR_PTR(-ENOENT);
 	return d_obtain_alias(f2fs_iget(child->d_inode->i_sb, ino));
Signature · 1 line
1.7.9.5
#1 lore raw

2012-12-08 (토), 14:55 +0900, Namjae Jeon:

Quoted 12 lines

From: Namjae Jeon <[email protected]>

Test Case:
[NFS Client]
ls -lR .

[NFS Server]
while [ 1 ]
do
echo 3 > /proc/sys/vm/drop_caches
done

Quoted 7 lines

Error: "No such file or directory"

When cache is dropped at the server, it results in lookup failure at the NFS client. Even though the file exists. Looking at the code to rebuild the inode in case of cache eviction. It tries to initiate a lookup operation for ".." to get the parent information using the on-disk inode number.

Could you describe why this patch resolves that bug? Before applying this, we need to figure out why that bug is occurred. IMO, from the viewpoint of functionality, ".." resolution should work too.
Thanks,

Signature · 2 lines
Jaegeuk Kim
Samsung
#2 lore raw

2012/12/10, Jaegeuk Kim <[email protected]>:

Quoted 22 lines

2012-12-08 (토), 14:55 +0900, Namjae Jeon:

Quoted 12 lines

From: Namjae Jeon <[email protected]>

Test Case:
[NFS Client]
ls -lR .

[NFS Server]
while [ 1 ]
do
echo 3 > /proc/sys/vm/drop_caches
done

Quoted 8 lines

Error: "No such file or directory"

When cache is dropped at the server, it results in lookup failure at the NFS client. Even though the file exists. Looking at the code to rebuild the inode in case of cache eviction. It tries to initiate a lookup operation
for ".." to get the parent information using the on-disk inode number.

Quoted 4 lines

Could you describe why this patch resolves that bug? Before applying this, we need to figure out why that bug is occurred. IMO, from the viewpoint of functionality, ".." resolution should work too.

dotdot entry of f2fs is stored when creating only directory not regular file. Am I correct ?
So when the parent of file was evicted, I thought we could not get parent inode number of file thoughout dotdot entry.
And f2fs inode is having parent inode number unlike other fs. so I think we can use this special thing by storing f2fs_inode_info.

Thanks.

Quoted 6 lines

Thanks,

--
Jaegeuk Kim
Samsung

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

2012-12-10 (월), 12:40 +0900, Namjae Jeon:

Quoted 23 lines

2012/12/10, Jaegeuk Kim <[email protected]>:

Quoted 22 lines

2012-12-08 (토), 14:55 +0900, Namjae Jeon:

Quoted 20 lines

From: Namjae Jeon <[email protected]>

Test Case:
[NFS Client]
ls -lR .

[NFS Server]
while [ 1 ]
do
echo 3 > /proc/sys/vm/drop_caches
done

Error: "No such file or directory"

When cache is dropped at the server, it results in lookup failure at the NFS client. Even though the file exists. Looking at the code to rebuild the inode in case of cache eviction. It tries to initiate a lookup operation
for ".." to get the parent information using the on-disk inode number.

Quoted 6 lines
Quoted 4 lines

Could you describe why this patch resolves that bug? Before applying this, we need to figure out why that bug is occurred. IMO, from the viewpoint of functionality, ".." resolution should work too.

dotdot entry of f2fs is stored when creating only directory not regular file. Am I correct ?

Yep.

Quoted 2 lines

So when the parent of file was evicted, I thought we could not get parent inode number of file thoughout dotdot entry.

What do you mean the parent of file? Isn't it a directory?

Quoted 2 lines

And f2fs inode is having parent inode number unlike other fs. so I think we can use this special thing by storing f2fs_inode_info.

f2fs stores a dotdot dentry *likewise* other fs.
The pino in f2fs_inode is specially added for POR intentionally.

Still I cannot imagine the bug scenario.

Quoted 12 lines

Thanks.

Quoted 6 lines

Thanks,

--
Jaegeuk Kim
Samsung

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Jaegeuk Kim
Samsung
#4 lore raw

2012/12/10, Jaegeuk Kim <[email protected]>:

Quoted 40 lines

2012-12-10 (월), 12:40 +0900, Namjae Jeon:

Quoted 25 lines

2012/12/10, Jaegeuk Kim <[email protected]>:

Quoted 24 lines

2012-12-08 (토), 14:55 +0900, Namjae Jeon:

Quoted 22 lines

From: Namjae Jeon <[email protected]>

Test Case:
[NFS Client]
ls -lR .

[NFS Server]
while [ 1 ]
do
echo 3 > /proc/sys/vm/drop_caches
done

Error: "No such file or directory"

When cache is dropped at the server, it results in lookup failure at the
NFS client. Even though the file exists. Looking at the code to rebuild
the inode in case of cache eviction. It tries to initiate a lookup operation
for ".." to get the parent information using the on-disk inode number.

Quoted 6 lines
Quoted 4 lines

Could you describe why this patch resolves that bug? Before applying this, we need to figure out why that bug is occurred. IMO, from the viewpoint of functionality, ".." resolution should work too.

dotdot entry of f2fs is stored when creating only directory not regular file. Am I correct ?

Yep.

Quoted 2 lines

So when the parent of file was evicted, I thought we could not get parent inode number of file thoughout dotdot entry.

What do you mean the parent of file? Isn't it a directory?

Quoted 7 lines
Quoted 2 lines

And f2fs inode is having parent inode number unlike other fs. so I think we can use this special thing by storing f2fs_inode_info.

f2fs stores a dotdot dentry *likewise* other fs.
The pino in f2fs_inode is specially added for POR intentionally.

Still I cannot imagine the bug scenario.

When we observed the issue in NFS operations. We found that the issues occurs while trying to “reconnect” with parent ? and shows “No such file or directory” for directory paths.

As a matter of fact - we were also checking the on-disk layout for the f2fs_inode. We found that since, F2FS inode is keeping a reference to the parent-inode within its on-disk information. So, we should use the same information to reconstruct the parent in case of eviction.

The benefit is:
It also saves the lookup() to be performed for “..” in the directory entry block while trying to reconnect with the parent. Instead we can directly use the parent inode number in the inode and generate from that point itself. Even though the get_parent() code was made similar to other filesystem which generally do not have reference to the parent inode - so they need to perform a lookup for “..”, but in this case we sincerely thought we can get rid of that method. So, we did not tried to figure out what could be possible solution in the current scenario.
As per your reference, parent inode number for on-disk inode is introduced for POR intentionally. So, we should not use information for any reconstruction?

Thanks.

Quoted 15 lines
Quoted 9 lines

Thanks.

Quoted 6 lines

Thanks,

--
Jaegeuk Kim
Samsung

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 4 lines

--
Jaegeuk Kim
Samsung

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

2012-12-10 (월), 14:25 +0900, Namjae Jeon:

Quoted 44 lines

2012/12/10, Jaegeuk Kim <[email protected]>:

Quoted 43 lines

2012-12-10 (월), 12:40 +0900, Namjae Jeon:

Quoted 25 lines

2012/12/10, Jaegeuk Kim <[email protected]>:

Quoted 24 lines

2012-12-08 (토), 14:55 +0900, Namjae Jeon:

Quoted 22 lines

From: Namjae Jeon <[email protected]>

Test Case:
[NFS Client]
ls -lR .

[NFS Server]
while [ 1 ]
do
echo 3 > /proc/sys/vm/drop_caches
done

Error: "No such file or directory"

When cache is dropped at the server, it results in lookup failure at the
NFS client. Even though the file exists. Looking at the code to rebuild
the inode in case of cache eviction. It tries to initiate a lookup operation
for ".." to get the parent information using the on-disk inode number.

Quoted 6 lines
Quoted 4 lines

Could you describe why this patch resolves that bug? Before applying this, we need to figure out why that bug is occurred. IMO, from the viewpoint of functionality, ".." resolution should work too.

dotdot entry of f2fs is stored when creating only directory not regular file. Am I correct ?

Yep.

Quoted 2 lines

So when the parent of file was evicted, I thought we could not get parent inode number of file thoughout dotdot entry.

What do you mean the parent of file? Isn't it a directory?

Quoted 2 lines

And f2fs inode is having parent inode number unlike other fs. so I think we can use this special thing by storing f2fs_inode_info.

Quoted 7 lines
Quoted 4 lines

f2fs stores a dotdot dentry *likewise* other fs.
The pino in f2fs_inode is specially added for POR intentionally.

Still I cannot imagine the bug scenario.

When we observed the issue in NFS operations. We found that the issues occurs while trying to “reconnect” with parent ? and shows “No such file or directory” for directory paths.

Again, you didn't describe why this bug is occurred. Please, analyze the bug scenario first.

Quoted 6 lines

As a matter of fact - we were also checking the on-disk layout for the f2fs_inode. We found that since, F2FS inode is keeping a reference to the parent-inode within its on-disk information. So, we should use the same information to reconstruct the parent in case of eviction.

Quoted 13 lines

The benefit is:
It also saves the lookup() to be performed for “..” in the directory entry block while trying to reconnect with the parent. Instead we can directly use the parent inode number in the inode and generate from that point itself. Even though the get_parent() code was made similar to other filesystem which generally do not have reference to the parent inode - so they need to perform a lookup for “..”, but in this case we sincerely thought we can get rid of that method. So, we did not tried to figure out what could be possible solution in the current scenario.
As per your reference, parent inode number for on-disk inode is introduced for POR intentionally. So, we should not use information for any reconstruction?

Of course, we can enhance the directory operations by using the "pino". But what I concern is how to resolve the bug by this enhancement patch. This is not a bug fix patch. Isn't it?

Thanks,

Signature · 2 lines
Jaegeuk Kim
Samsung
#6 lore raw

2012/12/10, Jaegeuk Kim <[email protected]>:

Quoted 52 lines

2012-12-10 (월), 14:25 +0900, Namjae Jeon:

Quoted 51 lines

2012/12/10, Jaegeuk Kim <[email protected]>:

Quoted 50 lines

2012-12-10 (월), 12:40 +0900, Namjae Jeon:

Quoted 27 lines

2012/12/10, Jaegeuk Kim <[email protected]>:

Quoted 26 lines

2012-12-08 (토), 14:55 +0900, Namjae Jeon:

Quoted 24 lines

From: Namjae Jeon <[email protected]>

Test Case:
[NFS Client]
ls -lR .

[NFS Server]
while [ 1 ]
do
echo 3 > /proc/sys/vm/drop_caches
done

Error: "No such file or directory"

When cache is dropped at the server, it results in lookup failure at
the
NFS client. Even though the file exists. Looking at the code to rebuild
the inode in case of cache eviction. It tries to initiate a lookup operation
for ".." to get the parent information using the on-disk inode number.

Quoted 8 lines
Quoted 6 lines

Could you describe why this patch resolves that bug? Before applying this, we need to figure out why that bug is occurred.
IMO, from the viewpoint of functionality, ".." resolution should work
too.

dotdot entry of f2fs is stored when creating only directory not regular file. Am I correct ?

Yep.

Quoted 2 lines

So when the parent of file was evicted, I thought we could not get parent inode number of file thoughout dotdot entry.

What do you mean the parent of file? Isn't it a directory?

Quoted 2 lines

And f2fs inode is having parent inode number unlike other fs. so I think we can use this special thing by storing f2fs_inode_info.

f2fs stores a dotdot dentry *likewise* other fs.
The pino in f2fs_inode is specially added for POR intentionally.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Still I cannot imagine the bug scenario.

When we observed the issue in NFS operations. We found that the issues occurs while trying to “reconnect” with parent ? and shows “No such file or directory” for directory paths.

Again, you didn't describe why this bug is occurred. Please, analyze the bug scenario first.

Okay, I will look into more.

Quoted 21 lines
Quoted 7 lines

As a matter of fact - we were also checking the on-disk layout for the f2fs_inode. We found that since, F2FS inode is keeping a reference to the parent-inode within its on-disk information. So, we should use the same information to reconstruct the parent in case of eviction.

Quoted 13 lines

The benefit is:
It also saves the lookup() to be performed for “..” in the directory entry block while trying to reconnect with the parent. Instead we can directly use the parent inode number in the inode and generate from that point itself. Even though the get_parent() code was made similar to other filesystem which generally do not have reference to the parent inode - so they need to perform a lookup for “..”, but in this case we sincerely thought we can get rid of that method. So, we did not tried to figure out what could be possible solution in the current scenario.
As per your reference, parent inode number for on-disk inode is introduced for POR intentionally. So, we should not use information for any reconstruction?

Quoted 3 lines

Of course, we can enhance the directory operations by using the "pino". But what I concern is how to resolve the bug by this enhancement patch. This is not a bug fix patch. Isn't it?

Yes, It is not bug fix. this is new method using f2fs's special thing. Agreed, I will analyse why this bug occur first. let's discuss again whether we fix bug or use new method.

And please check the rest of patches except this patch.

Thanks.

Quoted 7 lines

Thanks,

--
Jaegeuk Kim
Samsung

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw

2012-12-10 (월), 16:11 +0900, Namjae Jeon:

Quoted 82 lines

2012/12/10, Jaegeuk Kim <[email protected]>:

Quoted 52 lines

2012-12-10 (월), 14:25 +0900, Namjae Jeon:

Quoted 51 lines

2012/12/10, Jaegeuk Kim <[email protected]>:

Quoted 50 lines

2012-12-10 (월), 12:40 +0900, Namjae Jeon:

Quoted 27 lines

2012/12/10, Jaegeuk Kim <[email protected]>:

Quoted 26 lines

2012-12-08 (토), 14:55 +0900, Namjae Jeon:

Quoted 24 lines

From: Namjae Jeon <[email protected]>

Test Case:
[NFS Client]
ls -lR .

[NFS Server]
while [ 1 ]
do
echo 3 > /proc/sys/vm/drop_caches
done

Error: "No such file or directory"

When cache is dropped at the server, it results in lookup failure at
the
NFS client. Even though the file exists. Looking at the code to rebuild
the inode in case of cache eviction. It tries to initiate a lookup operation
for ".." to get the parent information using the on-disk inode number.

Quoted 8 lines
Quoted 6 lines

Could you describe why this patch resolves that bug? Before applying this, we need to figure out why that bug is occurred.
IMO, from the viewpoint of functionality, ".." resolution should work
too.

dotdot entry of f2fs is stored when creating only directory not regular file. Am I correct ?

Yep.

Quoted 2 lines

So when the parent of file was evicted, I thought we could not get parent inode number of file thoughout dotdot entry.

What do you mean the parent of file? Isn't it a directory?

Quoted 2 lines

And f2fs inode is having parent inode number unlike other fs. so I think we can use this special thing by storing f2fs_inode_info.

f2fs stores a dotdot dentry *likewise* other fs.
The pino in f2fs_inode is specially added for POR intentionally.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Still I cannot imagine the bug scenario.

When we observed the issue in NFS operations. We found that the issues occurs while trying to “reconnect” with parent ? and shows “No such file or directory” for directory paths.

Again, you didn't describe why this bug is occurred. Please, analyze the bug scenario first.

Okay, I will look into more.

Quoted 21 lines
Quoted 20 lines

As a matter of fact - we were also checking the on-disk layout for the f2fs_inode. We found that since, F2FS inode is keeping a reference to the parent-inode within its on-disk information. So, we should use the same information to reconstruct the parent in case of eviction.

The benefit is:
It also saves the lookup() to be performed for “..” in the directory entry block while trying to reconnect with the parent. Instead we can directly use the parent inode number in the inode and generate from that point itself. Even though the get_parent() code was made similar to other filesystem which generally do not have reference to the parent inode - so they need to perform a lookup for “..”, but in this case we sincerely thought we can get rid of that method. So, we did not tried to figure out what could be possible solution in the current scenario.
As per your reference, parent inode number for on-disk inode is introduced for POR intentionally. So, we should not use information for any reconstruction?

Quoted 8 lines
Quoted 3 lines

Of course, we can enhance the directory operations by using the "pino". But what I concern is how to resolve the bug by this enhancement patch. This is not a bug fix patch. Isn't it?

Yes, It is not bug fix. this is new method using f2fs's special thing. Agreed, I will analyse why this bug occur first. let's discuss again whether we fix bug or use new method.

And please check the rest of patches except this patch.

Other patches look good to me.
And I'm testing and seeing the codes one more time. Thank you for contribution. :)

Quoted 9 lines

Thanks.

Quoted 7 lines

Thanks,

--
Jaegeuk Kim
Samsung

Signature · 2 lines
Jaegeuk Kim
Samsung