[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-fsdevel
Subject: Re: [PATCH] ext3 [linux-2.6.2.]: accessing already freed inodes
From: Andrew Morton <akpm () osdl ! org>
Date: 2004-02-24 22:55:18
Message-ID: 20040224145518.4cbb9b57.akpm () osdl ! org
[Download RAW message or body]
Carsten Otte <cotte@freenet.de> wrote:
>
> Am Samstag 21 Februar 2004 01:43 schrieb Andrew Morton:
> > Could you chage it so we generate a backtrace in iput() if the inode has an
> > i_count of one (the dentry) and it is still on the orphan list?
>
> I did change iput() to the following:
> void iput(struct inode *inode)
> {
> if (inode) {
> struct super_operations *op = inode->i_sb->s_op;
>
> if (inode->i_state == I_CLEAR)
> BUG();
>
> if (op && op->put_inode)
> op->put_inode(inode);
>
> if (atomic_dec_and_lock(&inode->i_count, &inode_lock))
> iput_final(inode);
> if (atomic_read(&inode->i_count) == 1)
> if (!strcmp(inode->i_sb->s_type->name, "ext3")) {
> struct ext3_inode_info *ext3_i;
> ext3_i = container_of(inode,
> struct ext3_inode_info,
> vfs_inode);
> if (!list_empty(&ext3_i->i_orphan))
> WARN_ON(1);
> }
> }
> }
atomic_dec_and_lock() decrements i_count, so this warning will be triggered
by people calling iput() with an orphan inode which has a refcount of 2,
not of 1. Please change the
if (atomic_read(&inode->i_count) == 1)
to
if (atomic_read(&inode->i_count) == 0)
Thanks.
-
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic