Skip to content

Commit

Permalink
Fix for issue utsaslab#4. For strict mode, during overwrite, the i_bl…
Browse files Browse the repository at this point in the history
…ocks are being subtracted more times than required, causing problems in truncate. Correctly decrementing i_blocks fixes the issue
  • Loading branch information
Chameleon Cloud User committed Dec 13, 2021
1 parent 9fc402c commit 5b8c780
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Linux-5.1/fs/winefs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -833,13 +833,6 @@ static int recursive_alloc_blocks(pmfs_transaction_t *trans,
blocknr++;
}

if (free_blk_list != NULL && (*num_free_blks != 0)) {
unsigned int data_bits = blk_type_to_shift[pi->i_blk_type];
pmfs_memunlock_inode(sb, pi);
pi->i_blocks -= ((*num_free_blks) <<
(data_bits - sb->s_blocksize_bits));
pmfs_memunlock_inode(sb, pi);
}
pmfs_memlock_block(sb, node);
i += allocated;
} else {
Expand Down Expand Up @@ -890,6 +883,16 @@ static int recursive_alloc_blocks(pmfs_transaction_t *trans,
}
}

if (height == 1) {
if (free_blk_list != NULL && (*num_free_blks != 0)) {
unsigned int data_bits = blk_type_to_shift[pi->i_blk_type];
pmfs_memunlock_inode(sb, pi);
pi->i_blocks -= ((*num_free_blks) <<
(data_bits - sb->s_blocksize_bits));
pmfs_memunlock_inode(sb, pi);
}
}

if (new_node || trans == NULL) {
/* if the changes were not logged, flush the cachelines we may
* have modified */
Expand Down

0 comments on commit 5b8c780

Please sign in to comment.