Skip to content

Commit

Permalink
test: update permissions of DAX devices after clearing bad blocks
Browse files Browse the repository at this point in the history
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.

Ref: #5606

Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
  • Loading branch information
ldorau committed May 5, 2023
1 parent 705eca0 commit b207bcd
Showing 1 changed file with 13 additions and 1 deletion.
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

0 comments on commit b207bcd

Please sign in to comment.