summaryrefslogtreecommitdiffstats
path: root/source4
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@samba.org>2015-02-23 11:09:02 +0100
committerJeremy Allison <jra@samba.org>2015-03-09 21:27:07 +0100
commit904d5809e588a898bfd9658eeb3c9b4bc63695f8 (patch)
tree2f4fae14b751b3f4e2f761524a52b581a5bd6e4b /source4
parentf5c472ea47b2b45f8303e62772a21b77644ed5dc (diff)
downloadsamba-904d5809e588a898bfd9658eeb3c9b4bc63695f8.tar.gz
samba-904d5809e588a898bfd9658eeb3c9b4bc63695f8.tar.xz
samba-904d5809e588a898bfd9658eeb3c9b4bc63695f8.zip
torture/ioctl: remove FS specific sparse punch check
Samba uses PUNCH_HOLE to zero a range, and subsequently uses fallocate() to allocate the punched range if the file is marked non-sparse and "strict allocate" is enabled. In both cases, the zeroed range will not be detected by SEEK_DATA, so the range won't be present in QAR responses until the file is marked non-sparse again. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/smb2/ioctl.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/source4/torture/smb2/ioctl.c b/source4/torture/smb2/ioctl.c
index 9e152c727d..94a809b5a3 100644
--- a/source4/torture/smb2/ioctl.c
+++ b/source4/torture/smb2/ioctl.c
@@ -3252,7 +3252,7 @@ static bool test_ioctl_sparse_punch(struct torture_context *torture,
status = test_ioctl_sparse_req(torture, tmp_ctx, tree, fh, true);
torture_assert_ntstatus_ok(torture, status, "FSCTL_SET_SPARSE");
- /* expect still fully allocated */
+ /* still fully allocated on NTFS, see note below for Samba */
status = test_ioctl_qar_req(torture, tmp_ctx, tree, fh,
0, /* off */
4096, /* len */
@@ -3260,12 +3260,26 @@ static bool test_ioctl_sparse_punch(struct torture_context *torture,
&far_count);
torture_assert_ntstatus_ok(torture, status,
"FSCTL_QUERY_ALLOCATED_RANGES req failed");
- torture_assert_u64_equal(torture, far_count, 1,
- "unexpected response len");
- torture_assert_u64_equal(torture, far_rsp[0].file_off, 0,
- "unexpected far off");
- torture_assert_u64_equal(torture, far_rsp[0].len, 4096,
- "unexpected far len");
+ /*
+ * FS specific: Samba uses PUNCH_HOLE to zero the range, and
+ * subsequently uses fallocate() to allocate the punched range if the
+ * file is marked non-sparse and "strict allocate" is enabled. In both
+ * cases, the zeroed range will not be detected by SEEK_DATA, so the
+ * range won't be present in QAR responses until the file is marked
+ * non-sparse again.
+ */
+ if (far_count == 0) {
+ torture_comment(torture, "non-sparse zeroed range disappeared "
+ "after marking sparse\n");
+ } else {
+ /* NTFS: range remains fully allocated */
+ torture_assert_u64_equal(torture, far_count, 1,
+ "unexpected response len");
+ torture_assert_u64_equal(torture, far_rsp[0].file_off, 0,
+ "unexpected far off");
+ torture_assert_u64_equal(torture, far_rsp[0].len, 4096,
+ "unexpected far len");
+ }
/* zero (hole-punch) the data, _with_ sparse flag */
status = test_ioctl_zdata_req(torture, tmp_ctx, tree, fh,