Skip to content

Commit 521ea8d

Browse files
committed
Receiving Solaris11 streams will have 0x20 (spill blocks set) which is
incompatible with us. We will strip this bit and attempt to receive stream anyway, which has a fair chance of succeeding.
1 parent 9703561 commit 521ea8d

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

include/sys/zfs_ioctl.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,23 @@ typedef enum drr_headertype {
8282
#define DMU_BACKUP_FEATURE_DEDUPPROPS (0x2)
8383
#define DMU_BACKUP_FEATURE_SA_SPILL (0x4)
8484

85+
/* Unsure what Oracle called this bit */
86+
#define DMU_BACKUP_FEATURE_SPILLBLOCKS (0x20)
87+
/*
88+
NOTE 3: Fix to 7097870 (spill block can be dropped in some situations during
89+
incremental receive) introduces backward incompatibility with zfs
90+
send/recv. I.e., ZFS streams created with this patch will not be
91+
receivable with older ZFS versions and it will fail with below error
92+
message in destination host:
93+
94+
"cannot receive: stream has unsupported feature, feature flags = 24"
95+
96+
This change is to allow important fix in ZFS to avoid metadata
97+
corruptions related to ACL. An upgrade to same or greater version
98+
of ZFS is required in destination for ZFS streams to work properly.
99+
*/
100+
101+
85102
/*
86103
* Mask of all supported backup features
87104
*/

lib/libzfs/libzfs_sendrecv.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3236,6 +3236,12 @@ zfs_receive_impl(libzfs_handle_t *hdl, const char *tosnap, recvflags_t *flags,
32363236
featureflags = DMU_GET_FEATUREFLAGS(drrb->drr_versioninfo);
32373237
hdrtype = DMU_GET_STREAM_HDRTYPE(drrb->drr_versioninfo);
32383238

3239+
if (featureflags & DMU_BACKUP_FEATURE_SPILLBLOCKS) {
3240+
fprintf(stderr, "Warning: receive stream has Spill Blocks set which may be incompatible with this version.\r\n");
3241+
featureflags &= ~DMU_BACKUP_FEATURE_SPILLBLOCKS;
3242+
}
3243+
3244+
32393245
if (!DMU_STREAM_SUPPORTED(featureflags) ||
32403246
(hdrtype != DMU_SUBSTREAM && hdrtype != DMU_COMPOUNDSTREAM)) {
32413247
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,

lib/libzfs/libzfs_util.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,8 @@ libzfs_init(void)
765765

766766
libzfs_mnttab_init(hdl);
767767

768+
//fprintf(stderr, "make_dataset_handle %p\r\n", hdl->libzfs_log_str);
769+
768770
return (hdl);
769771
}
770772

@@ -1116,6 +1118,8 @@ zfs_ioctl(libzfs_handle_t *hdl, int request, zfs_cmd_t *zc)
11161118
{
11171119
int error;
11181120

1121+
//fprintf(stderr, "zc_history set to %p '%s'\r\n", hdl->libzfs_log_str,
1122+
// hdl->libzfs_log_str);
11191123
zc->zc_history = (uint64_t)(uintptr_t)hdl->libzfs_log_str;
11201124
error = ioctl(hdl->libzfs_fd, request, zc);
11211125

module/zfs/zfs_ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ history_str_get(zfs_cmd_t *zc)
155155
//Darwin requires that the third argument to copyinstr not be NULL.
156156
size_t len = 0;
157157

158-
if (zc->zc_history == 0)
158+
if (zc->zc_history == NULL)
159159
return (NULL);
160160

161161
buf = kmem_alloc(HIS_MAX_RECORD_LEN, KM_SLEEP | KM_NODEBUG);

0 commit comments

Comments
 (0)