Skip to contentSkip to conversation

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

PATCH In review chandan 1 participant 2 messages Sep 23, 2013 Btrfs file system

lore
Share & tools
lore

chandan

author
#0 lore raw

PATCH 1/1 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.

---
 cmds-subvolume.c | 9 +++++++++
 1 file changed, 9 insertions(+)
cmds-subvolume.c +9 -0
index de246ab..8832303 100644
@@ -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;
Signature · 1 line
1.8.3.1
author
#1 lore raw

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