From: Josef Bacik Date: Mon, 13 Aug 2012 19:43:26 +0000 (-0400) Subject: Btrfs: update last trans if we don't update the inode X-Git-Tag: firefly_0821_release~3680^2~1721^2~107 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7c735313bd1277c2eb28421934d4c7a0fa7339f7;p=firefly-linux-kernel-4.4.55.git Btrfs: update last trans if we don't update the inode There is a completely impossible situation to hit where you can preallocate a file, fsync it, write into the preallocated region, have the transaction commit twice and then fsync and then immediately lose power and lose all of the contents of the write. This patch fixes this just so I feel better about the situation and because it is lightweight, we just update the last_trans when we finish an ordered IO and we don't update the inode itself. This way we are completely safe and I feel better. Thanks, Signed-off-by: Josef Bacik --- diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index ec154f954646..6971bac66d9d 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1949,6 +1949,8 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent) btrfs_abort_transaction(trans, root, ret); goto out_unlock; } + } else { + btrfs_set_inode_last_trans(trans, inode); } ret = 0; out_unlock: