Re: [PATCH] make last_inode counter in new_inode 32-bit on kernels that offer x86 compatability

From: Jörn Engel
Date: Mon Nov 06 2006 - 16:12:41 EST


On Mon, 6 November 2006 14:50:58 -0600, Eric Sandeen wrote:
> >
> > While you're at it, how about making last_ino per-sb instead of
> > system-wide? ino collisions after a wrap are just as bad as inos
> > beyond 32bit. And this should be a fairly simple method to reduce the
> > risk.
>
> Using a global counter for multiple filesystems should actually -reduce-
> the chance of a collision on the same filesystem, since after you wrap the
> recycled number may go to a different filesystem.

You're missing something. The chance for a collision _per wrap_ is
reduced, as you said. But the number of wraps goes up. Overall and
for large numbers, the two effects compensate each other.

For not-so-large numbers, you can get by without the wrap by having
this per-sb. And if you have just one or two wrapping filesystems, at
least the others are protected. It's not much, but it is a simple
thing to do.

> To fix this properly, we'd need some sort of checking that the inode number
> isn't currently being used on the filesystem in question before it's
> assigned to the new inode.

Absolutely. Thinking about it, iget() already has a lot of what is
needed - except that it can block and has side effects we don't really
want. Sounds more complicated, but I would love to be proven wrong
here. :)

Jörn

--
Joern's library part 7:
http://www.usenix.org/publications/library/proceedings/neworl/full_papers/mckusick.a
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/