Btrfs: fix wrong sync_writers decrement in btrfs_file_aio_write()
authorMiao Xie <miaox@cn.fujitsu.com>
Mon, 28 Jan 2013 12:34:55 +0000 (12:34 +0000)
committerJosef Bacik <jbacik@fusionio.com>
Tue, 5 Feb 2013 21:09:10 +0000 (16:09 -0500)
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>
fs/btrfs/file.c

index 841cfe3be0e004f304510222e5d2b0a86ec20e2c..a902faab7161f4a75c6aca228817c313bb33aa5f 100644 (file)
@@ -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;