Re: [patch 7/8] inode-diet: Use a union for i_blocks and i_size,i_rdev and i_devices

From: Hugh Dickins
Date: Mon Jul 03 2006 - 10:34:22 EST


On Mon, 3 Jul 2006, Andrew Morton wrote:
> On Sun, 02 Jul 2006 20:53:40 -0400
> "Theodore Ts'o" <tytso@xxxxxxx> wrote:
>
> > The i_blocks and i_size fields are only used for regular files. So we
> > move them into the union, along with i_rdev and i_devices, which are
> > only used by block or character devices.
>
> It appears that device nodes in tmpfs tripped this up.
> kernel BUG at mm/shmem.c:693!
> EIP is at shmem_delete_inode+0x89/0xa4

I'm happy for you to resolve that by moving the tmpfs BUG_ON up into
the truncation block just above it, patch below. But note that this
also covers the case of long symbolic links, and I think tmpfs is not
alone in using i_blocks with long symbolic links; and would some file-
systems also use it with directories? Looks to me like there's more
auditing needed before putting i_blocks into a union (and it might
help if we delete those many lines initializing i_blocks to 0:
they're probably done before the union diverges, but worrysome).

Hugh

--- 2.6.17-mm6/mm/shmem.c 2006-07-03 12:23:59.000000000 +0100
+++ linux/mm/shmem.c 2006-07-03 15:17:19.000000000 +0100
@@ -689,8 +689,8 @@ static void shmem_delete_inode(struct in
list_del_init(&info->swaplist);
spin_unlock(&shmem_swaplist_lock);
}
+ BUG_ON(inode->i_blocks);
}
- BUG_ON(inode->i_blocks);
if (sbinfo->max_inodes) {
spin_lock(&sbinfo->stat_lock);
sbinfo->free_inodes++;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/