Skip to content

drmgr/lsslot: DR lock acquisition is flaky #98

@nathanlynch

Description

@nathanlynch

Run two instances of lsslot concurrently and often one of them will error out:

[root@ltczep4-lp3 ~]# lsslot & lsslot
[1] 2920840
/var/lock/dr_config_lock: Resource temporarily unavailable
[root@ltczep4-lp3 ~]# # Slot                      Description       Linux Name    Device(s)
U9040.MR9.1328F4X-V10-C0    Virtual I/O Slot  30000000      vty
U9040.MR9.1328F4X-V10-C2    Virtual I/O Slot  30000002      l-lan
U9040.MR9.1328F4X-V10-C103  Virtual I/O Slot  30000067      v-scsi

[1]+  Done                    lsslot

The intention of dr_lock() is to wait for the lock either indefinitely or until an optional timeout expires. But at this point in the program's execution, the dr_timeout variable is always 0 since main() has yet to call set_timeout(). This causes any lock contention to make the program exit:

int drmgr_timed_out(void)
{
	if (dr_timeout == -1)
		return 0;	/* No timeout specified */

	if (dr_timeout > time((time_t *)0))
		return 0;

	say(WARN, "Drmgr has exceeded its specified wait time and will not "
	    "continue\n");
	return 1;
}

lsslot makes for an easy illustration, but more importantly I believe this problem affects the drmgr command as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions