Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: update permissions of DAX devices after clearing bad blocks #5611

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/test/unittest/badblock.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2021, Intel Corporation
# Copyright 2021-2023, Intel Corporation
#
"""Bad block utilities"""

Expand Down Expand Up @@ -106,6 +106,18 @@ def clear_all_bad_blocks(self, file):
if self.is_devdax(device):
futils.run_command("sudo ndctl clear-errors {}".format(namespace),
"failed to clear bad blocks")
# The "sudo ndctl clear-errors" command resets permissions
# of the DAX block device and its resource files
# because it removes the old files and creates new ones
# with default permissions which interrupts further test execution.
# The following commands set permissions which should allow
# further test execution to work around this issue.
futils.run_command("sudo chmod a+rw {}".format(device),
"failed to change permissions of a DAX device")
resources = "/sys/bus/nd/devices/ndbus*/region*/dax*/resource"
futils.run_command("sudo chmod a+r {}".format(resources),
"failed to change permissions "
"of DAX devices' resources")
else:
out = futils.run_command("mount | grep {}".format(device),
"querying mount points failed")
Expand Down