Skip to contentSkip to conversation

fs: befs: Insert NULL inode to dentry

PATCH RESEND Applied Salah Triki 2 participants 2 messages Jul 27, 2016

Subsystems (2)
lore
Share & tools
lore

Salah Triki

author maintainer
#0 lore raw

PATCH RESEND v3 1/1 fs: befs: Insert NULL inode to dentry

As VFS expects, lookup inserts NULL inode to dentry when the named inode does not exist.

---
 fs/befs/linuxvfs.c | 1 +
 1 file changed, 1 insertion(+)
fs/befs/linuxvfs.c +1 -0
index c734f21..2fea87b 100644
@@ -184,6 +184,7 @@ befs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
 
 	if (ret == BEFS_BT_NOT_FOUND) {
 		befs_debug(sb, "<--- %s %pd not found", __func__, dentry);
+		d_add(dentry, NULL);
 		return ERR_PTR(-ENOENT);
 
 	} else if (ret != BEFS_OK || offset == 0) {
Signature · 1 line
1.9.1
Acked-by on v3 1/1 Applied
#1 lore raw
Quoted 14 lines · Salah Triki

As VFS expects, lookup inserts NULL inode to dentry when the named inode does not exist.

---
 fs/befs/linuxvfs.c | 1 +
 1 file changed, 1 insertion(+)
fs/befs/linuxvfs.c +0 -0
index c734f21..2fea87b 100644

fs/befs/linuxvfs.c befs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) · line 190

Quoted 7 lines
fs/befs/linuxvfs.c +1 -0
@@ -184,6 +184,7 @@ befs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
 
 	if (ret == BEFS_BT_NOT_FOUND) {
 		befs_debug(sb, "<--- %s %pd not found", __func__, dentry);
+		d_add(dentry, NULL);
 		return ERR_PTR(-ENOENT);
 
 	} else if (ret != BEFS_OK || offset == 0) {

Hi,

The expectation Salah is mentioning can be seen in Documentation/filesystems/vfs.txt:383
"If the named inode does not exist a NULL inode should be inserted into the dentry (this is called a negative dentry)."

I have applied this patch into [0]:
https://github.com/luisbg/linux-befs/tree/befs-next

Thanks,
Luis

[0] reason for the git branch: https://lkml.org/lkml/2016/7/26/533