From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Chris Caputo <ccaputo@alt.net>,
linux-kernel@vger.kernel.org,
David Woodhouse <dwmw2@infradead.org>,
riel@redhat.com
Subject: Re: inode_unused list corruption in 2.4.26 - spin_lock problem?
Date: Sun, 20 Jun 2004 21:45:35 -0300 [thread overview]
Message-ID: <20040621004535.GA8071@logos.cnet> (raw)
In-Reply-To: <1087702435.5361.64.camel@lade.trondhjem.org>
On Sat, Jun 19, 2004 at 11:33:55PM -0400, Trond Myklebust wrote:
> På lau , 19/06/2004 klokka 20:15, skreiv Marcelo Tosatti:
>
> > The changes between 2.4.25->2.4.26 (which introduce __refile_inode() and
> > the unused_pagecache list) must have something to do with this.
>
> Here's one question:
>
> Given the fact that in iput(), the inode remains hashed and the
> inode->i_state does not change until after we've dropped the inode_lock,
> called write_inode_now(), and then retaken the inode_lock, exactly what
> is preventing a third party task from grabbing that inode?
>
> (Better still: write_inode_now() itself actually calls __iget(), which
> could cause that inode to be plonked right back onto the "inode_in_use"
> list if ever refile_inode() gets called.)
Lets see if I get this right, while we drop the lock in iput to call
write_inode_now() an iget happens, possibly from write_inode_now itself
(sync_one->__iget) causing the inode->i_list to be added to to inode_in_use.
But then the call returns, locks inode_lock, decreases inodes_stat.nr_unused--
and deletes the inode from the inode_in_use and adds to inode_unused.
AFAICS its an inode with i_count==1 in the unused list, which does not
mean "list corruption", right? Am I missing something here?
If you are indeed right all 2.4.x versions contain this bug.
Thanks for helping!
>
> So does the following patch help?
>
> +++ linux-2.4.27-pre3/fs/inode.c 2004-06-19 23:22:29.000000000 -0400
> @@ -1200,6 +1200,7 @@ void iput(struct inode *inode)
> struct super_block *sb = inode->i_sb;
> struct super_operations *op = NULL;
>
> +again:
> if (inode->i_state == I_CLEAR)
> BUG();
>
> @@ -1241,11 +1242,16 @@ void iput(struct inode *inode)
> if (!(inode->i_state & (I_DIRTY|I_LOCK)))
> __refile_inode(inode);
> inodes_stat.nr_unused++;
> - spin_unlock(&inode_lock);
> - if (!sb || (sb->s_flags & MS_ACTIVE))
> + if (!sb || (sb->s_flags & MS_ACTIVE)) {
> + spin_unlock(&inode_lock);
> return;
> - write_inode_now(inode, 1);
> - spin_lock(&inode_lock);
> + }
> + if (inode->i_state & I_DIRTY) {
> + __iget(inode);
> + spin_unlock(&inode_lock);
> + write_inode_now(inode, 1);
> + goto again;
> + }
> inodes_stat.nr_unused--;
> list_del_init(&inode->i_hash);
> }
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2004-06-21 0:52 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-19 0:47 inode_unused list corruption in 2.4.26 - spin_lock problem? Chris Caputo
2004-06-20 0:15 ` Marcelo Tosatti
2004-06-20 3:33 ` Trond Myklebust
2004-06-21 0:45 ` Marcelo Tosatti [this message]
2004-06-21 17:10 ` Trond Myklebust
2004-06-21 18:23 ` Marcelo Tosatti
2004-06-24 1:51 ` Chris Caputo
2004-06-25 7:47 ` Chris Caputo
2004-06-24 1:50 ` Chris Caputo
2004-06-25 8:04 ` Chris Caputo
2004-06-25 10:18 ` Chris Caputo
2004-06-25 12:17 ` Marcelo Tosatti
2004-07-02 20:00 ` Chris Caputo
2004-07-03 5:15 ` Arjan van de Ven
2004-07-26 17:41 ` Chris Caputo
2004-07-27 14:19 ` Marcelo Tosatti
2004-07-27 16:08 ` Chris Caputo
2004-07-29 0:25 ` Marcelo Tosatti
2004-07-29 6:27 ` Chris Caputo
2004-07-29 7:54 ` Arjan van de Ven
2004-07-29 10:57 ` Marcelo Tosatti
2004-07-29 12:21 ` Arjan van de Ven
2004-07-29 16:22 ` Chris Caputo
2004-07-29 16:23 ` Arjan van de Ven
2004-08-04 15:38 ` Chris Caputo
2004-08-04 18:47 ` Chris Caputo
[not found] <20040805225549.GA18420@logos.cnet>
2004-08-07 16:00 ` Chris Caputo
2004-08-07 18:31 ` Marcelo Tosatti
2004-08-07 19:36 ` Marcelo Tosatti
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=20040621004535.GA8071@logos.cnet \
--to=marcelo.tosatti@cyclades.com \
--cc=ccaputo@alt.net \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=riel@redhat.com \
--cc=trond.myklebust@fys.uio.no \
/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 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.