linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Mason <chris.mason@oracle.com>
To: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Cc: Linux Btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [BUG?] There is a possibility that 'i_ino' overflows
Date: Tue, 21 Dec 2010 16:52:12 -0500	[thread overview]
Message-ID: <1292968260-sup-343@think> (raw)
In-Reply-To: <4D0EB953.2010106@jp.fujitsu.com>

Excerpts from Tsutomu Itoh's message of 2010-12-19 21:02:59 -0500:
> 
> (2010/12/16 17:44), Tsutomu Itoh wrote:
> > Hi,
> > 
> > In btrfs, inode number is increased each time a new file or directory
> > is made.
> > Therefore, if the making deletion of the file is repeated, value of
> > 'i_ino' increases rapidly.
> > 
> > For example, inode number changes as follows. 
> > 
> >   $ touch foo
> >   $ ls -i foo
> >   266 foo
> >   $ rm foo
> >   $ touch bar
> >   $ ls -i bar
> >   267 bar
> >   $
> > 
> > And then, length of 'i_ino' and 'objectid' is as follows on the x86
> > system. 
> > 
> >   unsigned long i_ino == 32bits
> >   u64 objectid        == 64bits
> > 
> > Therefore, in the operation to substitute 'objectid' to 'i_ino',
> > 'i_ino' overflows when 'objectid' 4294967296 is substituted to 'i_ino'. 
> > Then, the file with inode number 0 is made.
> 
> I think that it is better to recycle inode number that became unused. 
> And, at least, I think that it should make the filesystem not become an
> abnormal condition. 
> 
> This patch is a patch that makes an error when inode number is bigger
> than BTRFS_LAST_FREE_OBJECTID.

Thanks, I've folded this one in.  Long term the plan is to do something
similar to Josef's block group caching code but for inode numbers.
Basically we'll cache the free ones, but it'll be less complex than the
block group caching by far.

-chris

      reply	other threads:[~2010-12-21 21:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-16  8:44 [BUG?] There is a possibility that 'i_ino' overflows Tsutomu Itoh
2010-12-20  2:02 ` Tsutomu Itoh
2010-12-21 21:52   ` Chris Mason [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1292968260-sup-343@think \
    --to=chris.mason@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=t-itoh@jp.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).