All of lore.kernel.org
 help / color / mirror / Atom feed
* iget4/read_inode2 race in get_new_inode
@ 2002-04-29 16:14 Jan Harkes
  2002-04-29 16:48 ` Jan Harkes
                   ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: Jan Harkes @ 2002-04-29 16:14 UTC (permalink / raw)
  To: linux-fsdevel

Hi all,

I believe I found a race in get_new_inode (fs/inode.c) which affects
filesystems that use iget4 (and read_inode2). Because the 'opaque' value
of the new inode is initialized in read_inode2 after the inode_lock has
already been released. So another thread could call into get_new_inode
and not see the inode that hasn't yet been initialized in read_inode2.

Moving the spin_unlock(&inode_lock) to after the read_inode calls will
fix this, but could lead to deadlock for stacking filesystems that try
to access another filesystem/inode from their read_inode call. Coda is
safe, but at least intermezzo seems to be calling through to other
filesystems.

A solution would be to add i_ops->init_locked_inode(inode, opaque) which
would be called while we're still holding the inode lock. I couldn't see
a simple way to split such functionality out of the reiserfs read_inode2
function, but it would look something like the following.

static int reiserfs_init_locked_inode(struct inode *inode, void *opaque)
{
    INODE_PKEY(inode)->k_dir_id =
	((struct reiserfs_iget4_args *)opaque)->objectid;
}

Jan


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2002-04-29 22:54 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-29 16:14 iget4/read_inode2 race in get_new_inode Jan Harkes
2002-04-29 16:48 ` Jan Harkes
2002-04-29 17:49   ` Alexander Viro
2002-04-29 19:34     ` Anton Altaparmakov
2002-04-29 19:39       ` Anton Altaparmakov
2002-04-29 19:41       ` Steve Lord
2002-04-29 19:51         ` Anton Altaparmakov
2002-04-29 19:51       ` Christoph Hellwig
2002-04-29 20:07         ` Anton Altaparmakov
2002-04-29 20:13           ` Christoph Hellwig
2002-04-29 20:24             ` Jan Harkes
2002-04-29 20:28             ` Anton Altaparmakov
2002-04-29 20:20         ` Jan Harkes
2002-04-29 20:31           ` Anton Altaparmakov
2002-04-29 20:48             ` Steve Lord
2002-04-29 20:58             ` Jan Harkes
2002-04-29 21:04               ` Steve Lord
2002-04-29 21:34                 ` Anton Altaparmakov
2002-04-29 22:36       ` Alexander Viro
2002-04-29 22:54         ` Jan Harkes
2002-04-29 17:18 ` Anton Altaparmakov
2002-04-29 17:33   ` Jan Harkes
2002-04-29 17:44 ` Alexander Viro
2002-04-29 18:02   ` Jan Harkes
2002-04-29 18:22     ` Anton Altaparmakov
2002-04-29 18:30       ` Steve Lord
2002-04-29 18:39         ` Christoph Hellwig
2002-04-29 19:20           ` Steve Lord
2002-04-29 19:52             ` Christoph Hellwig
2002-04-29 22:02             ` Chris Mason
2002-04-29 19:12         ` Jan Harkes

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.