- if (commit_mode == 2 && fd != -1) {
- res = wait_for_commit(fd);
- if (res < 0) {
- fprintf(stderr,
- "ERROR: unable to do final sync: %s\n",
- strerror(errno));
- ret = 1;
+ if (commit_mode == COMMIT_AFTER) {
+ int slot;
+
+ /*
+ * Traverse seen_fsid_hash and issue SYNC ioctl on each
+ * filesystem
+ */
+ for (slot = 0; slot < SEEN_FSID_HASH_SIZE; slot++) {
+ struct seen_fsid *seen = seen_fsid_hash[slot];
+
+ while (seen) {
+ res = wait_for_commit(seen->fd);
+ if (res < 0) {
+ uuid_unparse(seen->fsid, uuidbuf);
+ error(
+ "unable to do final sync after deletion: %m, fsid: %s",
+ uuidbuf);
+ ret = 1;
+ } else if (verbose > 0) {
+ uuid_unparse(seen->fsid, uuidbuf);
+ printf("final sync is done for fsid: %s\n",
+ uuidbuf);
+ }
+ seen = seen->next;
+ }