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

cloned encrypted zvol does not get create_minor. #99

Open
lundman opened this issue Aug 10, 2021 · 3 comments · Fixed by openzfs/zfs#12471
Open

cloned encrypted zvol does not get create_minor. #99

lundman opened this issue Aug 10, 2021 · 3 comments · Fixed by openzfs/zfs#12471
Labels
bug Something isn't working

Comments

@lundman
Copy link
Contributor

lundman commented Aug 10, 2021

zfs create -V1G -o encryption=on -o keyformat=passphrase BOOM/vol1
zfs snap BOOM/vol1@snap
zfs clone BOOM/vol1@snap BOOM/vol2
zpool export -a
zpool import -l

Only BOOM/vol1 gets a /dev/diskX entry, and BOOM/vol2 does not. Both list keys as available.

This appears related to openzfs/zfs#10603

@lundman lundman added the bug Something isn't working label Aug 10, 2021
@lundman
Copy link
Contributor Author

lundman commented Aug 10, 2021

What appears to happen is;

Pass 1;

zvol_create_minors_recursive()
 - calls dmu_objset_find(DS_FIND_CHILDREN)
 - and calls zvol_create_minors_cb() for BOTH zvols.
 - but since they do not have keys loaded, zvol_create_minors_cb() just returns.

At this point, spa import calls to load the keys, the stack looks like;

  0  99115      zvol_create_minors_cb:entry BOOM/vol1
              zfs`dmu_objset_find_impl+0x389
              zfs`zvol_create_minors_recursive+0x86
              zfs`spa_keystore_load_wkey+0x28a
              zfs`zfs_ioc_load_key+0x8e

Note here, that after the key has been loaded, it directly calls zvol_create_minors_cb() with ONLY BOOM/vol1!
It does not call again for BOOM/vol2 presumably as "now the key have been loaded".

We should possibly change it by;

  • A) Have spa_keystore_load_wkey call zvol_create_minors_recursive on the pool (BOOM) ?
  • B) Have spa_keystore_load_wkey detect and iterate any other children using newly loaded key ?
  • C) Call spa_keystore_load_wkey first, then zvol_create_minors_recursive ?
  • D) Panic

@lundman
Copy link
Contributor Author

lundman commented Aug 10, 2021

zfs_ioc_load_key is just called for BOOM/vol1 and nothing else. and spa_keystore_load_wkey() only deals with that. Even if you call zfs_ioc_load_key for BOOM/vol2 it will not call zvol_create_minors_cb because it will error with EEXIST.

@lundman
Copy link
Contributor Author

lundman commented Aug 10, 2021

This would work:

692d652

<zfs`zvol_create_minors_recursive (zvol.c:1188)> zvol_create_minors_recursive: on 'BOOM/disk1'
<zfs`zvol_add_clones (zvol.c:1084)> adding clone 'BOOM/disk2'
<zfs`zvol_os_create_minor (zvol_os.c:686)> zvol_os_create_minor: 'BOOM/disk1'
<zfs`zvol_os_create_minor (zvol_os.c:686)> zvol_os_create_minor: 'BOOM/disk2'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant