ap_tools/ap-check: hold ap config file lock over get attributes

Since this callout reads sysfs values for the specified mdev, the
ap config file lock should be held to prevent other tools from
making changes to the ap configuration at the same time.

Reviewed-by: Jason J. Herne <jjherne@linux.ibm.com>
Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
Matthew Rosato
2023-07-05 08:54:13 -04:00
committed by Steffen Eiden
parent dad7fce7a1
commit f6e78d3ecd

View File

@@ -787,6 +787,14 @@ static int ap_check_handle_get_attributes(struct ap_check_anchor *anc)
char buf[80];
char *path;
FILE *f;
int rc;
rc = ap_get_lock_callout();
if (rc) {
fprintf(stderr, "Failed to acquire configuration lock %d\n", rc);
return -1;
}
anc->cleanup_lock = true;
path = path_get_vfio_ap_attr(anc->uuid, "matrix");
f = fopen(path, "r");