All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] vfs: avoid creation of inode number 0 in get_next_ino
@ 2015-06-25 15:25 Carlos Maiolino
  2015-06-30  4:35 ` Rik van Riel
  0 siblings, 1 reply; 2+ messages in thread
From: Carlos Maiolino @ 2015-06-25 15:25 UTC (permalink / raw)
  To: linux-fsdevel

currently, get_next_ino() is able to create inodes with inode number = 0.
This have a bad impact in the filesystems relying in this function to generate
inode numbers.

While there is no problem at all in having inodes with number 0, userspace tools
which handle file management tasks can have problems handling these files, like
for example, the impossiblity of users to delete these files, since glibc will
ignore them. So, I believe the best way is kernel to avoid creating them.

This problem has been raised previously, but the old thread didn't have any
other update for a year+, and I've seen too many users hitting the same issue
regarding the impossibility to delete files while using filesystems relying on
this function. So, I'm starting the thread again, with the same patch
that I believe is enough to address this problem.

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
---
 fs/inode.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/inode.c b/fs/inode.c
index ea37cd1..01c3a4a 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -839,7 +839,11 @@ unsigned int get_next_ino(void)
 	}
 #endif
 
-	*p = ++res;
+	res++;
+	/* get_next_ino should not provide a 0 inode number */
+	if (unlikely(!res))
+		res++;
+	*p = res;
 	put_cpu_var(last_ino);
 	return res;
 }
-- 
2.1.0


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

end of thread, other threads:[~2015-06-30  4:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-25 15:25 [RFC PATCH] vfs: avoid creation of inode number 0 in get_next_ino Carlos Maiolino
2015-06-30  4:35 ` Rik van Riel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.