Message ID | 1435265921-21652-1-git-send-email-cmaiolino@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 06/25/2015 04:58 PM, Carlos Maiolino wrote: > 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. > > 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 changes in the patch > suggested by Viro. > > Changelog: > > V2: Use do..while() instead of unlikely(!res) > > Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com> Reviewed-by: Rik van Riel <riel@redhat.com>
diff --git a/fs/inode.c b/fs/inode.c index ea37cd1..85a05b7 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -839,7 +839,9 @@ unsigned int get_next_ino(void) } #endif - *p = ++res; + do { + *p = ++res; + } while (!res); put_cpu_var(last_ino); return res; }
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. 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 changes in the patch suggested by Viro. Changelog: V2: Use do..while() instead of unlikely(!res) Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com> --- fs/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)