mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Charles Manning <manningc2@actrix.gen.nz>
To: Andreas Dilger <adilger@clusterfs.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Using ilookup?
Date: Thu, 14 Oct 2004 07:07:12 +1300	[thread overview]
Message-ID: <20041013180358.233046CEA@blood.actrix.co.nz> (raw)
In-Reply-To: <20041013055035.GH2061@schnapps.adilger.int>

On Wednesday 13 October 2004 18:50, Andreas Dilger wrote:
> On Oct 13, 2004  14:42 +1300, Charles Manning wrote:
> > YAFFS allocates its own "objectId"s which are used as inode numbers for
> > most purposes. When objects get deleted (== unlinked), the object numbers
> > get recycles.  Sometimes though the Linux cache has an inode after the
> > object has been deleted. Then if that object id gets recycled before the
> > cached inode is released, a problem occurs since iget() gets the old
> > inode instead of creating a new one. We then end up with an
> > inconsistency.
>
> You can use iget4() along with a filesystem-specific comparison function,
> which allows you to distinguish inodes with the same number based on
> some extra data (e.g. generation number, 64-bit inode numbers, etc).  Is
> there a reason to recycle the inode numbers, or could you just have a
> 32-bit counter?

The problem, I believe, with iget4() is that this will make a new inode if 
one does not exist which seems to be more running around than I really want 
(especially since in most cases the inode will not exist).

The number space is 18 bits, but even with 32 bits incrementing through the 
list will not make the problem go away, just reduce it to a very small 
probability.

>
> > 1)  Somehow plug myself into the inode iput() chain so that I know when
> > an inode is removed from the cache. I can then make sure that I don't
> > free up the inode number for reuse until the inode is not in the cache.
> > Any hints on how to do that?
>
> You can use the ->delete_inode method which is a hook to be called
> before/instead of the clear_inode() function in iput(), and is
> the last thing action taken when the inode is being unlinked.  There
> is also the ->clear_inode inode method, which is called when inodes
> are being put away but not only when being unlinked.

It seems to me that delete_inode() is the place to hook into. I already use 
this for regular files, I just need to extend this to directories, pipes and 
other specials.

I knew about the regular file case because you can do things like:

  f= open("xx"...);; /
 unlink("xx");  // file no longer exists in directory, but still exists 
 read(f...)
 write(f...)
 close(f) ; // file disappears from disk.

I did npt realise that you could essentially achieve the same thing with 
directories, pipes and other specials.

Thanks for the help.

-- Charles

  reply	other threads:[~2004-10-13 18:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-13  1:42 Charles Manning
2004-10-13  5:50 ` Andreas Dilger
2004-10-13 18:07   ` Charles Manning [this message]
2004-10-13  8:50 ` David Woodhouse
2004-10-13 15:22   ` Lee Revell

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=20041013180358.233046CEA@blood.actrix.co.nz \
    --to=manningc2@actrix.gen.nz \
    --cc=adilger@clusterfs.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®