diff mbox

btrfs-progs: cmd_find_new: Sync fs before searching for modified files.

Message ID 2363441.CTgOPvMvZp@localhost.localdomain (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Chandan Rajendra Sept. 23, 2013, 6:17 p.m. UTC
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 <chandan@linux.vnet.ibm.com>
---
 cmds-subvolume.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Chandan Rajendra Sept. 23, 2013, 6:19 p.m. UTC | #1
This patch was tested on a kernel with "[PATCH v4] Btrfs: fix sync fs to
actually wait for all data to be persisted" applied.

Thanks,
chandan

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index de246ab..8832303 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;