Patch queue update
Subsystems (2)
Hi Mingming,
Attached below are new patches for the patchqueue. Some of patches update already existing patches, mostly to get them apply cleanly after adding new patches or to fix sparse warning. The modified patches should not have any functionality change. The diff between the patchqueue and updated queue is attached below. That should help to look at the changes easily. The patch queue looked at is as of commit 22d4c3124d50803222c14116b3fdf08dc447a119
The updated series file
http://www.radian.org/~kvaneesh/ext4/jun-15-2008/series
The patches
http://www.radian.org/~kvaneesh/ext4/jun-15-2008/
The complete patchset.
http://www.radian.org/~kvaneesh/ext4/jun-15-2008/patches.tar.gz
-aneesh
fs/ext4/balloc.c +34 -27
@@ -47,7 +47,7 @@ static int ext4_block_in_group(struct super_block *sb, ext4_fsblk_t block, ext4_group_t block_group) {ext4_group_t actual_group; -ext4_get_group_no_and_offset (sb, block, &actual_group,0 ); +ext4_get_group_no_and_offset (sb, block, &actual_group,NULL );if (actual_group == block_group)return 1 ;return 0 ;
@@ -538,7 +538,7 @@ void ext4_rsv_window_add(struct super_block *sb,* from the filesystem reservation window rb tree. Must be called with * rsv_lock hold. */ -void rsv_window_remove (struct super_block *sb, +static void rsv_window_remove (struct super_block *sb,struct ext4_reserve_window_node *rsv) { rsv->rsv_start =EXT4_RESERVE_WINDOW_NOT_ALLOCATED ;
@@ -1706,7 +1706,12 @@ ext4_fsblk_t ext4_old_new_blocks(handle_t *handle, struct inode *inode, } sbi =EXT4_SB (sb); - *count =ext4_has_free_blocks (sbi, *count); +if (!EXT4_I (inode)->i_delalloc_reserved_flag) { +/* +* With delalloc we already reserved the blocks +*/ + *count =ext4_has_free_blocks (sbi, *count); + }if (*count ==0 ) { *errp = -ENOSPC ;return 0 ;/*return with ENOSPC error */
@@ -1907,7 +1912,8 @@ ext4_fsblk_t ext4_old_new_blocks(handle_t *handle, struct inode *inode,le16_add_cpu (&gdp->bg_free_blocks_count, -num); gdp->bg_checksum =ext4_group_desc_csum (sbi, group_no, gdp);spin_unlock (sb_bgl_lock (sbi, group_no)); -percpu_counter_sub (&sbi->s_freeblocks_counter, num); +if (!EXT4_I (inode)->i_delalloc_reserved_flag) +percpu_counter_sub (&sbi->s_freeblocks_counter, num);if (sbi->s_log_groups_per_flex) {ext4_group_t flex_group =ext4_flex_group (sbi, group_no);
@@ -1977,52 +1983,53 @@ static ext4_fsblk_t do_blk_alloc(handle_t *handle, struct inode *inode, ret =ext4_mb_new_blocks (handle, &ar, errp); *count = ar.len; -/* -* Account for the allocated meta blocks -*/ -if (!(*errp) && (flags &EXT4_META_BLOCK )) { -spin_lock (&EXT4_I (inode)->i_block_reservation_lock); -EXT4_I (inode)->i_allocated_meta_blocks += ar.len; -spin_unlock (&EXT4_I (inode)->i_block_reservation_lock); - }return ret; }/* -* ext4_new_meta_block() -- allocate block for meta data (indexing) blocks +* ext4_new_meta_blocks() -- allocate block for meta data (indexing) blocks * * @handle: handle to this transaction * @inode: file inode * @goal: given target block(filesystem wide) +* @count: total number of blocks need * @errp: error code * -* Return allocated block number on success +* Return 1st allocated block numberon success, *count stores total account +* error stores in errp pointer */ -ext4_fsblk_t ext4_new_meta_block (handle_t *handle,struct inode *inode, -ext4_fsblk_t goal,int *errp) +ext4_fsblk_t ext4_new_meta_blocks (handle_t *handle,struct inode *inode, +ext4_fsblk_t goal,unsigned long *count,int *errp) { -unsigned long count =1 ; -return do_blk_alloc (handle, inode,0 , goal, - &count, errp,EXT4_META_BLOCK ); +ext4_fsblk_t ret; + ret =do_blk_alloc (handle, inode,0 , goal, + count, errp,EXT4_META_BLOCK ); +/* +* Account for the allocated meta blocks +*/ +if (!(*errp)) { +spin_lock (&EXT4_I (inode)->i_block_reservation_lock); +EXT4_I (inode)->i_allocated_meta_blocks += *count; +spin_unlock (&EXT4_I (inode)->i_block_reservation_lock); + } +return ret; }/* -* ext4_new_meta_blocks() -- allocate block for meta data (indexing) blocks +* ext4_new_meta_block() -- allocate block for meta data (indexing) blocks * * @handle: handle to this transaction * @inode: file inode * @goal: given target block(filesystem wide) -* @count: total number of blocks need * @errp: error code * -* Return 1st allocated block numberon success, *count stores total account -* error stores in errp pointer +* Return allocated block number on success */ -ext4_fsblk_t ext4_new_meta_blocks (handle_t *handle,struct inode *inode, -ext4_fsblk_t goal,unsigned long *count,int *errp) +ext4_fsblk_t ext4_new_meta_block (handle_t *handle,struct inode *inode, +ext4_fsblk_t goal,int *errp) { -return do_blk_alloc (handle, inode,0 , goal, - count, errp,EXT4_META_BLOCK ); +unsigned long count =1 ; +return ext4_new_meta_blocks (handle, inode, goal, &count, errp); }/*
fs/ext4/extents.c +11 -7
@@ -592,11 +592,15 @@ ext4_ext_find_extent(struct inode *inode, ext4_lblk_t block, } path[ppos].p_depth = i; + path[ppos].p_ext =NULL ; path[ppos].p_idx =NULL ;/* find extent */ ext4_ext_binsearch (inode, path + ppos, block); - path[ppos].p_block =ext_pblock (path[ppos].p_ext); +/* if not an empty leaf */ +if (path[ppos].p_ext) + path[ppos].p_block =ext_pblock (path[ppos].p_ext); +ext4_ext_show_path (inode, path);
@@ -3120,7 +3124,7 @@ long ext4_fallocate(struct inode *inode, int mode, loff_t offset, loff_t len)struct fiemap *fiemap_s;struct fiemap_extent fm_extent;size_t tot_mapping_len; -char *cur_ext_ptr; +char __user *cur_ext_ptr;int current_extent;int err; };
@@ -3128,7 +3132,7 @@ long ext4_fallocate(struct inode *inode, int mode, loff_t offset, loff_t len)/* * Callback function called for each extent to gather FIEMAP information. */ -int ext4_ext_fiemap_cb (struct inode *inode,struct ext4_ext_path *path, +static int ext4_ext_fiemap_cb (struct inode *inode,struct ext4_ext_path *path,struct ext4_ext_cache *newex,struct ext4_extent *ex,void *data) {
@@ -3252,7 +3256,7 @@ int ext4_fiemap(struct inode *inode, unsigned long arg) start_blk = fiemap_s->fm_start >> inode->i_sb->s_blocksize_bits; fiemap_i.fiemap_s = fiemap_s; fiemap_i.tot_mapping_len =0 ; - fiemap_i.cur_ext_ptr = (char *)(arg +sizeof (*fiemap_s)); + fiemap_i.cur_ext_ptr = (char __user *)(arg +sizeof (*fiemap_s)); fiemap_i.current_extent =0 ; fiemap_i.err =0 ;
@@ -3277,18 +3281,18 @@ int ext4_fiemap(struct inode *inode, unsigned long arg)if (fiemap_i.current_extent !=0 && fiemap_i.current_extent < fiemap_s->fm_extent_count && !(fiemap_s->fm_flags &FIEMAP_FLAG_NUM_EXTENTS )) { -char *dest; +char __user *dest; last_extent = &fiemap_i.fm_extent; last_extent->fe_flags |=FIEMAP_EXTENT_LAST ; - dest = (char *)arg +sizeof (*fiemap_s) + fm_extent_size * + dest = (char __user *)arg +sizeof (*fiemap_s) + fm_extent_size * (fiemap_s->fm_extent_count -1 ); err =copy_to_user (dest, last_extent, fm_extent_size);if (err) goto out_free; } - err =copy_to_user ((void *)arg, fiemap_s,sizeof (*fiemap_s)); + err =copy_to_user ((void __user *)arg, fiemap_s,sizeof (*fiemap_s)); out_free:kfree (fiemap_s);
fs/ext4/ialloc.c +0 -1
@@ -820,7 +820,6 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode * dir, int mode) ei->i_state =EXT4_STATE_NEW ; ei->i_extra_isize =EXT4_SB (sb)->s_want_extra_isize; -jbd2_journal_init_jbd_inode (&ei->jinode, inode); ret = inode;if (DQUOT_ALLOC_INODE (inode)) {
fs/ext4/inode.c +46 -52
202 lines not on this page · raw message
fs/ext4/super.c +3 -3
@@ -578,6 +578,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb) ei->i_allocated_meta_blocks =0 ; ei->i_delalloc_reserved_flag =0 ;spin_lock_init (&(ei->i_block_reservation_lock)); +jbd2_journal_init_jbd_inode (&ei->jinode, &ei->vfs_inode);return &ei->vfs_inode; }
@@ -1878,8 +1879,8 @@ static unsigned long ext4_get_stripe_size(struct ext4_sb_info *sbi) }static int ext4_fill_super (struct super_block *sb,void *data,int silent) -__releases (kernel_sem) -__acquires (kernel_sem) +__releases (kernel_lock) +__acquires (kernel_lock) {struct buffer_head * bh;
@@ -1996,7 +1997,6 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)* Use -o nodelalloc to turn it off */ set_opt (sbi->s_mount_opt,DELALLOC ); -set_opt (sbi->s_mount_opt,WRITEBACK_DATA ); if (!parse_options ((char *) data, sb, &journal_inum, &journal_devnum,
fs/jbd2/commit.c +36 -5
77 lines not on this page · raw message
Aneesh Kumar K.V
Acked-by Jan KaraQuoted 10 lines · Aneesh Kumar K.V
Hi Mingming,
Attached below are new patches for the patchqueue. Some of patches update already existing patches, mostly to get them apply cleanly after adding new patches or to fix sparse warning. The modified patches should not have any functionality change. The diff between the patchqueue and updated queue is attached below. That should help to look at the changes easily. The patch queue looked at is as of commit
22d4c3124d50803222c14116b3fdf08dc447a119
Quoted 8 lines
The updated series file
http://www.radian.org/~kvaneesh/ext4/jun-15-2008/series
The patches
http://www.radian.org/~kvaneesh/ext4/jun-15-2008/
The complete patchset.
http://www.radian.org/~kvaneesh/ext4/jun-15-2008/patches.tar.gz
Update for 12-ext4-jinode-hang.patch after review.
ext4: Fix file system hang due to corrupt jinode values.
From: Aneesh Kumar K.V <[email protected]>
While commiting the transaction we set the i_flags of jbd2_inode to JI_COMMIT_RUNNING. This is needed to ensure that when we are commiting the transaction we don't release the inode via iput. In ext4_clear_inode we wait for the flag to be cleared before we release the inode.
In ext4_new_inode we call iput for different failure cases before initializing the jbd2_inode. This cause the failure case to hang in iput as show below. Fix the same by initializing jbd2_inode early.
[<c022d20e>] ? prepare_to_wait+0x49/0x4e
[<c02cf430>] jbd2_journal_release_jbd_inode+0x86/0xcc [<c022d0e4>] ? wake_bit_function+0x0/0x43 [<c02b329b>] ext4_clear_inode+0x45/0x4a [<c02748f7>] clear_inode+0x5f/0xae [<c0274e8f>] generic_drop_inode+0x119/0x13a [<c0274071>] iput+0x4b/0x4e [<c02ab200>] ext4_new_inode+0xb29/0xb7a [<c0272761>] ? dput+0x19/0xdc [<c02cca5f>] ? jbd2_journal_start+0x8c/0xb9 [<c02b1cb4>] ext4_create+0x81/0xe7 [<c02b1c33>] ? ext4_create+0x0/0xe7 [<c026aa3c>] vfs_create+0x6c/0xdb [<c026cfd6>] do_filp_open+0x1a6/0x6b5 [<c026284e>] do_sys_open+0x40/0xb6 [<c0262906>] sys_open+0x1e/0x26 [<c0202be6>] syscall_call+0x7/0xb
---
fs/ext4/ialloc.c | 1 - fs/ext4/inode.c | 1 - fs/ext4/mballoc.c | 2 -- fs/ext4/super.c | 1 + 4 files changed, 1 insertions(+), 4 deletions(-)
fs/ext4/ialloc.c +0 -1
@@ -820,7 +820,6 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode * dir, int mode) ei->i_state =EXT4_STATE_NEW ; ei->i_extra_isize =EXT4_SB (sb)->s_want_extra_isize; -jbd2_journal_init_jbd_inode (&ei->jinode, inode); ret = inode;if (DQUOT_ALLOC_INODE (inode)) {
fs/ext4/inode.c +0 -1
@@ -3125,7 +3125,6 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) ei->i_default_acl =EXT4_ACL_NOT_CACHED ;#endif ei->i_block_alloc_info =NULL ; -jbd2_journal_init_jbd_inode (&ei->jinode, inode); ret =__ext4_get_inode_loc (inode, &iloc,0 );if (ret <0 )
fs/ext4/mballoc.c +0 -2
@@ -2259,8 +2259,6 @@ static int ext4_mb_init_backend(struct super_block *sb)printk (KERN_ERR "EXT4-fs: can't get new inode\n" ); goto err_freesgi; } -jbd2_journal_init_jbd_inode (&EXT4_I (sbi->s_buddy_cache)->jinode, - sbi->s_buddy_cache);EXT4_I (sbi->s_buddy_cache)->i_disksize =0 ; metalen =sizeof (*meta_group_info) <<EXT4_DESC_PER_BLOCK_BITS (sb);
fs/ext4/super.c +1 -0
@@ -578,6 +578,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb) ei->i_allocated_meta_blocks =0 ; ei->i_delalloc_reserved_flag =0 ;spin_lock_init (&(ei->i_block_reservation_lock)); +jbd2_journal_init_jbd_inode (&ei->jinode, &ei->vfs_inode);return &ei->vfs_inode; }
Quoted 11 lines · Aneesh Kumar K.V
Quoted 10 lines · Aneesh Kumar K.V
Hi Mingming,
Attached below are new patches for the patchqueue. Some of patches update already existing patches, mostly to get them apply cleanly after adding new patches or to fix sparse warning. The modified patches should not have any functionality change. The diff between the patchqueue and updated queue is attached below. That should help to look at the changes easily. The patch queue looked at is as of commit
22d4c3124d50803222c14116b3fdf08dc447a119
Quoted 9 lines
Quoted 8 lines
The updated series file
http://www.radian.org/~kvaneesh/ext4/jun-15-2008/series
The patches
http://www.radian.org/~kvaneesh/ext4/jun-15-2008/
The complete patchset.
http://www.radian.org/~kvaneesh/ext4/jun-15-2008/patches.tar.gz
I have updated the patch queue with your changes, and place them in the right location.
Mingming
Quoted 96 lines
Update for 12-ext4-jinode-hang.patch after review.
ext4: Fix file system hang due to corrupt jinode values.
From: Aneesh Kumar K.V <[email protected]>
While commiting the transaction we set the
i_flagsofjbd2_inodetoJI_COMMIT_RUNNING. This is needed to ensure that when we are commiting the transaction we don't release the inode via iput. Inext4_clear_inodewe wait for the flag to be cleared before we release the inode.In
ext4_new_inodewe call iput for different failure cases before initializing thejbd2_inode. This cause the failure case to hang in iput as show below. Fix the same by initializingjbd2_inodeearly.[<
c022d20e>] ?prepare_to_wait+0x49/0x4e[<c02cf430>] jbd2_journal_release_jbd_inode+0x86/0xcc [<c022d0e4>] ? wake_bit_function+0x0/0x43 [<c02b329b>] ext4_clear_inode+0x45/0x4a [<c02748f7>] clear_inode+0x5f/0xae [<c0274e8f>] generic_drop_inode+0x119/0x13a [<c0274071>] iput+0x4b/0x4e [<c02ab200>] ext4_new_inode+0xb29/0xb7a [<c0272761>] ? dput+0x19/0xdc [<c02cca5f>] ? jbd2_journal_start+0x8c/0xb9 [<c02b1cb4>] ext4_create+0x81/0xe7 [<c02b1c33>] ? ext4_create+0x0/0xe7 [<c026aa3c>] vfs_create+0x6c/0xdb [<c026cfd6>] do_filp_open+0x1a6/0x6b5 [<c026284e>] do_sys_open+0x40/0xb6 [<c0262906>] sys_open+0x1e/0x26 [<c0202be6>] syscall_call+0x7/0xbReported-by Holger Kiehl <[email protected]>Signed-off-by Aneesh Kumar K.V <[email protected]>Acked-by Jan Kara <[email protected]>---
fs/ext4/ialloc.c | 1 - fs/ext4/inode.c | 1 - fs/ext4/mballoc.c | 2 -- fs/ext4/super.c | 1 + 4 files changed, 1 insertions(+), 4 deletions(-)fs/ext4/ialloc.c +0
-1@@ -820,7 +820,6 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode * dir, int mode) ei->i_state =EXT4_STATE_NEW ; ei->i_extra_isize =EXT4_SB (sb)->s_want_extra_isize; -jbd2_journal_init_jbd_inode (&ei->jinode, inode); ret = inode;if (DQUOT_ALLOC_INODE (inode)) {fs/ext4/inode.c +0
-1@@ -3125,7 +3125,6 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) ei->i_default_acl =EXT4_ACL_NOT_CACHED ;#endif ei->i_block_alloc_info =NULL ; -jbd2_journal_init_jbd_inode (&ei->jinode, inode); ret =__ext4_get_inode_loc (inode, &iloc,0 );if (ret <0 )fs/ext4/mballoc.c +0
-2@@ -2259,8 +2259,6 @@ static int ext4_mb_init_backend(struct super_block *sb)printk (KERN_ERR "EXT4-fs: can't get new inode\n" ); goto err_freesgi; } -jbd2_journal_init_jbd_inode (&EXT4_I (sbi->s_buddy_cache)->jinode, - sbi->s_buddy_cache);EXT4_I (sbi->s_buddy_cache)->i_disksize =0 ; metalen =sizeof (*meta_group_info) <<EXT4_DESC_PER_BLOCK_BITS (sb);fs/ext4/super.c +1
-0@@ -578,6 +578,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb) ei->i_allocated_meta_blocks =0 ; ei->i_delalloc_reserved_flag =0 ;spin_lock_init (&(ei->i_block_reservation_lock)); +jbd2_journal_init_jbd_inode (&ei->jinode, &ei->vfs_inode);return &ei->vfs_inode; }