linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jörn Engel" <joern@lazybastard.org>
To: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: Race between __sync_single_inode() and LogFS garbage collector
Date: Tue, 20 Feb 2007 10:50:22 +0000	[thread overview]
Message-ID: <20070220105022.GB10455@lazybastard.org> (raw)
In-Reply-To: <1171940793.7963.10.camel@kleikamp.austin.ibm.com>

On Mon, 19 February 2007 21:06:33 -0600, Dave Kleikamp wrote:
> 
> You've obviously given this a lot more thought that I have, but this
> sounds like something that has possibilities.  You couldn't implement
> your own drop_inode method that does better locking against the garbage
> collector?

Bloody hell!  What a great question for an unexpected reason.  GC also
races against iput().

Basically whenever anyone locks any inode, I may have a problem.  If
that inode remains locked until some writeout happens, I will have a
problem.  Afaics, locking happens in three places:

__sync_single_inode()
	Causes writeout of inode pages and inode itself

iput()
	Causes writeout of inode itself

get_new_inode() or get_new_inode_fast()
	No writes from here

Both __sync_single_inode() and iput() would need to prevent GC before
locking the inode.  GC can be caused by any writes to LogFS, so they
need to lock against all write paths in LogFS.  Once they start writeout
themselves, they also need to pass information that they have taken the
lock onward, otherwise taking the lock itself would deadlock.  Nasty.

Alternatively there could be a non-blocking version of iget() that
simply returns when an inode is locked.  Now GC would have to spin in a
loop, waiting for one of two possible events.  Either the inode is
getting unlocked or someone calls into LogFS with the inode in question
and GC needs to take that by some means.  Again, nasty.

The more I think about it, the more I like the idea of double-caching
inodes.  As ugly as it sounds, it causes the least amount of problems.

Thanks, Shaggy!

Jörn

-- 
Linux [...] existed just for discussion between people who wanted
to show off how geeky they were.
-- Rob Enderle
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2007-02-20 10:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-19 21:31 Race between __sync_single_inode() and LogFS garbage collector Jörn Engel
2007-02-19 23:05 ` Dave Kleikamp
2007-02-19 23:23   ` Jörn Engel
2007-02-20  3:06     ` Dave Kleikamp
2007-02-20 10:50       ` Jörn Engel [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=20070220105022.GB10455@lazybastard.org \
    --to=joern@lazybastard.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=shaggy@linux.vnet.ibm.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).