Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1413851 > unrolled thread

[PATCH V2 1/3] fs: befs: Lookup must return error code only on real error

Started bySalah Triki <salah.triki@acm.org>
First post2016-06-04 22:00 +0200
Last post2016-06-04 22:00 +0200
Articles 3 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH V2 1/3] fs: befs: Lookup must return error code only on real error Salah Triki <salah.triki@acm.org> - 2016-06-04 22:00 +0200
    [PATCH V2 2/3] fs: befs: Insert NULL inode to dentry Salah Triki <salah.triki@acm.org> - 2016-06-04 22:00 +0200
    [PATCH V2 3/3] fs: befs: Increment i_count when inode is found Salah Triki <salah.triki@acm.org> - 2016-06-04 22:00 +0200

#1413851 — [PATCH V2 1/3] fs: befs: Lookup must return error code only on real error

FromSalah Triki <salah.triki@acm.org>
Date2016-06-04 22:00 +0200
Subject[PATCH V2 1/3] fs: befs: Lookup must return error code only on real error
Message-ID<rGpTH-5eI-11@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1413853 — [PATCH V2 2/3] fs: befs: Insert NULL inode to dentry

FromSalah Triki <salah.triki@acm.org>
Date2016-06-04 22:00 +0200
Subject[PATCH V2 2/3] fs: befs: Insert NULL inode to dentry
Message-ID<rGpTH-5eI-19@gated-at.bofh.it>
In reply to#1413851
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

[toc] | [prev] | [next] | [standalone]


#1413854 — [PATCH V2 3/3] fs: befs: Increment i_count when inode is found

FromSalah Triki <salah.triki@acm.org>
Date2016-06-04 22:00 +0200
Subject[PATCH V2 3/3] fs: befs: Increment i_count when inode is found
Message-ID<rGpTH-5eI-17@gated-at.bofh.it>
In reply to#1413851
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web