|
|
@@ -860,6 +860,40 @@ tarobject(void *ctx, struct tar_entry *ti)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+#if defined(SYNC_FILE_RANGE_WAIT_BEFORE)
|
|
|
+static void
|
|
|
+tar_writeback_barrier(struct fileinlist *files, struct pkginfo *pkg)
|
|
|
+{
|
|
|
+ struct fileinlist *cfile;
|
|
|
+
|
|
|
+ for (cfile = files; cfile; cfile = cfile->next) {
|
|
|
+ struct filenamenode *usenode;
|
|
|
+ const char *usename;
|
|
|
+ int fd;
|
|
|
+
|
|
|
+ if (!(cfile->namenode->flags & fnnf_deferred_fsync))
|
|
|
+ continue;
|
|
|
+
|
|
|
+ usenode = namenodetouse(cfile->namenode, pkg);
|
|
|
+ usename = usenode->name + 1; /* Skip the leading '/'. */
|
|
|
+
|
|
|
+ setupfnamevbs(usename);
|
|
|
+
|
|
|
+ fd = open(fnamenewvb.buf, O_WRONLY);
|
|
|
+ if (fd < 0)
|
|
|
+ ohshite(_("unable to open '%.255s'"), fnamenewvb.buf);
|
|
|
+ sync_file_range(fd, 0, 0, SYNC_FILE_RANGE_WAIT_BEFORE);
|
|
|
+ if (close(fd))
|
|
|
+ ohshite(_("error closing/writing `%.255s'"), fnamenewvb.buf);
|
|
|
+ }
|
|
|
+}
|
|
|
+#else
|
|
|
+static void
|
|
|
+tar_writeback_barrier(struct fileinlist *files, struct pkginfo *pkg)
|
|
|
+{
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
void
|
|
|
tar_deferred_extract(struct fileinlist *files, struct pkginfo *pkg)
|
|
|
{
|
|
|
@@ -871,6 +905,8 @@ tar_deferred_extract(struct fileinlist *files, struct pkginfo *pkg)
|
|
|
debug(dbg_general, "deferred extract mass sync");
|
|
|
if (!fc_unsafe_io)
|
|
|
sync();
|
|
|
+#else
|
|
|
+ tar_writeback_barrier(files, pkg);
|
|
|
#endif
|
|
|
|
|
|
for (cfile = files; cfile; cfile = cfile->next) {
|