From c31c50f3309110162f345b6b07389ff6e7e929d4 Mon Sep 17 00:00:00 2001 From: chandan Date: Mon, 23 Sep 2013 23:47:11 +0530 Subject: [PATCH] btrfs-progs: cmd_find_new: Sync fs before searching for modified files. The sync makes sure that 'very recently' introduced delayed work is accounted for in the output of 'btrfs subvolume find-new' command. Signed-off-by: chandan Signed-off-by: David Sterba Signed-off-by: Chris Mason --- cmds-subvolume.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmds-subvolume.c b/cmds-subvolume.c index de246abd..8832303c 100644 --- a/cmds-subvolume.c +++ b/cmds-subvolume.c @@ -786,6 +786,15 @@ static int cmd_find_new(int argc, char **argv) fprintf(stderr, "ERROR: can't access '%s'\n", subvol); return 1; } + + ret = ioctl(fd, BTRFS_IOC_SYNC); + if (ret < 0) { + fprintf(stderr, "ERROR: unable to fs-syncing '%s' - %s\n", + subvol, strerror(errno)); + close_file_or_dir(fd, dirstream); + return 1; + } + ret = btrfs_list_find_updated_files(fd, 0, last_gen); close_file_or_dir(fd, dirstream); return !!ret;