diff options
author | David Disseldorp <ddiss@samba.org> | 2015-02-19 16:09:02 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2015-03-09 21:27:07 +0100 |
commit | f5c472ea47b2b45f8303e62772a21b77644ed5dc (patch) | |
tree | 1744bcefa11b685e20e4c23daa17157e6ce26a9b /source4/torture/smb2/ioctl.c | |
parent | 43e581188ab107e730ef0a232cc406963781bc5d (diff) | |
download | samba-f5c472ea47b2b45f8303e62772a21b77644ed5dc.tar.gz samba-f5c472ea47b2b45f8303e62772a21b77644ed5dc.tar.xz samba-f5c472ea47b2b45f8303e62772a21b77644ed5dc.zip |
torture/ioctl: remove 64K chunk size assumptions
These tests assumed that 4K chunks remain allocated following write at
a subsequent offset. This is not the case for other filesystems (E.g.
XFS, Btrfs, Etc.), which may deallocate the chunk.
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source4/torture/smb2/ioctl.c')
-rw-r--r-- | source4/torture/smb2/ioctl.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/source4/torture/smb2/ioctl.c b/source4/torture/smb2/ioctl.c index d04fb4962e..9e152c727d 100644 --- a/source4/torture/smb2/ioctl.c +++ b/source4/torture/smb2/ioctl.c @@ -3009,7 +3009,11 @@ static bool test_ioctl_sparse_qar(struct torture_context *torture, 4096); /* pattern offset */ torture_assert(torture, ok, "write pattern"); - /* query range before write off, it should be alloced */ + /* + * Query range before write off. Whether it's allocated or not is FS + * dependent. NTFS deallocates chunks in 64K increments, but others + * (e.g. XFS, Btrfs, etc.) may deallocate 4K chunks. + */ status = test_ioctl_qar_req(torture, tmp_ctx, tree, fh, 0, /* off */ 4096, /* len */ @@ -3017,10 +3021,15 @@ static bool test_ioctl_sparse_qar(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, "far offset"); - torture_assert_u64_equal(torture, far_rsp[0].len, 4096, "far len"); + if (far_count == 0) { + torture_comment(torture, "FS deallocated 4K chunk\n"); + } else { + /* expect fully allocated */ + torture_assert_u64_equal(torture, far_count, 1, + "unexpected response len"); + torture_assert_u64_equal(torture, far_rsp[0].file_off, 0, "far offset"); + torture_assert_u64_equal(torture, far_rsp[0].len, 4096, "far len"); + } /* * Query range before and past write, it should be allocated up to the @@ -3035,8 +3044,16 @@ static bool test_ioctl_sparse_qar(struct torture_context *torture, "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, "far offset"); - torture_assert_u64_equal(torture, far_rsp[0].len, 5120, "far len"); + /* FS dependent */ + if (far_rsp[0].file_off == 4096) { + /* 4K chunk unallocated */ + torture_assert_u64_equal(torture, far_rsp[0].file_off, 4096, "far offset"); + torture_assert_u64_equal(torture, far_rsp[0].len, 1024, "far len"); + } else { + /* expect fully allocated */ + torture_assert_u64_equal(torture, far_rsp[0].file_off, 0, "far offset"); + torture_assert_u64_equal(torture, far_rsp[0].len, 5120, "far len"); + } smb2_util_close(tree, fh); talloc_free(tmp_ctx); |