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

merge 'windows' branch from upstream #34

Merged
merged 633 commits into from
Mar 2, 2022

Conversation

datacore-rm
Copy link

merge 'windows' branch from upstream after the rebase.

nabijaczleweli and others added 30 commits February 1, 2022 16:55
The cast will explode on 32-bit big-endian architectures

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12968
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12968
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12968
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12968
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12968
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12968
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12968
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12968
We won't be passing a negative value here, so make it clear.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12967
De-clutter the clode and make it clear the guid is only used here.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12967
avl_add does avl_find internally, then avl_insert.  We're already doing
the avl_find, so using avl_insert directly avoids repeating the search.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12967
There is no need to allocate a holds nvlist.  lzc_get_holds does that
for us.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12967
* Add a high level comment.
* Use local variables to reduce line wrapping.
* Remove extra braces and insert space for clarity.
* Assert precondition that the dataset name contains '@' for sanity.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12967
* Add a high level comment.
* Move locals closer to point of use.
* Use fnv* routines rather than explicit verification of success.
* Factor out duplicated code by introducing isspacelimit to clarify
  behavior.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12967
* Capitalize and punctuate complete sentences in comments.
* Separate out a group of locals to add a comment on their purpose.
* Remove unnecessary line wrapping.
* Make it clear that dds_origin is a string by using explicit character
  comparison to check for an empty string, rather than implictly
  treating it as a boolean.
* Reorganize manipulation of props and holds nvlists to improve
  clarity.
* There's no need to initialize the snapname buffer with zeros, we're
  immediately overwriting it.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12967
* Reduce indentation.
* Move locals closer to use.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12967
* Don't bother building a debug nvlist if we can't return it.
* Save errno after ioctl failure in case snprintf clobbers it.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12967
In zfs_send_progress, initialize \*bytes_written and \*blocks_visited
in case we have to return early due to ioctl failure.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12967
This makes the header print before the sleep as well, which is fine.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12967
* Add missing dgettext calls.
* Avoid unnecessary line wraps.
* Factor out duplicated parsable check.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12967
* Add a high level comment.
* Avoid unnecessary line wrapping.
* Simplify size accounting logic.
* Eliminate unnecessary buffer on the stack.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12967
* Add high level comments.
* Eliminate unnecessarily void arg.
* Avoid unnecessary line wrapping.
* Initialize sdd fields with the correct types.
* Remove extra whitespace.
* Refactor replication checks for clarity.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12967
* Add a high level comment.
* Eliminate unnecessarily void arg.
* Capitalize and punctuate complete sentences in comments.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12967
* Capitalize and punctuate complete sentences.
* Add a blank line between functions.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12967
Factor out get_bookmarks, find_redact_pair, and get_redact_complete
helper functions to improve the readability of find_redact_book.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12967
Improve the readability of zfs_send_resume_impl by moving resume nvl
decoding into a separate helper function.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12967
* Improve naming.
* Reduce indentation.
* Avoid boilerplate logic duplication.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#12967
Reviewed-by: George Melikov <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Ryan Moeller <[email protected]>
Signed-off-by: Tomohiro Kusumi <[email protected]>
Closes openzfs#13052
Currently, we seem to only care if the results collector errors.
We also should care if the test-runner died.

Authored-by: Rich Ercolani <[email protected]>
Co-authored-by: Rich Ercolani <[email protected]>
Reviewed-by:  Damian Szuberski <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12998
In files created/modified before 4254acb there may be a corruption of
xattrs which is not reported during scrub and normal send/receive. It
manifests only as an error when raw sending/receiving. This happens
because currently only the raw receive path checks for discrepancies
between the dnode bonus length and the spill pointer flag.

