linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 1/3] fs: befs: Lookup must return error code only on real error
@ 2016-06-04 19:57 Salah Triki
  2016-06-04 19:57 ` [PATCH V2 2/3] fs: befs: Insert NULL inode to dentry Salah Triki
  2016-06-04 19:57 ` [PATCH V2 3/3] fs: befs: Increment i_count when inode is found Salah Triki
  0 siblings, 2 replies; 3+ messages in thread
From: Salah Triki @ 2016-06-04 19:57 UTC (permalink / raw)
  To: akpm; +Cc: Salah Triki, linux-kernel

File not found is not an error and lookup must return error code only
on real error, otherwise creating inodes with functions like create,
mkdir and so on will fail.

Signed-off-by: Salah Triki <salah.triki@acm.org>
---
 fs/befs/linuxvfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index c734f21..e0bd6c7 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -184,7 +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);
-		return ERR_PTR(-ENOENT);
+		return NULL;
 
 	} else if (ret != BEFS_OK || offset == 0) {
 		befs_warning(sb, "<--- %s Error", __func__);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH V2 2/3] fs: befs: Insert NULL inode to dentry
  2016-06-04 19:57 [PATCH V2 1/3] fs: befs: Lookup must return error code only on real error Salah Triki
@ 2016-06-04 19:57 ` Salah Triki
  2016-06-04 19:57 ` [PATCH V2 3/3] fs: befs: Increment i_count when inode is found Salah Triki
  1 sibling, 0 replies; 3+ messages in thread
From: Salah Triki @ 2016-06-04 19:57 UTC (permalink / raw)
  To: akpm; +Cc: Salah Triki, linux-kernel

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

Signed-off-by: Salah Triki <salah.triki@acm.org>
---
 fs/befs/linuxvfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index e0bd6c7..91740dd 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -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 NULL;
 
 	} else if (ret != BEFS_OK || offset == 0) {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH V2 3/3] fs: befs: Increment i_count when inode is found
  2016-06-04 19:57 [PATCH V2 1/3] fs: befs: Lookup must return error code only on real error Salah Triki
  2016-06-04 19:57 ` [PATCH V2 2/3] fs: befs: Insert NULL inode to dentry Salah Triki
@ 2016-06-04 19:57 ` Salah Triki
  1 sibling, 0 replies; 3+ messages in thread
From: Salah Triki @ 2016-06-04 19:57 UTC (permalink / raw)
  To: akpm; +Cc: Salah Triki, linux-kernel

As VFS expects, i_count.counter field should be incremented when the named inode
is found.

Signed-off-by: Salah Triki <salah.triki@acm.org>
---
 fs/befs/linuxvfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index 91740dd..1a67990 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -198,6 +198,8 @@ befs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
 
 	d_add(dentry, inode);
 
+	inode->i_count.counter++;
+
 	befs_debug(sb, "<--- %s", __func__);
 
 	return NULL;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-04 19:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-04 19:57 [PATCH V2 1/3] fs: befs: Lookup must return error code only on real error Salah Triki
2016-06-04 19:57 ` [PATCH V2 2/3] fs: befs: Insert NULL inode to dentry Salah Triki
2016-06-04 19:57 ` [PATCH V2 3/3] fs: befs: Increment i_count when inode is found Salah Triki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).