summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2019-09-24 12:14:52 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2019-09-24 12:14:52 +0000
commitabc694265cf5a5c05213271af9cdc13a4b22bdee (patch)
treefcf20767d3e05cff3ef9ccaebe9924e590cbd9a9
parent802c0a5a10c4dafff8d9647562722a5bf0997802 (diff)
parentb97b1727bc40d7d32c5d78e751b231aa5b8778ed (diff)
downloadillumos-joyent-abc694265cf5a5c05213271af9cdc13a4b22bdee.tar.gz
[illumos-gate merge]
commit b97b1727bc40d7d32c5d78e751b231aa5b8778ed 11743 installboot: stage2 partition may be smaller than mboot buffer commit d8d05a42df1fe06e901e8428edbbe802a6e3fc57 11742 installboot: PCFS needs mbr update even if there is X86BOOT partition commit 29de914fcef174393d74135cd19f6920fac954bc 11709 zfs: zio_checksum_table may be accessed past array end commit 20f5f9633a7f7a00734c4c03c7c12016e6935b05 11675 NFSv4 client: Exclusive create should close the file after setattr failure commit 4cfdb4666c89a959e76ef077c99ae7fb542dcf71 11744 zone_sun.tab file must remain sorted
-rw-r--r--usr/src/cmd/boot/installboot/i386/installboot.c20
-rw-r--r--usr/src/data/zoneinfo/README.illumos4
-rw-r--r--usr/src/data/zoneinfo/zone_sun.tab9
-rw-r--r--usr/src/uts/common/fs/nfs/nfs4_vnops.c33
-rw-r--r--usr/src/uts/common/fs/zfs/zio_checksum.c15
5 files changed, 55 insertions, 26 deletions
diff --git a/usr/src/cmd/boot/installboot/i386/installboot.c b/usr/src/cmd/boot/installboot/i386/installboot.c
index fd5430fde6..3ed4e59577 100644
--- a/usr/src/cmd/boot/installboot/i386/installboot.c
+++ b/usr/src/cmd/boot/installboot/i386/installboot.c
@@ -595,6 +595,7 @@ read_stage2_cb(struct partlist *plist)
uint32_t buf_size;
uint32_t mboot_off;
multiboot_header_t *mboot;
+ size_t scan_size;
bblock = calloc(1, sizeof (ib_bootblock_t));
if (bblock == NULL)
@@ -608,8 +609,10 @@ read_stage2_cb(struct partlist *plist)
device = plist->pl_device;
plist->pl_stage = bblock;
offset = device->stage.offset * SECTOR_SIZE;
+ scan_size = MIN(sizeof (mboot_scan),
+ (device->stage.size - device->stage.offset) * sector_size);
- if (read_in(fd, mboot_scan, sizeof (mboot_scan), offset)
+ if (read_in(fd, mboot_scan, scan_size, offset)
!= BC_SUCCESS) {
BOOT_DEBUG("Error reading bootblock area\n");
perror("read");
@@ -618,7 +621,7 @@ read_stage2_cb(struct partlist *plist)
}
/* No multiboot means no chance of knowing bootblock size */
- if (find_multiboot(mboot_scan, sizeof (mboot_scan), &mboot_off)
+ if (find_multiboot(mboot_scan, scan_size, &mboot_off)
!= BC_SUCCESS) {
BOOT_DEBUG("Unable to find multiboot header\n");
(void) close(fd);
@@ -1032,6 +1035,9 @@ probe_fstyp(ib_data_t *data)
data->target.fstype = IB_FS_UFS;
} else if (strcmp(fident, MNTTYPE_PCFS) == 0) {
data->target.fstype = IB_FS_PCFS;
+ /* with pcfs we always write MBR */
+ force_mbr = true;
+ write_mbr = true;
} else {
(void) fprintf(stderr, gettext("File system %s is not "
"supported by loader\n"), fident);
@@ -1142,8 +1148,8 @@ probe_gpt(ib_data_t *data)
data->target.size = vtoc->efi_parts[slice].p_size;
/* Always update PMBR. */
- force_mbr = 1;
- write_mbr = 1;
+ force_mbr = true;
+ write_mbr = true;
/*
* With GPT we can have boot partition and ESP.
@@ -1556,12 +1562,6 @@ probe_mbr(ib_data_t *data)
* partition.
*/
if (i == FD_NUMPART) {
- /* with pcfs we always write MBR */
- if (data->target.fstype == IB_FS_PCFS) {
- force_mbr = true;
- write_mbr = true;
- }
-
pl->pl_devname = strdup(path);
if (pl->pl_devname == NULL) {
perror(gettext("Memory allocation failure"));
diff --git a/usr/src/data/zoneinfo/README.illumos b/usr/src/data/zoneinfo/README.illumos
index 8af2e7fc48..9978e2d96d 100644
--- a/usr/src/data/zoneinfo/README.illumos
+++ b/usr/src/data/zoneinfo/README.illumos
@@ -49,6 +49,10 @@ diff zone.tab.txt' and see what changed and fix zone_sun.tab
appropriately. Usually this means deleting removed entries and adding
new ones.
+********** IMPORTANT **********
+*** zone_sun.tab must remain sorted.
+*** The upstream zone.tab.txt is not always completely in alphabetical order.
+
After that's done, you'll need to go through the more agonizing process of
packaging. To do this, you'll want to look through the differences that have
occurred in zone.tab.txt and backward. The contents of backward describe
diff --git a/usr/src/data/zoneinfo/zone_sun.tab b/usr/src/data/zoneinfo/zone_sun.tab
index 789179f0c6..d5a5691846 100644
--- a/usr/src/data/zoneinfo/zone_sun.tab
+++ b/usr/src/data/zoneinfo/zone_sun.tab
@@ -355,10 +355,6 @@ RO +4426+02606 Europe/Bucharest -
RS +4450+02030 Europe/Belgrade -
RU +5443+02030 Europe/Kaliningrad - MSK-01 - Kaliningrad
RU +554521+0373704 Europe/Moscow - MSK+00 - Moscow area
-# The obsolescent zone.tab format cannot represent Europe/Simferopol well.
-# Put it in RU section and list as UA. See "territorial claims" above.
-# Programs should use zone1970.tab instead; see above.
-UA +4457+03406 Europe/Simferopol - MSK+00 - Crimea
RU +5836+04939 Europe/Kirov - MSK+00 - Kirov
RU +4621+04803 Europe/Astrakhan - MSK+01 - Astrakhan
RU +4844+04425 Europe/Volgograd - MSK+01 - Volgograd
@@ -422,6 +418,11 @@ TV -0831+17913 Pacific/Funafuti -
TW +2503+12130 Asia/Taipei -
TZ -0648+03917 Africa/Dar_es_Salaam -
UA +5026+03031 Europe/Kiev - Ukraine (most areas)
+# The obsolescent zone.tab format cannot represent Europe/Simferopol well.
+# Upstream zoneinfo have put it in RU section but listed it as UA
+# However, libzoneinfo relies on this file being sorted and so we place it in
+# the UA section.
+UA +4457+03406 Europe/Simferopol - MSK+00 - Crimea
UA +4837+02218 Europe/Uzhgorod - Ruthenia
UA +4750+03510 Europe/Zaporozhye - Zaporozh'ye/Zaporizhia; Lugansk/Luhansk (east)
UG +0019+03225 Africa/Kampala -
diff --git a/usr/src/uts/common/fs/nfs/nfs4_vnops.c b/usr/src/uts/common/fs/nfs/nfs4_vnops.c
index 945d37533d..15c6445146 100644
--- a/usr/src/uts/common/fs/nfs/nfs4_vnops.c
+++ b/usr/src/uts/common/fs/nfs/nfs4_vnops.c
@@ -175,7 +175,7 @@ static int nfs4_open_non_reg_file(vnode_t **, int, cred_t *);
static int nfs4_safelock(vnode_t *, const struct flock64 *, cred_t *);
static void nfs4_register_lock_locally(vnode_t *, struct flock64 *, int,
u_offset_t);
-static int nfs4_lockrelease(vnode_t *, int, offset_t, cred_t *);
+static int nfs4_lockrelease(vnode_t *, int, offset_t, cred_t *);
static int nfs4_block_and_wait(clock_t *, rnode4_t *);
static cred_t *state_to_cred(nfs4_open_stream_t *);
static void denied_to_flk(LOCK4denied *, flock64_t *, LOCKT4args *);
@@ -184,7 +184,7 @@ static void nfs4_reinstitute_local_lock_state(vnode_t *, flock64_t *,
cred_t *, nfs4_lock_owner_t *);
static void push_reinstate(vnode_t *, int, flock64_t *, cred_t *,
nfs4_lock_owner_t *);
-static int open_and_get_osp(vnode_t *, cred_t *, nfs4_open_stream_t **);
+static int open_and_get_osp(vnode_t *, cred_t *, nfs4_open_stream_t **);
static void nfs4_delmap_callback(struct as *, void *, uint_t);
static void nfs4_free_delmapcall(nfs4_delmapcall_t *);
static nfs4_delmapcall_t *nfs4_init_delmapcall();
@@ -440,7 +440,7 @@ const fs_operation_def_t nfs4_vnodeops_template[] = {
VOPNAME_SETSECATTR, { .vop_setsecattr = nfs4_setsecattr },
VOPNAME_GETSECATTR, { .vop_getsecattr = nfs4_getsecattr },
VOPNAME_SHRLOCK, { .vop_shrlock = nfs4_shrlock },
- VOPNAME_VNEVENT, { .vop_vnevent = fs_vnevent_support },
+ VOPNAME_VNEVENT, { .vop_vnevent = fs_vnevent_support },
NULL, NULL
};
@@ -1556,6 +1556,8 @@ recov_retry:
e.error = nfs4setattr(vp, in_va, 0, cr, NULL);
if (e.error) {
+ nfs4_error_t err;
+
/*
* Couldn't correct the attributes of
* the newly created file and the
@@ -1567,8 +1569,23 @@ recov_retry:
NFS4_DEBUG(nfs4_client_state_debug, (CE_NOTE,
"nfs4open_otw: EXCLUSIVE4: error %d on SETATTR:"
" remove file", e.error));
+
+ /*
+ * The file is currently open so try to close it first.
+ *
+ * If we do not close the file explicitly here then the
+ * VN_RELE() would do an (implicit and asynchronous)
+ * close for us. But such async close could race with
+ * the nfs4_remove() below. If the async close is
+ * slower than nfs4_remove() then nfs4_remove()
+ * wouldn't remove the file but rename it to .nfsXXXX
+ * instead.
+ */
+ nfs4close_one(vp, NULL, cr, open_flag, NULL, &err,
+ CLOSE_NORM, 0, 0, 0);
VN_RELE(vp);
(void) nfs4_remove(dvp, file_name, cr, NULL, 0);
+
/*
* Since we've reled the vnode and removed
* the file we now need to return the error.
@@ -3102,8 +3119,8 @@ nfs4rdwr_check_osid(vnode_t *vp, nfs4_error_t *ep, cred_t *cr)
nfs4_open_owner_t *oop;
nfs4_open_stream_t *osp;
rnode4_t *rp = VTOR4(vp);
- mntinfo4_t *mi = VTOMI4(vp);
- int reopen_needed;
+ mntinfo4_t *mi = VTOMI4(vp);
+ int reopen_needed;
ASSERT(nfs_zone() == mi->mi_zone);
@@ -12406,8 +12423,8 @@ nfs4_getsecattr(vnode_t *vp, vsecattr_t *vsecattr, int flag, cred_t *cr,
/*
* The function returns:
- * - 0 (zero) if the passed in "acl_mask" is a valid request.
- * - EINVAL if the passed in "acl_mask" is an invalid request.
+ * - 0 (zero) if the passed in "acl_mask" is a valid request.
+ * - EINVAL if the passed in "acl_mask" is an invalid request.
*
* In the case of getting an acl (op == NFS4_ACL_GET) the mask is invalid if:
* - We have a mixture of ACE and ACL requests (e.g. VSA_ACL | VSA_ACE)
@@ -13218,7 +13235,7 @@ nfs4frlock_check_deleg(vnode_t *vp, nfs4_error_t *ep, cred_t *cr, int lt)
open_delegation_type4 dt;
bool_t reopen_needed, force;
nfs4_open_stream_t *osp;
- open_claim_type4 oclaim;
+ open_claim_type4 oclaim;
rnode4_t *rp = VTOR4(vp);
mntinfo4_t *mi = VTOMI4(vp);
diff --git a/usr/src/uts/common/fs/zfs/zio_checksum.c b/usr/src/uts/common/fs/zfs/zio_checksum.c
index d5aa9303b8..85d7e7f4ff 100644
--- a/usr/src/uts/common/fs/zfs/zio_checksum.c
+++ b/usr/src/uts/common/fs/zfs/zio_checksum.c
@@ -316,13 +316,15 @@ zio_checksum_compute(zio_t *zio, enum zio_checksum checksum,
static const uint64_t zec_magic = ZEC_MAGIC;
blkptr_t *bp = zio->io_bp;
uint64_t offset = zio->io_offset;
- zio_checksum_info_t *ci = &zio_checksum_table[checksum];
+ zio_checksum_info_t *ci;
zio_cksum_t cksum, saved;
spa_t *spa = zio->io_spa;
- boolean_t insecure = (ci->ci_flags & ZCHECKSUM_FLAG_DEDUP) == 0;
+ boolean_t insecure;
ASSERT((uint_t)checksum < ZIO_CHECKSUM_FUNCTIONS);
+ ci = &zio_checksum_table[checksum];
ASSERT(ci->ci_func[0] != NULL);
+ insecure = (ci->ci_flags & ZCHECKSUM_FLAG_DEDUP) == 0;
zio_checksum_template_init(checksum, spa);
@@ -386,12 +388,17 @@ zio_checksum_error_impl(spa_t *spa, const blkptr_t *bp,
enum zio_checksum checksum, abd_t *abd, uint64_t size,
uint64_t offset, zio_bad_cksum_t *info)
{
- zio_checksum_info_t *ci = &zio_checksum_table[checksum];
+ zio_checksum_info_t *ci;
zio_cksum_t actual_cksum, expected_cksum;
zio_eck_t eck;
int byteswap;
- if (checksum >= ZIO_CHECKSUM_FUNCTIONS || ci->ci_func[0] == NULL)
+ if (checksum >= ZIO_CHECKSUM_FUNCTIONS)
+ return (SET_ERROR(EINVAL));
+
+ ci = &zio_checksum_table[checksum];
+
+ if (ci->ci_func[0] == NULL)
return (SET_ERROR(EINVAL));
zio_checksum_template_init(checksum, spa);