Skip to content

Commit

Permalink
Btrfs: fix wrong sync_writers decrement in btrfs_file_aio_write()
Browse files Browse the repository at this point in the history
If the checks at the beginning of btrfs_file_aio_write() fail, we needn't
decrease ->sync_writers, because we have not increased it. Fix it.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
  • Loading branch information
Miao Xie authored and Josef Bacik committed Feb 5, 2013
1 parent 222c81d commit 0a3404d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/btrfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1595,9 +1595,10 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb,
if (err < 0 && num_written > 0)
num_written = err;
}
out:

if (sync)
atomic_dec(&BTRFS_I(inode)->sync_writers);
out:
sb_end_write(inode->i_sb);
current->backing_dev_info = NULL;
return num_written ? num_written : err;
Expand Down

0 comments on commit 0a3404d

Please sign in to comment.