In case we encounter a dnode whose bonus length is greater than the
predicted one, we should report an error. Modify in this regard
dnode_sync() with an assertion at the end, dump_dnode() to error out,
dsl_scan_recurse() to report errors during a scrub, and zstream to
report a warning when dumping. Also added a test to verify spill blocks
are sent correctly in a raw send.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: George Amanakis <[email protected]>
Closes openzfs#12720 
Closes openzfs#13014
datacore-skumar and others added 29 commits February 16, 2022 16:19
IRP->FSCTL_DELETE_REPARSE_POINT->delete_reparse_point():
- remove flag ~ZFS_REPARSE
- remove SA_ZPL_SYMLINK
- set z_size = 0 (directories means number of entries)

Also fix
set_reparse_point()

zfs_find_dvp_vp():
- test for FILE_OPEN_REPARSE_POINT to open reparse point itself

zfs_windows_unmount():
- Call
DeleteReparsePoint()->ZwFsControlFile(FSCTL_DELETE_REPARSE_POINT):
- Remove directory

Will this be a problem on non-junction mounts, ie, driveletters?
Should we test for that?
appears to make remounting work, now that delete reparse point is
implemented.
Most easily demonstrated by running:
 # zpool create -f TEST PHYSICALDRIVE1
 # zpool create -f TEST2 PHYSICALDRIVE1

This fixes the panic, but not the root cause of it. It comes down to
kstat namespace collision. The second zpool create will call

	#rocfs_kstat =  kstat_create(module, 0, name, submodule,
	procfs_kstat =  kstat_create("zfs", 0, "txgs", "TEST2",
	    KSTAT_TYPE_RAW, 0, KSTAT_FLAG_VIRTUAL);

But kstat checks if it already exists using:

	/*
	 * If the named kstat already exists and is dormant, reactivate it.
	 */
	ksp = kstat_hold_byname(ks_module, ks_instance, ks_name, ks_zoneid);

Ie, it does not use `submodule` (TEST2) when it comes to looking for
existence, and returns namespace collision error.
We are in fact missing quite a few kstat, when using multiple
pools.

This will correct the "releasing of kstat that was never init"
panic, until kstat can be updated to handle submodule name.
as a unique identifier when passed
module=zfs, submodule=tank
as submodule (ks_class) is not used for identifying unique
kstat entries. Instead, if given both, we change module to be
"zfs/tank" as other locations do.

However, these proclist kstats do not show. We should see
"reads" "txgs" and "multihost", and yet they are not in the
output produced by kstat.exe.  Investigate.
Turns out you have to tell CMake to pay attention to
.S files, and tell it to use clang-cl.exe for them.

Had to take out a few .S files as they now need tweaking,
focusing on one issue at a time.

Setup setjmp to compile in. This enables lua to actually
execute scripts.

However, it managed to corrupt the runtime data, from which
we get spa and pool.
Due to differences in x64 calling conventions, setjmp
needed to be modified to save 2 more registers, and
first argument is passed in rcx.

This enables lua to run (and destroy snapshots).
For some reason upstream decided to stop using the common
random() calls, and put in a static function. As it is just
for salt, it does not need to be especially strong.
Windows has to create reparse point internally.
It would clear init=0 before checking against the MAGIC to
know if it should pull the trigger on the timer, causing
armed timers to exist after unload.
Make minimal effort to ensure that vnodes have been released
at unload time. Due to missing knowledge on how to release
fileobjects in windows, this code is a bit hit and miss.
This allows filebased pools to be created with backslashes.
When a query buffer is too small, we would reply with the
exact size required. Then reject the following query when it
was precisely that size.
(Turns out Windows does not error-check the 2nd call)

This fixes creating datasets with long names.
This would suggest a bug in the phtread.h - unsure if the
source has fixed it or not.
This does break kstats, until they are updated to use
the ZFS MODULE PARAMETER instead, similar to macOS.
Restore missing tunable, until it can be fixed in earlier
commits
Upstream PR exists, until it lands..
Until a proper locking solution is found, see macOS
@datacore-rm datacore-rm merged commit 7320ea5 into DataCoreSoftware:windows Mar 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.