Skip to content

fix(hostagent): avoid EBUSY when setting sriov_numvfs#58

Open
tsorya wants to merge 1 commit into
NVIDIA:public-mainfrom
tsorya:fix/sriov-numvfs-ebusy
Open

fix(hostagent): avoid EBUSY when setting sriov_numvfs#58
tsorya wants to merge 1 commit into
NVIDIA:public-mainfrom
tsorya:fix/sriov-numvfs-ebusy

Conversation

@tsorya

@tsorya tsorya commented Jun 13, 2026

Copy link
Copy Markdown

The kernel returns EBUSY when writing to sriov_numvfs if VFs already exist. This happens in two scenarios during reconciliation:

  1. The desired VF count is already configured (redundant write).
  2. A different non-zero VF count is requested without first resetting to 0.

Read the current sriov_numvfs value before writing:

  • If it already matches, skip the write entirely.
  • If changing from one non-zero value to another, write 0 first to tear down existing VFs before setting the new count.

Example error seen in production:
failed to execute operation CreateP0VF: write /sys/bus/pci/devices/0000:b5:00.0/sriov_numvfs: device or resource busy

The kernel returns EBUSY when writing to sriov_numvfs if VFs already
exist. This happens in two scenarios during reconciliation:

1. The desired VF count is already configured (redundant write).
2. A different non-zero VF count is requested without first resetting
   to 0.

Read the current sriov_numvfs value before writing:
- If it already matches, skip the write entirely.
- If changing from one non-zero value to another, write 0 first to
  tear down existing VFs before setting the new count.

Example error seen in production:
  failed to execute operation CreateP0VF: write
  /sys/bus/pci/devices/0000:b5:00.0/sriov_numvfs: device or resource busy

Signed-off-by: Igal Tsoiref <itsoiref@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@langyenan

Copy link
Copy Markdown
Contributor

Under what conditions would this happen? VF creation is executed after host reboot, during which sriov_numvfs is reset to 0.

@tsorya

tsorya commented Jun 15, 2026

Copy link
Copy Markdown
Author

We have an api to set VF number and as part of the installation we were asked to set 1 and in case it had not zero value we will fail

@tsorya

tsorya commented Jun 15, 2026

Copy link
Copy Markdown
Author

In general it should be safe fix, nothing changes in the flow if vf number is 0 or the same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants