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

8.3 linstor: Fix to add sync to DD #72

Open
wants to merge 1 commit into
base: 3.2.3-8.3
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions drivers/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ def zeroOut(path, fromByte, bytes):
bytesBefore = bytes
bytes -= bytesBefore
cmd = [CMD_DD, "if=/dev/zero", "of=%s" % path, "bs=1",
"seek=%s" % fromByte, "count=%s" % bytesBefore]
"seek=%s" % fromByte, "count=%s" % bytesBefore, "conv=fsync"]
try:
pread2(cmd)
except CommandException:
Expand All @@ -621,15 +621,15 @@ def zeroOut(path, fromByte, bytes):
fromByte = (fromBlock + blocks) * blockSize
if blocks:
cmd = [CMD_DD, "if=/dev/zero", "of=%s" % path, "bs=%s" % blockSize,
"seek=%s" % fromBlock, "count=%s" % blocks]
"seek=%s" % fromBlock, "count=%s" % blocks, "conv=fsync"]
try:
pread2(cmd)
except CommandException:
return False

if bytes:
cmd = [CMD_DD, "if=/dev/zero", "of=%s" % path, "bs=1",
"seek=%s" % fromByte, "count=%s" % bytes]
"seek=%s" % fromByte, "count=%s" % bytes, "conv=fsync"]
try:
pread2(cmd)
except CommandException:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ def test_zero_out_two_aligned_blocks(self):
# Arrange
self._add_process(
[DD_CMD, "if=/dev/zero", "of=/test/path/foo", "bs=4096",
"seek=0", "count=2"],
"seek=0", "count=2", "conv=fsync"],
0, b"", b"")
# Act
result = util.zeroOut('/test/path/foo', 0, 8192)
Expand All @@ -624,11 +624,11 @@ def test_zero_out_misaligned_blocks(self):
# Arrange
self._add_process(
[DD_CMD, "if=/dev/zero", "of=/test/path/foo", "bs=1",
"seek=1024", "count=3072"],
"seek=1024", "count=3072", "conv=fsync"],
0, b"", b"")
self._add_process(
[DD_CMD, "if=/dev/zero", "of=/test/path/foo", "bs=1",
"seek=4096", "count=100"],
"seek=4096", "count=100", "conv=fsync"],
0, b"", b"")

# Act
Expand All @@ -641,7 +641,7 @@ def test_zero_out_small_block(self):
# Arrange
self._add_process(
[DD_CMD, "if=/dev/zero", "of=/test/path/foo", "bs=1",
"seek=1024", "count=2048"],
"seek=1024", "count=2048", "conv=fsync"],
0, b"", b"")

# Act
Expand Down
Loading