summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/inode.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/inode.c b/fs/inode.c
index 0401d2c6d087..648e71ce6ec2 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -840,7 +840,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;
}