If hammer cleanup gets called more frequently than the cleanup runs
take, they build up, all trying to run in parallel. Prevent this by
locking the config file while cleanup is running. If cleanup finds the
config file locked for a PFS, it will skip processing.
return;
}
+ if (flock(fileno(fp), LOCK_EX|LOCK_NB) == -1) {
+ if (errno == EWOULDBLOCK)
+ printf(" PFS #%d locked by other process\n", pfs.pfs_id);
+ else
+ printf(" can not lock %s: %s\n", config_path, strerror(errno));
+ fclose(fp);
+ return;
+ }
+
printf(" handle PFS #%d using %s\n", pfs.pfs_id, snapshots_path);
/*