diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-03-04 12:55:10 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-03-04 12:55:10 +0000 |
commit | d959f82bb4585e1dbd808a8420514ca76a20b9e1 (patch) | |
tree | cb1d2caf8ffe19d053a7f4e9d28b1b28c55dc08b | |
parent | 9a1c2cfb58a9ae7026fac04af4206c2a74566ba9 (diff) | |
parent | 946342a260bbae359b48bf142ec1fe40792ee862 (diff) | |
download | illumos-joyent-d959f82bb4585e1dbd808a8420514ca76a20b9e1.tar.gz |
[illumos-gate merge]
commit 946342a260bbae359b48bf142ec1fe40792ee862
10452 ZoL: merge in large dnode feature fixes
commit 1c802681fb0b5558958cd6f33bf56789a1b0ef29
10474 OS uuid string should not refer to Solaris.
commit 42c5ef032d8316897a2ba9f9ebf4b9c2654ec345
10472 Limit number of multicast NCEs
commit 573f5931ffa70de78fc2317b82e36d6344cf6c3c
10459 libstand: stand.h cstyle cleanup
commit 3ae1c8196586c672e19cabdeaf43e82e5b5dc7f5
10464 loader: biosdisk.c cstyle cleanup
commit f6760972b5c27d37b896ac15627645717ee70ddf
10460 loader: tem.c cstyle cleanup
commit 3733333274b54097fa204d12dc30b5b6066d05bb
10458 libstand: assert.c cstyle cleanup
commit a40552eda738f8ee0c3efd672257d52bfb3e8893
10456 libstand: arp.c cstyle cleanup
commit 736e6700391d17ab1494985a80076fc185722699
10473 zfs(1M) missing cross-reference to zfs-program(1M)
commit 92c1a61163ff6a0655b27bd429856e171e7ce5f5
10468 __ctype_mask[EOF] has been working by accident
10469 GCC's -faggressive-loop-optimizations is too aggressive
10470 array over-read in has_saved_fp()
29 files changed, 424 insertions, 185 deletions
diff --git a/usr/src/boot/lib/libstand/arp.c b/usr/src/boot/lib/libstand/arp.c index 65e421d1bb..4280b90575 100644 --- a/usr/src/boot/lib/libstand/arp.c +++ b/usr/src/boot/lib/libstand/arp.c @@ -51,11 +51,11 @@ #include "net.h" /* Cache stuff */ -#define ARP_NUM 8 /* need at most 3 arp entries */ +#define ARP_NUM 8 /* need at most 3 arp entries */ struct arp_list { struct in_addr addr; - u_char ea[6]; + uchar_t ea[6]; } arp_list[ARP_NUM] = { /* XXX - net order `INADDR_BROADCAST' must be a constant */ { {0xffffffff}, BA } @@ -67,7 +67,7 @@ static ssize_t arpsend(struct iodesc *, void *, size_t); static ssize_t arprecv(struct iodesc *, void **, void **, time_t, void *); /* Broadcast an ARP packet, asking who has addr on interface d */ -u_char * +uchar_t * arpwhohas(struct iodesc *d, struct in_addr addr) { int i; @@ -78,7 +78,7 @@ arpwhohas(struct iodesc *d, struct in_addr addr) struct ether_header eh; struct { struct ether_arp arp; - u_char pad[18]; /* 60 - sizeof(...) */ + uchar_t pad[18]; /* 60 - sizeof (...) */ } data; } wbuf; @@ -94,21 +94,21 @@ arpwhohas(struct iodesc *d, struct in_addr addr) } #ifdef ARP_DEBUG - if (debug) - printf("arpwhohas: send request for %s\n", inet_ntoa(addr)); + if (debug) + printf("arpwhohas: send request for %s\n", inet_ntoa(addr)); #endif - bzero((char*)&wbuf.data, sizeof(wbuf.data)); + bzero((char *)&wbuf.data, sizeof (wbuf.data)); ah = &wbuf.data.arp; ah->arp_hrd = htons(ARPHRD_ETHER); ah->arp_pro = htons(ETHERTYPE_IP); - ah->arp_hln = sizeof(ah->arp_sha); /* hardware address length */ - ah->arp_pln = sizeof(ah->arp_spa); /* protocol address length */ + ah->arp_hln = sizeof (ah->arp_sha); /* hardware address length */ + ah->arp_pln = sizeof (ah->arp_spa); /* protocol address length */ ah->arp_op = htons(ARPOP_REQUEST); MACPY(d->myea, ah->arp_sha); - bcopy(&d->myip, ah->arp_spa, sizeof(ah->arp_spa)); + bcopy(&d->myip, ah->arp_spa, sizeof (ah->arp_spa)); /* Leave zeros in arp_tha */ - bcopy(&addr, ah->arp_tpa, sizeof(ah->arp_tpa)); + bcopy(&addr, ah->arp_tpa, sizeof (ah->arp_tpa)); /* Store ip address in cache (incomplete entry). */ al->addr = addr; @@ -116,16 +116,15 @@ arpwhohas(struct iodesc *d, struct in_addr addr) pkt = NULL; ah = NULL; i = sendrecv(d, - arpsend, &wbuf.data, sizeof(wbuf.data), + arpsend, &wbuf.data, sizeof (wbuf.data), arprecv, &pkt, (void **)&ah, NULL); if (i == -1) { - panic("arp: no response for %s\n", - inet_ntoa(addr)); + panic("arp: no response for %s\n", inet_ntoa(addr)); } /* Store ethernet address in cache */ #ifdef ARP_DEBUG - if (debug) { + if (debug) { struct ether_header *eh; eh = (struct ether_header *)((uintptr_t)pkt + ETHER_ALIGN); @@ -146,7 +145,7 @@ arpsend(struct iodesc *d, void *pkt, size_t len) { #ifdef ARP_DEBUG - if (debug) + if (debug) printf("arpsend: called\n"); #endif @@ -162,18 +161,18 @@ arprecv(struct iodesc *d, void **pkt, void **payload, time_t tleft, void *extra) { ssize_t n; struct ether_arp *ah; - u_int16_t etype; /* host order */ + uint16_t etype; /* host order */ void *ptr; #ifdef ARP_DEBUG - if (debug) + if (debug) printf("arprecv: "); #endif ptr = NULL; n = readether(d, &ptr, (void **)&ah, tleft, &etype); errno = 0; /* XXX */ - if (n == -1 || n < sizeof(struct ether_arp)) { + if (n == -1 || n < sizeof (struct ether_arp)) { #ifdef ARP_DEBUG if (debug) printf("bad len=%d\n", n); @@ -194,9 +193,8 @@ arprecv(struct iodesc *d, void **pkt, void **payload, time_t tleft, void *extra) /* Ethernet address now checked in readether() */ if (ah->arp_hrd != htons(ARPHRD_ETHER) || ah->arp_pro != htons(ETHERTYPE_IP) || - ah->arp_hln != sizeof(ah->arp_sha) || - ah->arp_pln != sizeof(ah->arp_spa) ) - { + ah->arp_hln != sizeof (ah->arp_sha) || + ah->arp_pln != sizeof (ah->arp_spa)) { #ifdef ARP_DEBUG if (debug) printf("bad hrd/pro/hln/pln\n"); @@ -225,9 +223,7 @@ arprecv(struct iodesc *d, void **pkt, void **payload, time_t tleft, void *extra) } /* Is the reply from the source we want? */ - if (bcmp(&arp_list[arp_num].addr, - ah->arp_spa, sizeof(ah->arp_spa))) - { + if (bcmp(&arp_list[arp_num].addr, ah->arp_spa, sizeof (ah->arp_spa))) { #ifdef ARP_DEBUG if (debug) printf("unwanted address\n"); @@ -239,7 +235,7 @@ arprecv(struct iodesc *d, void **pkt, void **payload, time_t tleft, void *extra) /* We have our answer. */ #ifdef ARP_DEBUG - if (debug) + if (debug) printf("got it\n"); #endif *pkt = ptr; @@ -258,9 +254,8 @@ arp_reply(struct iodesc *d, void *pkt) if (arp->arp_hrd != htons(ARPHRD_ETHER) || arp->arp_pro != htons(ETHERTYPE_IP) || - arp->arp_hln != sizeof(arp->arp_sha) || - arp->arp_pln != sizeof(arp->arp_spa) ) - { + arp->arp_hln != sizeof (arp->arp_sha) || + arp->arp_pln != sizeof (arp->arp_spa)) { #ifdef ARP_DEBUG if (debug) printf("arp_reply: bad hrd/pro/hln/pln\n"); @@ -277,7 +272,7 @@ arp_reply(struct iodesc *d, void *pkt) } /* If we are not the target, ignore the request. */ - if (bcmp(arp->arp_tpa, &d->myip, sizeof(arp->arp_tpa))) + if (bcmp(arp->arp_tpa, &d->myip, sizeof (arp->arp_tpa))) return; #ifdef ARP_DEBUG @@ -288,16 +283,16 @@ arp_reply(struct iodesc *d, void *pkt) arp->arp_op = htons(ARPOP_REPLY); /* source becomes target */ - bcopy(arp->arp_sha, arp->arp_tha, sizeof(arp->arp_tha)); - bcopy(arp->arp_spa, arp->arp_tpa, sizeof(arp->arp_tpa)); + bcopy(arp->arp_sha, arp->arp_tha, sizeof (arp->arp_tha)); + bcopy(arp->arp_spa, arp->arp_tpa, sizeof (arp->arp_tpa)); /* here becomes source */ - bcopy(d->myea, arp->arp_sha, sizeof(arp->arp_sha)); - bcopy(&d->myip, arp->arp_spa, sizeof(arp->arp_spa)); + bcopy(d->myea, arp->arp_sha, sizeof (arp->arp_sha)); + bcopy(&d->myip, arp->arp_spa, sizeof (arp->arp_spa)); /* * No need to get fancy here. If the send fails, the * requestor will just ask again. */ - (void) sendether(d, pkt, sizeof(*arp) + 18, - arp->arp_tha, ETHERTYPE_ARP); + (void) sendether(d, pkt, sizeof (*arp) + 18, + arp->arp_tha, ETHERTYPE_ARP); } diff --git a/usr/src/boot/lib/libstand/assert.c b/usr/src/boot/lib/libstand/assert.c index 8eec63a472..bfc1933dea 100644 --- a/usr/src/boot/lib/libstand/assert.c +++ b/usr/src/boot/lib/libstand/assert.c @@ -1,4 +1,4 @@ -/*- +/* * Copyright (c) 1998 Michael Smith. * All rights reserved. * @@ -25,7 +25,6 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); #include <assert.h> diff --git a/usr/src/boot/lib/libstand/stand.h b/usr/src/boot/lib/libstand/stand.h index b2cdcc18e0..1fa3055844 100644 --- a/usr/src/boot/lib/libstand/stand.h +++ b/usr/src/boot/lib/libstand/stand.h @@ -69,11 +69,14 @@ /* this header intentionally exports NULL from <string.h> */ #include <string.h> -#define CHK(fmt, args...) printf("%s(%d): " fmt "\n", __func__, __LINE__ , ##args) -#define PCHK(fmt, args...) {printf("%s(%d): " fmt "\n", __func__, __LINE__ , ##args); getchar();} +#define CHK(fmt, args...) \ + printf("%s(%d): " fmt "\n", __func__, __LINE__, ##args) +#define PCHK(fmt, args...) {\ + printf("%s(%d): " fmt "\n", __func__, __LINE__, ##args); getchar();\ +} /* Avoid unwanted userlandish components */ -#define _KERNEL +#define _KERNEL #include <sys/errno.h> #undef _KERNEL @@ -81,7 +84,7 @@ #define EADAPT (ELAST+1) /* bad adaptor */ #define ECTLR (ELAST+2) /* bad controller */ #define EUNIT (ELAST+3) /* bad unit */ -#define ESLICE (ELAST+4) /* bad slice */ +#define ESLICE (ELAST+4) /* bad slice */ #define EPART (ELAST+5) /* bad partition */ #define ERDLAB (ELAST+6) /* can't read disk label */ #define EUNLAB (ELAST+7) /* unlabeled disk */ @@ -99,16 +102,16 @@ struct open_file; * filesystems that they require. */ struct fs_ops { - const char *fs_name; - int (*fo_open)(const char *path, struct open_file *f); - int (*fo_close)(struct open_file *f); - int (*fo_read)(struct open_file *f, void *buf, - size_t size, size_t *resid); - int (*fo_write)(struct open_file *f, const void *buf, - size_t size, size_t *resid); - off_t (*fo_seek)(struct open_file *f, off_t offset, int where); - int (*fo_stat)(struct open_file *f, struct stat *sb); - int (*fo_readdir)(struct open_file *f, struct dirent *d); + const char *fs_name; + int (*fo_open)(const char *path, struct open_file *f); + int (*fo_close)(struct open_file *f); + int (*fo_read)(struct open_file *f, void *buf, + size_t size, size_t *resid); + int (*fo_write)(struct open_file *f, const void *buf, + size_t size, size_t *resid); + off_t (*fo_seek)(struct open_file *f, off_t offset, int where); + int (*fo_stat)(struct open_file *f, struct stat *sb); + int (*fo_readdir)(struct open_file *f, struct dirent *d); }; /* @@ -135,22 +138,22 @@ extern struct fs_ops pkgfs_fsops; * Device switch */ struct devsw { - const char dv_name[8]; - int dv_type; /* opaque type constant, arch-dependant */ + const char dv_name[8]; + int dv_type; /* opaque type constant, arch-dependant */ #define DEVT_NONE 0 #define DEVT_DISK 1 #define DEVT_NET 2 #define DEVT_CD 3 #define DEVT_ZFS 4 #define DEVT_FD 5 - int (*dv_init)(void); /* early probe call */ - int (*dv_strategy)(void *devdata, int rw, daddr_t blk, + int (*dv_init)(void); /* early probe call */ + int (*dv_strategy)(void *devdata, int rw, daddr_t blk, size_t size, char *buf, size_t *rsize); - int (*dv_open)(struct open_file *f, ...); - int (*dv_close)(struct open_file *f); - int (*dv_ioctl)(struct open_file *f, u_long cmd, void *data); - int (*dv_print)(int verbose); /* print device information */ - void (*dv_cleanup)(void); + int (*dv_open)(struct open_file *f, ...); + int (*dv_close)(struct open_file *f); + int (*dv_ioctl)(struct open_file *f, ulong_t cmd, void *data); + int (*dv_print)(int verbose); /* print device information */ + void (*dv_cleanup)(void); }; /* @@ -166,22 +169,22 @@ extern int errno; * overlap. */ struct devdesc { - struct devsw *d_dev; - int d_unit; - void *d_opendata; + struct devsw *d_dev; + int d_unit; + void *d_opendata; }; struct open_file { - int f_flags; /* see F_* below */ - struct devsw *f_dev; /* pointer to device operations */ - void *f_devdata; /* device specific data */ - struct fs_ops *f_ops; /* pointer to file system operations */ - void *f_fsdata; /* file system specific data */ - off_t f_offset; /* current file offset */ - char *f_rabuf; /* readahead buffer pointer */ - size_t f_ralen; /* valid data in readahead buffer */ - off_t f_raoffset; /* consumer offset in readahead buffer */ -#define SOPEN_RASIZE 512 + int f_flags; /* see F_* below */ + struct devsw *f_dev; /* pointer to device operations */ + void *f_devdata; /* device specific data */ + struct fs_ops *f_ops; /* pointer to file system operations */ + void *f_fsdata; /* file system specific data */ + off_t f_offset; /* current file offset */ + char *f_rabuf; /* readahead buffer pointer */ + size_t f_ralen; /* valid data in readahead buffer */ + off_t f_raoffset; /* consumer offset in readahead buffer */ +#define SOPEN_RASIZE 512 }; #define SOPEN_MAX 64 @@ -198,51 +201,51 @@ extern struct open_file files[]; /* Mode modifier for strategy() */ #define F_NORA (0x01 << 16) /* Disable Read-Ahead */ -#define isascii(c) (((c) & ~0x7F) == 0) +#define isascii(c) (((c) & ~0x7F) == 0) static __inline int isupper(int c) { - return c >= 'A' && c <= 'Z'; + return (c >= 'A' && c <= 'Z'); } static __inline int islower(int c) { - return c >= 'a' && c <= 'z'; + return (c >= 'a' && c <= 'z'); } static __inline int isspace(int c) { - return c == ' ' || (c >= 0x9 && c <= 0xd); + return (c == ' ' || (c >= 0x9 && c <= 0xd)); } static __inline int isdigit(int c) { - return c >= '0' && c <= '9'; + return (c >= '0' && c <= '9'); } static __inline int isxdigit(int c) { - return isdigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); + return (isdigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')); } static __inline int isalpha(int c) { - return isupper(c) || islower(c); + return (isupper(c) || islower(c)); } static __inline int isalnum(int c) { - return isalpha(c) || isdigit(c); + return (isalpha(c) || isdigit(c)); } static __inline int toupper(int c) { - return islower(c) ? c - 'a' + 'A' : c; + return (islower(c) ? c - 'a' + 'A' : c); } static __inline int tolower(int c) { - return isupper(c) ? c - 'A' + 'a' : c; + return (isupper(c) ? c - 'A' + 'a' : c); } /* sbrk emulation */ @@ -252,7 +255,6 @@ extern char *sbrk(int incr); /* Matt Dillon's zalloc/zmalloc */ extern void *malloc(size_t bytes); extern void free(void *ptr); -/*#define free(p) {CHK("free %p", p); free(p);} */ /* use for catching guard violations */ extern void *calloc(size_t n1, size_t n2); extern void *realloc(void *ptr, size_t size); extern void *reallocf(void *ptr, size_t size); @@ -262,34 +264,35 @@ extern int printf(const char *fmt, ...) __printflike(1, 2); extern void vprintf(const char *fmt, __va_list); extern int asprintf(char **buf, const char *cfmt, ...) __printflike(2, 3); extern int sprintf(char *buf, const char *cfmt, ...) __printflike(2, 3); -extern int snprintf(char *buf, size_t size, const char *cfmt, ...) __printflike(3, 4); +extern int snprintf(char *buf, size_t size, const char *cfmt, ...) \ + __printflike(3, 4); extern void vsprintf(char *buf, const char *cfmt, __va_list); extern void vsnprintf(char *buf, size_t size, const char *cfmt, __va_list); -extern void twiddle(u_int callerdiv); -extern void twiddle_divisor(u_int globaldiv); +extern void twiddle(uint_t callerdiv); +extern void twiddle_divisor(uint_t globaldiv); extern void ngets(char *, int); -#define gets(x) ngets((x), 0) +#define gets(x) ngets((x), 0) extern int fgetstr(char *buf, int size, int fd); extern int open(const char *, int); #define O_RDONLY 0x0 -#define O_WRONLY 0x1 -#define O_RDWR 0x2 +#define O_WRONLY 0x1 +#define O_RDWR 0x2 extern int close(int); extern void closeall(void); extern ssize_t read(int, void *, size_t); extern ssize_t write(int, const void *, size_t); extern struct dirent *readdirfd(int); -extern void srandom(u_long seed); -extern u_long random(void); +extern void srandom(ulong_t seed); +extern ulong_t random(void); /* imports from stdlib, locally modified */ extern long strtol(const char *, char **, int); extern unsigned long strtoul(const char *, char **, int); -extern char *optarg; /* getopt(3) external variables */ +extern char *optarg; /* getopt(3) external variables */ extern int optind, opterr, optopt, optreset; extern int getopt(int, char * const [], const char *); @@ -300,13 +303,16 @@ extern int pager_output(const char *lines); extern int pager_file(const char *fname); /* No signal state to preserve */ -#define setjmp _setjmp -#define longjmp _longjmp +#define setjmp _setjmp +#define longjmp _longjmp /* environment.c */ -#define EV_DYNAMIC (1<<0) /* value was dynamically allocated, free if changed/unset */ -#define EV_VOLATILE (1<<1) /* value is volatile, make a copy of it */ -#define EV_NOHOOK (1<<2) /* don't call hook when setting */ +/* value was dynamically allocated, free if changed/unset */ +#define EV_DYNAMIC (1<<0) +/* value is volatile, make a copy of it */ +#define EV_VOLATILE (1<<1) +/* don't call hook when setting */ +#define EV_NOHOOK (1<<2) struct env_var; typedef char *(ev_format_t)(struct env_var *ev); @@ -327,11 +333,11 @@ extern struct env_var *environ; extern struct env_var *env_getenv(const char *name); extern int env_setenv(const char *name, int flags, - const void *value, ev_sethook_t sethook, - ev_unsethook_t unsethook); + const void *value, ev_sethook_t sethook, + ev_unsethook_t unsethook); extern char *getenv(const char *name); extern int setenv(const char *name, const char *value, - int overwrite); + int overwrite); extern int putenv(const char *string); extern int unsetenv(const char *name); @@ -339,8 +345,8 @@ extern ev_sethook_t env_noset; /* refuse set operation */ extern ev_unsethook_t env_nounset; /* refuse unset operation */ /* BCD conversions (undocumented) */ -extern u_char const bcd2bin_data[]; -extern u_char const bin2bcd_data[]; +extern uchar_t const bcd2bin_data[]; +extern uchar_t const bin2bcd_data[]; extern char const hex2ascii_data[]; #define bcd2bin(bcd) (bcd2bin_data[bcd]) @@ -352,40 +358,40 @@ static __inline int imax(int a, int b) { return (a > b ? a : b); } static __inline int imin(int a, int b) { return (a < b ? a : b); } static __inline long lmax(long a, long b) { return (a > b ? a : b); } static __inline long lmin(long a, long b) { return (a < b ? a : b); } -static __inline u_int max(u_int a, u_int b) { return (a > b ? a : b); } -static __inline u_int min(u_int a, u_int b) { return (a < b ? a : b); } +static __inline uint_t max(uint_t a, uint_t b) { return (a > b ? a : b); } +static __inline uint_t min(uint_t a, uint_t b) { return (a < b ? a : b); } static __inline quad_t qmax(quad_t a, quad_t b) { return (a > b ? a : b); } static __inline quad_t qmin(quad_t a, quad_t b) { return (a < b ? a : b); } -static __inline u_long ulmax(u_long a, u_long b) { return (a > b ? a : b); } -static __inline u_long ulmin(u_long a, u_long b) { return (a < b ? a : b); } +static __inline ulong_t ulmax(ulong_t a, ulong_t b) { return (a > b ? a : b); } +static __inline ulong_t ulmin(ulong_t a, ulong_t b) { return (a < b ? a : b); } /* null functions for device/filesystem switches (undocumented) */ extern int nodev(void); -extern int noioctl(struct open_file *, u_long, void *); +extern int noioctl(struct open_file *, ulong_t, void *); extern void nullsys(void); -extern int null_open(const char *path, struct open_file *f); -extern int null_close(struct open_file *f); -extern int null_read(struct open_file *f, void *buf, size_t size, size_t *resid); -extern int null_write(struct open_file *f, const void *buf, size_t size, size_t *resid); -extern off_t null_seek(struct open_file *f, off_t offset, int where); -extern int null_stat(struct open_file *f, struct stat *sb); -extern int null_readdir(struct open_file *f, struct dirent *d); +extern int null_open(const char *, struct open_file *); +extern int null_close(struct open_file *); +extern int null_read(struct open_file *, void *, size_t, size_t *); +extern int null_write(struct open_file *, const void *, size_t, size_t *); +extern off_t null_seek(struct open_file *, off_t, int); +extern int null_stat(struct open_file *, struct stat *); +extern int null_readdir(struct open_file *, struct dirent *); /* * Machine dependent functions and data, must be provided or stubbed by * the consumer */ -extern void exit(int) __dead2; -extern int getchar(void); -extern int ischar(void); -extern void putchar(int); -extern int devopen(struct open_file *, const char *, const char **); -extern int devclose(struct open_file *f); -extern void panic(const char *, ...) __dead2 __printflike(1, 2); -extern void panic_action(void) __weak_symbol __dead2; -extern time_t getsecs(void); +extern void exit(int) __dead2; +extern int getchar(void); +extern int ischar(void); +extern void putchar(int); +extern int devopen(struct open_file *, const char *, const char **); +extern int devclose(struct open_file *f); +extern void panic(const char *, ...) __dead2 __printflike(1, 2); +extern void panic_action(void) __weak_symbol __dead2; +extern time_t getsecs(void); extern struct fs_ops *file_system[]; extern struct fs_ops *exclusive_file_system; extern struct devsw *devsw[]; @@ -415,15 +421,15 @@ void *Realloc(void *, size_t, const char *, int); void Free(void *, const char *, int); #if 1 -#define malloc(x) Malloc(x, __FILE__, __LINE__) -#define calloc(x, y) Calloc(x, y, __FILE__, __LINE__) -#define free(x) Free(x, __FILE__, __LINE__) -#define realloc(x, y) Realloc(x, y, __FILE__, __LINE__) +#define malloc(x) Malloc(x, __FILE__, __LINE__) +#define calloc(x, y) Calloc(x, y, __FILE__, __LINE__) +#define free(x) Free(x, __FILE__, __LINE__) +#define realloc(x, y) Realloc(x, y, __FILE__, __LINE__) #else -#define malloc(x) Malloc(x, NULL, 0) -#define calloc(x, y) Calloc(x, y, NULL, 0) -#define free(x) Free(x, NULL, 0) -#define realloc(x, y) Realloc(x, y, NULL, 0) +#define malloc(x) Malloc(x, NULL, 0) +#define calloc(x, y) Calloc(x, y, NULL, 0) +#define free(x) Free(x, NULL, 0) +#define realloc(x, y) Realloc(x, y, NULL, 0) #endif #endif /* STAND_H */ diff --git a/usr/src/boot/sys/boot/common/tem.c b/usr/src/boot/sys/boot/common/tem.c index 1bff41718e..f06733fb78 100644 --- a/usr/src/boot/sys/boot/common/tem.c +++ b/usr/src/boot/sys/boot/common/tem.c @@ -428,7 +428,7 @@ env_screen_nounset(struct env_var *ev __unused) if (tems.ts_p_dimension.width == 0 && tems.ts_p_dimension.height == 0) return (0); - return(EPERM); + return (EPERM); } static void @@ -516,7 +516,8 @@ tems_setup_terminal(struct vis_devinit *tp, size_t height, size_t width) malloc(font_data->uncompressed_size); if (tems.ts_font.vf_bytes == NULL) panic("out of memory\n"); - (void)lz4_decompress(font_data->compressed_data, + (void) lz4_decompress( + font_data->compressed_data, tems.ts_font.vf_bytes, font_data->compressed_size, font_data->uncompressed_size, 0); @@ -696,9 +697,10 @@ tems_cursor(struct vis_conscursor *pca) static void tem_kdsetmode(int mode) { - if (tems.ts_hdl != NULL) + if (tems.ts_hdl != NULL) { (void) tems.ts_hdl->c_ioctl(tems.ts_hdl, KDSETMODE, - (void *)(intptr_t)mode); + (void *)(intptr_t)mode); + } } static void @@ -2392,7 +2394,7 @@ tem_cls(struct tem_vt_state *tem) bg_color = DEFAULT_ANSI_BACKGROUND; tem_get_color(&fg_color, &bg_color, c); cl.bg_color = bg_color; - (void)tems_cls(&cl); + (void) tems_cls(&cl); tem->tvs_c_cursor.row = 0; tem->tvs_c_cursor.col = 0; diff --git a/usr/src/boot/sys/boot/i386/libi386/biosdisk.c b/usr/src/boot/sys/boot/i386/libi386/biosdisk.c index 608310f97d..b8fea9592a 100644 --- a/usr/src/boot/sys/boot/i386/libi386/biosdisk.c +++ b/usr/src/boot/sys/boot/i386/libi386/biosdisk.c @@ -131,7 +131,7 @@ static int bd_realstrategy(void *devdata, int flag, daddr_t dblk, size_t size, char *buf, size_t *rsize); static int bd_open(struct open_file *f, ...); static int bd_close(struct open_file *f); -static int bd_ioctl(struct open_file *f, u_long cmd, void *data); +static int bd_ioctl(struct open_file *f, ulong_t cmd, void *data); static int bd_print(int verbose); static int cd_print(int verbose); static int fd_print(int verbose); @@ -363,29 +363,29 @@ bc_add(int biosdev) int nbcinfo = 0; if (!STAILQ_EMPTY(&cdinfo)) - return (-1); - - v86.ctl = V86_FLAGS; - v86.addr = 0x13; - v86.eax = 0x4b01; - v86.edx = biosdev; - v86.ds = VTOPSEG(&bc_sp); - v86.esi = VTOPOFF(&bc_sp); - v86int(); - if ((v86.eax & 0xff00) != 0) - return (-1); + return (-1); + + v86.ctl = V86_FLAGS; + v86.addr = 0x13; + v86.eax = 0x4b01; + v86.edx = biosdev; + v86.ds = VTOPSEG(&bc_sp); + v86.esi = VTOPOFF(&bc_sp); + v86int(); + if ((v86.eax & 0xff00) != 0) + return (-1); if ((bd = calloc(1, sizeof (*bd))) == NULL) return (-1); bd->bd_flags = BD_CDROM; - bd->bd_unit = biosdev; + bd->bd_unit = biosdev; /* * Ignore result from bd_int13probe(), we will use local * workaround below. */ - (void)bd_int13probe(bd); + (void) bd_int13probe(bd); if (bd->bd_cyl == 0) { bd->bd_cyl = ((bc_sp.sp_cylsec & 0xc0) << 2) + @@ -403,10 +403,10 @@ bc_add(int biosdev) bd->bd_sectors = 4173824; STAILQ_INSERT_TAIL(&cdinfo, bd, bd_link); - printf("BIOS CD is cd%d\n", nbcinfo); - nbcinfo++; - bcache_add_dev(nbcinfo); /* register cd device in bcache */ - return(0); + printf("BIOS CD is cd%d\n", nbcinfo); + nbcinfo++; + bcache_add_dev(nbcinfo); /* register cd device in bcache */ + return (0); } /* @@ -789,7 +789,7 @@ bd_open(struct open_file *f, ...) return (EIO); } if (bd->bd_bcache == NULL) - bd->bd_bcache = bcache_allocate(); + bd->bd_bcache = bcache_allocate(); if (bd->bd_open == 0) bd->bd_sectors = bd_disk_get_sectors(dev); @@ -824,8 +824,8 @@ bd_close(struct open_file *f) bd->bd_open--; if (bd->bd_open == 0) { - bcache_free(bd->bd_bcache); - bd->bd_bcache = NULL; + bcache_free(bd->bd_bcache); + bd->bd_bcache = NULL; } if (dev->dd.d_dev->dv_type == DEVT_DISK) rc = disk_close(dev); @@ -833,7 +833,7 @@ bd_close(struct open_file *f) } static int -bd_ioctl(struct open_file *f, u_long cmd, void *data) +bd_ioctl(struct open_file *f, ulong_t cmd, void *data) { bdinfo_t *bd; struct disk_devdesc *dev; @@ -1298,7 +1298,7 @@ bd_getdev(struct i386_devdesc *d) * we pass -C to the boot args if we are the boot device. */ major = ACDMAJOR; - unit = 0; /* XXX */ + unit = 0; /* XXX */ } /* XXX a better kludge to set the root disk unit number */ diff --git a/usr/src/lib/libsaveargs/Makefile.com b/usr/src/lib/libsaveargs/Makefile.com index 94d80c1d5b..883afb66c9 100644 --- a/usr/src/lib/libsaveargs/Makefile.com +++ b/usr/src/lib/libsaveargs/Makefile.com @@ -22,7 +22,7 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# Copyright (c) 2018, Joyent, Inc. +# Copyright (c) 2019, Joyent, Inc. # # The build process for libsaveargs is sightly different from that used by other @@ -95,9 +95,6 @@ CFLAGS += $(CFLAGS_$(CURTYPE)) $(CFLAGS_common) CFLAGS64_standalone = $(STAND_FLAGS_64) CFLAGS64 += $(CCVERBOSE) $(CFLAGS64_$(CURTYPE)) $(CFLAGS64_common) -# not linted -SMATCH=off - DYNFLAGS += $(ZINTERPOSE) .KEEP_STATE: diff --git a/usr/src/lib/libsaveargs/amd64/saveargs.c b/usr/src/lib/libsaveargs/amd64/saveargs.c index c8276ddebb..6d3ed769f2 100644 --- a/usr/src/lib/libsaveargs/amd64/saveargs.c +++ b/usr/src/lib/libsaveargs/amd64/saveargs.c @@ -220,7 +220,7 @@ instr_size(dis_handle_t *dhp, uint8_t *ins, unsigned int i, size_t size) static boolean_t has_saved_fp(dis_handle_t *dhp, uint8_t *ins, int size) { - int i, j; + int i, j; uint32_t n; boolean_t found_push = B_FALSE; ssize_t sz = 0; diff --git a/usr/src/man/man1m/zfs.1m b/usr/src/man/man1m/zfs.1m index 104d58a1c2..806cd8c838 100644 --- a/usr/src/man/man1m/zfs.1m +++ b/usr/src/man/man1m/zfs.1m @@ -23,14 +23,13 @@ .\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org> .\" Copyright (c) 2011, 2016 by Delphix. All rights reserved. .\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved. -.\" Copyright (c) 2015, Joyent, Inc. All rights reserved. .\" Copyright (c) 2014 by Adam Stevko. All rights reserved. .\" Copyright (c) 2014 Integros [integros.com] .\" Copyright 2018 Nexenta Systems, Inc. -.\" Copyright 2018 Joyent, Inc. +.\" Copyright 2019 Joyent, Inc. .\" Copyright (c) 2018 Datto Inc. .\" -.Dd Jan 05, 2019 +.Dd February 26, 2019 .Dt ZFS 1M .Os .Sh NAME @@ -3496,6 +3495,7 @@ Channel programs may only be run with root privileges. .sp For full documentation of the ZFS channel program interface, see the manual page for +.Xr zfs-program 1M . .Bl -tag -width "" .It Fl j Display channel program output in JSON format. @@ -3921,6 +3921,7 @@ M F /tank/test/modified .Xr share 1M , .Xr sharemgr 1M , .Xr unshare 1M , +.Xr zfs-program 1M , .Xr zonecfg 1M , .Xr zpool 1M , .Xr chmod 2 , diff --git a/usr/src/pkg/manifests/system-test-zfstest.mf b/usr/src/pkg/manifests/system-test-zfstest.mf index c4d70e7980..3b5b21cd90 100644 --- a/usr/src/pkg/manifests/system-test-zfstest.mf +++ b/usr/src/pkg/manifests/system-test-zfstest.mf @@ -2548,6 +2548,9 @@ file path=opt/zfs-tests/tests/functional/rsend/send-c_volume mode=0555 file path=opt/zfs-tests/tests/functional/rsend/send-c_zstreamdump mode=0555 file path=opt/zfs-tests/tests/functional/rsend/send-cpL_varied_recsize \ mode=0555 +file path=opt/zfs-tests/tests/functional/rsend/send_freeobjects mode=0555 +file path=opt/zfs-tests/tests/functional/rsend/send_realloc_dnode_size \ + mode=0555 file path=opt/zfs-tests/tests/functional/rsend/setup mode=0555 file path=opt/zfs-tests/tests/functional/scrub_mirror/cleanup mode=0555 file path=opt/zfs-tests/tests/functional/scrub_mirror/default.cfg mode=0444 diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/cleanup.ksh b/usr/src/test/zfs-tests/tests/functional/large_dnode/cleanup.ksh index 61caf39100..60e481d998 100755 --- a/usr/src/test/zfs-tests/tests/functional/large_dnode/cleanup.ksh +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/cleanup.ksh @@ -20,6 +20,11 @@ # CDDL HEADER END # +# +# Copyright (c) 2016 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + . $STF_SUITE/include/libtest.shlib default_cleanup diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_001_pos.ksh b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_001_pos.ksh index c07f4e8d74..d3530292e8 100755 --- a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_001_pos.ksh +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_001_pos.ksh @@ -20,6 +20,11 @@ # CDDL HEADER END # +# +# Copyright (c) 2016 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + . $STF_SUITE/include/libtest.shlib # diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_002_pos.ksh b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_002_pos.ksh index 1dd8d888c3..c2b32ad662 100755 --- a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_002_pos.ksh +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_002_pos.ksh @@ -20,6 +20,11 @@ # CDDL HEADER END # +# +# Copyright (c) 2016 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + . $STF_SUITE/include/libtest.shlib # diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_003_pos.ksh b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_003_pos.ksh index a938c7de7c..20989e1d77 100755 --- a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_003_pos.ksh +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_003_pos.ksh @@ -20,6 +20,11 @@ # CDDL HEADER END # +# +# Copyright (c) 2016 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + . $STF_SUITE/include/libtest.shlib verify_runnable "both" diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_004_neg.ksh b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_004_neg.ksh index 1006ae6af5..3fa1cabe06 100755 --- a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_004_neg.ksh +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_004_neg.ksh @@ -21,6 +21,11 @@ # # +# Copyright (c) 2016 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + +# # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_005_pos.ksh b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_005_pos.ksh index 13f1288e4e..a2d92673b1 100755 --- a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_005_pos.ksh +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_005_pos.ksh @@ -20,6 +20,11 @@ # CDDL HEADER END # +# +# Copyright (c) 2016 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + . $STF_SUITE/include/libtest.shlib verify_runnable "both" diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_006_pos.ksh b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_006_pos.ksh index 68fc5e3040..38b4ac52e5 100755 --- a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_006_pos.ksh +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_006_pos.ksh @@ -21,6 +21,11 @@ # # +# Copyright (c) 2016 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + +# # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_007_neg.ksh b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_007_neg.ksh index fb4747839f..59364574b1 100755 --- a/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_007_neg.ksh +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/large_dnode_007_neg.ksh @@ -21,6 +21,11 @@ # # +# Copyright (c) 2016 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + +# # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # diff --git a/usr/src/test/zfs-tests/tests/functional/large_dnode/setup.ksh b/usr/src/test/zfs-tests/tests/functional/large_dnode/setup.ksh index d9b1a6ee85..a9425cca98 100755 --- a/usr/src/test/zfs-tests/tests/functional/large_dnode/setup.ksh +++ b/usr/src/test/zfs-tests/tests/functional/large_dnode/setup.ksh @@ -20,6 +20,11 @@ # CDDL HEADER END # +# +# Copyright (c) 2016 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + . $STF_SUITE/include/libtest.shlib DISK=${DISKS%% *} diff --git a/usr/src/test/zfs-tests/tests/functional/rsend/send_freeobjects.ksh b/usr/src/test/zfs-tests/tests/functional/rsend/send_freeobjects.ksh new file mode 100755 index 0000000000..6533352a9a --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/rsend/send_freeobjects.ksh @@ -0,0 +1,81 @@ +#!/bin/ksh + +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2017 by Lawrence Livermore National Security, LLC. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/rsend/rsend.kshlib + +# +# Description: +# Verify FREEOBJECTS record frees sequential objects (See +# https://github.com/zfsonlinux/zfs/issues/6694) +# +# Strategy: +# 1. Create three files with sequential object numbers, f1 f2 and f3 +# 2. Delete f2 +# 3. Take snapshot A +# 4. Delete f3 +# 5. Take snapshot B +# 6. Receive a full send of A +# 7. Receive an incremental send of B +# 8. Fail test if f3 exists on received snapshot B +# + +verify_runnable "both" + +log_assert "Verify FREEOBJECTS record frees sequential objects" + +sendds=sendfo +recvds=recvfo +f1=/$POOL/$sendds/f1 +f2=/$POOL/$sendds/f2 +f3=/$POOL/$sendds/f3 + +# +# We need to set xattr=sa and dnodesize=legacy to guarantee sequential +# object numbers for this test. Otherwise, if we used directory-based +# xattrs, SELinux extended attributes might consume intervening object +# numbers. +# +log_must zfs create -o xattr=sa -o dnodesize=legacy $POOL/$sendds + +tries=100 +for ((i=0; i<$tries; i++)); do + touch $f1 $f2 $f3 + o1=$(ls -li $f1 | awk '{print $1}') + o2=$(ls -li $f2 | awk '{print $1}') + o3=$(ls -li $f3 | awk '{print $1}') + + if [[ $o2 -ne $(( $o1 + 1 )) ]] || [[ $o3 -ne $(( $o2 + 1 )) ]]; then + rm -f $f1 $f2 $f3 + else + break + fi +done + +if [[ $i -eq $tries ]]; then + log_fail "Failed to create three sequential objects" +fi + +log_must rm $f2 +log_must zfs snap $POOL/$sendds@A +log_must rm $f3 +log_must zfs snap $POOL/$sendds@B +log_must eval "zfs send $POOL/$sendds@A | zfs recv $POOL/$recvds" +log_must eval "zfs send -i $POOL/$sendds@A $POOL/$sendds@B |" \ + "zfs recv $POOL/$recvds" +log_mustnot zdb $POOL/$recvds@B $o3 +log_pass "Verify FREEOBJECTS record frees sequential objects" diff --git a/usr/src/test/zfs-tests/tests/functional/rsend/send_realloc_dnode_size.ksh b/usr/src/test/zfs-tests/tests/functional/rsend/send_realloc_dnode_size.ksh new file mode 100755 index 0000000000..12a72fa092 --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/rsend/send_realloc_dnode_size.ksh @@ -0,0 +1,111 @@ +#!/bin/ksh + +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2017 by Lawrence Livermore National Security, LLC. +# Copyright (c) 2018 Datto Inc. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/rsend/rsend.kshlib + +# +# Description: +# Verify incremental receive properly handles objects with changed +# dnode slot count. +# +# Strategy: +# 1. Populate a dataset with 1k byte dnodes and snapshot +# 2. Remove objects, set dnodesize=legacy, and remount dataset so new objects +# get recycled numbers and formerly "interior" dnode slots get assigned +# to new objects +# 3. Remove objects, set dnodesize=2k, and remount dataset so new objects +# overlap with recently recycled and formerly "normal" dnode slots get +# assigned to new objects +# 4. Create an empty file and add xattrs to it to exercise reclaiming a +# dnode that requires more than 1 slot for its bonus buffer (Zol #7433) +# 5. Generate initial and incremental streams +# 6. Verify initial and incremental streams can be received +# + +verify_runnable "both" + +log_assert "Verify incremental receive handles objects with changed dnode size" + +function cleanup +{ + rm -f $BACKDIR/fs-dn-legacy + rm -f $BACKDIR/fs-dn-1k + rm -f $BACKDIR/fs-dn-2k + rm -f $BACKDIR/fs-attr + + if datasetexists $POOL/fs ; then + log_must zfs destroy -rR $POOL/fs + fi + + if datasetexists $POOL/newfs ; then + log_must zfs destroy -rR $POOL/newfs + fi +} + +log_onexit cleanup + +# 1. Populate a dataset with 1k byte dnodes and snapshot +log_must zfs create -o dnodesize=1k $POOL/fs +log_must mk_files 200 262144 0 $POOL/fs +log_must zfs snapshot $POOL/fs@a + +# 2. Remove objects, set dnodesize=legacy, and remount dataset so new objects +# get recycled numbers and formerly "interior" dnode slots get assigned +# to new objects +rm /$POOL/fs/* + +log_must zfs unmount $POOL/fs +log_must zfs set dnodesize=legacy $POOL/fs +log_must zfs mount $POOL/fs + +log_must mk_files 200 262144 0 $POOL/fs +log_must zfs snapshot $POOL/fs@b + +# 3. Remove objects, set dnodesize=2k, and remount dataset so new objects +# overlap with recently recycled and formerly "normal" dnode slots get +# assigned to new objects +rm /$POOL/fs/* + +log_must zfs unmount $POOL/fs +log_must zfs set dnodesize=2k $POOL/fs +log_must zfs mount $POOL/fs + +log_must touch /$POOL/fs/attrs +mk_files 200 262144 0 $POOL/fs +log_must zfs snapshot $POOL/fs@c + +# 4. Create an empty file and add xattrs to it to exercise reclaiming a +# dnode that requires more than 1 slot for its bonus buffer (Zol #7433) +log_must zfs set compression=on xattr=sa $POOL/fs +log_must eval "python -c 'print \"a\" * 512' | attr -s bigval /$POOL/fs/attrs" +log_must zfs snapshot $POOL/fs@d + +# 5. Generate initial and incremental streams +log_must eval "zfs send $POOL/fs@a > $BACKDIR/fs-dn-1k" +log_must eval "zfs send -i $POOL/fs@a $POOL/fs@b > $BACKDIR/fs-dn-legacy" +log_must eval "zfs send -i $POOL/fs@b $POOL/fs@c > $BACKDIR/fs-dn-2k" +log_must eval "zfs send -i $POOL/fs@c $POOL/fs@d > $BACKDIR/fs-attr" + +# 6. Verify initial and incremental streams can be received +log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs-dn-1k" +log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs-dn-legacy" +log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs-dn-2k" +log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs-attr" + +log_pass "Verify incremental receive handles objects with changed dnode size" diff --git a/usr/src/uts/common/fs/zfs/dmu_object.c b/usr/src/uts/common/fs/zfs/dmu_object.c index 9895cf4776..f835987e7d 100644 --- a/usr/src/uts/common/fs/zfs/dmu_object.c +++ b/usr/src/uts/common/fs/zfs/dmu_object.c @@ -263,7 +263,7 @@ dmu_object_reclaim(objset_t *os, uint64_t object, dmu_object_type_t ot, int blocksize, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx) { return (dmu_object_reclaim_dnsize(os, object, ot, blocksize, bonustype, - bonuslen, 0, tx)); + bonuslen, DNODE_MIN_SIZE, tx)); } int diff --git a/usr/src/uts/common/fs/zfs/dmu_send.c b/usr/src/uts/common/fs/zfs/dmu_send.c index 81de2970b2..f4b181f62a 100644 --- a/usr/src/uts/common/fs/zfs/dmu_send.c +++ b/usr/src/uts/common/fs/zfs/dmu_send.c @@ -2205,11 +2205,13 @@ receive_object(struct receive_writer_arg *rwa, struct drr_object *drro, } else if (drro->drr_type != doi.doi_type || drro->drr_blksz != doi.doi_data_block_size || drro->drr_bonustype != doi.doi_bonus_type || - drro->drr_bonuslen != doi.doi_bonus_size) { + drro->drr_bonuslen != doi.doi_bonus_size || + drro->drr_dn_slots != (doi.doi_dnodesize >> DNODE_SHIFT)) { /* currently allocated, but with different properties */ - err = dmu_object_reclaim(rwa->os, drro->drr_object, + err = dmu_object_reclaim_dnsize(rwa->os, drro->drr_object, drro->drr_type, drro->drr_blksz, - drro->drr_bonustype, drro->drr_bonuslen, tx); + drro->drr_bonustype, drro->drr_bonuslen, + drro->drr_dn_slots << DNODE_SHIFT, tx); } if (err != 0) { dmu_tx_commit(tx); @@ -2259,12 +2261,10 @@ receive_freeobjects(struct receive_writer_arg *rwa, int err; err = dmu_object_info(rwa->os, obj, NULL); - if (err == ENOENT) { - obj++; + if (err == ENOENT) continue; - } else if (err != 0) { + else if (err != 0) return (err); - } err = dmu_free_long_object(rwa->os, obj); if (err != 0) diff --git a/usr/src/uts/common/fs/zfs/dnode.c b/usr/src/uts/common/fs/zfs/dnode.c index 972aebf45c..73b97c2449 100644 --- a/usr/src/uts/common/fs/zfs/dnode.c +++ b/usr/src/uts/common/fs/zfs/dnode.c @@ -683,8 +683,7 @@ dnode_reallocate(dnode_t *dn, dmu_object_type_t ot, int blocksize, ASSERT(DMU_OT_IS_VALID(bonustype)); ASSERT3U(bonuslen, <=, DN_BONUS_SIZE(spa_maxdnodesize(dmu_objset_spa(dn->dn_objset)))); - - dn_slots = dn_slots > 0 ? dn_slots : DNODE_MIN_SLOTS; + ASSERT3U(bonuslen, <=, DN_BONUS_SIZE(dn_slots << DNODE_SHIFT)); dnode_free_interior_slots(dn); DNODE_STAT_BUMP(dnode_reallocate); diff --git a/usr/src/uts/common/inet/ip.h b/usr/src/uts/common/inet/ip.h index 1af5f16587..e9a3fcdeeb 100644 --- a/usr/src/uts/common/inet/ip.h +++ b/usr/src/uts/common/inet/ip.h @@ -22,9 +22,9 @@ /* * Copyright (c) 1990 Mentat Inc. * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2019, Joyent, Inc. All rights reserved. * Copyright 2017 Nexenta Systems, Inc. * Copyright 2017 OmniTI Computer Consulting, Inc. All rights reserved. + * Copyright 2019, Joyent, Inc. */ #ifndef _INET_IP_H diff --git a/usr/src/uts/common/os/dumpsubr.c b/usr/src/uts/common/os/dumpsubr.c index 0eb96464bf..484b2042e2 100644 --- a/usr/src/uts/common/os/dumpsubr.c +++ b/usr/src/uts/common/os/dumpsubr.c @@ -3123,7 +3123,7 @@ dump_set_uuid(const char *uuidstr) (void) strncpy(dump_osimage_uuid, uuidstr, 36 + 1); - cmn_err(CE_CONT, "?This Solaris instance has UUID %s\n", + cmn_err(CE_CONT, "?This illumos instance has UUID %s\n", dump_osimage_uuid); return (0); diff --git a/usr/src/uts/intel/ip/ip.global-objs.debug64 b/usr/src/uts/intel/ip/ip.global-objs.debug64 index b63f4cceee..691b7da537 100644 --- a/usr/src/uts/intel/ip/ip.global-objs.debug64 +++ b/usr/src/uts/intel/ip/ip.global-objs.debug64 @@ -21,7 +21,7 @@ # # Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright 2011 Nexenta Systems, Inc. All rights reserved -# Copyright 2019 Joyent, Inc. +# Copyright 2019 Joyent, Inc. All rights reserved # arp_m_tbl diff --git a/usr/src/uts/intel/ip/ip.global-objs.obj64 b/usr/src/uts/intel/ip/ip.global-objs.obj64 index 198eeea513..624f9984f0 100644 --- a/usr/src/uts/intel/ip/ip.global-objs.obj64 +++ b/usr/src/uts/intel/ip/ip.global-objs.obj64 @@ -21,7 +21,7 @@ # # Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright 2011 Nexenta Systems, Inc. All rights reserved -# Copyright 2019 Joyent, Inc. +# Copyright 2019 Joyent, Inc. All rights reserved # arp_m_tbl diff --git a/usr/src/uts/sparc/ip/ip.global-objs.debug64 b/usr/src/uts/sparc/ip/ip.global-objs.debug64 index b63f4cceee..691b7da537 100644 --- a/usr/src/uts/sparc/ip/ip.global-objs.debug64 +++ b/usr/src/uts/sparc/ip/ip.global-objs.debug64 @@ -21,7 +21,7 @@ # # Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright 2011 Nexenta Systems, Inc. All rights reserved -# Copyright 2019 Joyent, Inc. +# Copyright 2019 Joyent, Inc. All rights reserved # arp_m_tbl diff --git a/usr/src/uts/sparc/ip/ip.global-objs.obj64 b/usr/src/uts/sparc/ip/ip.global-objs.obj64 index 198eeea513..624f9984f0 100644 --- a/usr/src/uts/sparc/ip/ip.global-objs.obj64 +++ b/usr/src/uts/sparc/ip/ip.global-objs.obj64 @@ -21,7 +21,7 @@ # # Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright 2011 Nexenta Systems, Inc. All rights reserved -# Copyright 2019 Joyent, Inc. +# Copyright 2019 Joyent, Inc. All rights reserved # arp_m_tbl |