Skip to content

Commit

Permalink
issue openzfs#14223: fix generation of linux kernel uevent for snapsh…
Browse files Browse the repository at this point in the history
…ot rename

`zvol_rename_minors()` needs to be given the full path not just the
snapshot name.  Use code removed in
a0bd735 as a guide to providing the
necessary values.

Closes openzfs#14223

Signed-off-by: James Dingwall <james@dingwall.me.uk>
  • Loading branch information
JKDingwall committed Oct 3, 2024
1 parent 17a2b35 commit 9f207e2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions module/zfs/dsl_dataset.c
Original file line number Diff line number Diff line change
Expand Up @@ -2987,6 +2987,7 @@ dsl_dataset_rename_snapshot_sync_impl(dsl_pool_t *dp,
dsl_dataset_t *ds;
uint64_t val;
dmu_tx_t *tx = ddrsa->ddrsa_tx;
char *oldname, *newname;
int error;

error = dsl_dataset_snap_lookup(hds, ddrsa->ddrsa_oldsnapname, &val);
Expand All @@ -3011,8 +3012,14 @@ dsl_dataset_rename_snapshot_sync_impl(dsl_pool_t *dp,
VERIFY0(zap_add(dp->dp_meta_objset,
dsl_dataset_phys(hds)->ds_snapnames_zapobj,
ds->ds_snapname, 8, 1, &ds->ds_object, tx));
zvol_rename_minors(dp->dp_spa, ddrsa->ddrsa_oldsnapname,
ddrsa->ddrsa_newsnapname, B_TRUE);

oldname = kmem_asprintf("%s@%s", ddrsa->ddrsa_fsname,
ddrsa->ddrsa_oldsnapname);
newname = kmem_asprintf("%s@%s", ddrsa->ddrsa_fsname,
ddrsa->ddrsa_newsnapname);
zvol_rename_minors(dp->dp_spa, oldname, newname, B_TRUE);
kmem_strfree(oldname);
kmem_strfree(newname);

dsl_dataset_rele(ds, FTAG);
return (0);
Expand Down

0 comments on commit 9f207e2

Please sign in to comment.