summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2016-01-27 12:48:13 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2016-01-27 12:48:13 +0000
commit6e89866828960b0f25e40fc055109065ed78fd76 (patch)
tree9ae5e2925a79765a2294bbc5f7b8ba2d539fac08
parente68ccfb74156a9876622c4e7a0f3d021f0496305 (diff)
parentcc641e8dc4d38800076a2260f4d959bf86003257 (diff)
downloadillumos-joyent-6e89866828960b0f25e40fc055109065ed78fd76.tar.gz
[illumos-gate merge]
commit cc641e8dc4d38800076a2260f4d959bf86003257 6579 installgrub efi_alloc_and_read() return value check is faulty commit a38ee58261c5aa81028a4329e73da4016006aa99 6572 clinfo(1M): Typo in the error message commit 3a36268e678711ec7f0ae522d7ef460e51186768 6554 Deadlock between rfs4_do_lock() and rfs4_op_read()
-rw-r--r--usr/src/cmd/boot/installgrub/installgrub.c5
-rw-r--r--usr/src/cmd/clinfo/clinfo.c13
-rw-r--r--usr/src/uts/common/fs/nfs/nfs4_srv.c45
3 files changed, 44 insertions, 19 deletions
diff --git a/usr/src/cmd/boot/installgrub/installgrub.c b/usr/src/cmd/boot/installgrub/installgrub.c
index 0ae6749bcc..b01bcbd922 100644
--- a/usr/src/cmd/boot/installgrub/installgrub.c
+++ b/usr/src/cmd/boot/installgrub/installgrub.c
@@ -22,6 +22,7 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012 Milan Jurik. All rights reserved.
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2016 Toomas Soome <tsoome@me.com>
*/
#include <stdio.h>
@@ -670,7 +671,7 @@ init_device(ig_device_t *device, char *path)
return (BC_ERROR);
}
- if (efi_alloc_and_read(device->disk_fd, &vtoc) > 0) {
+ if (efi_alloc_and_read(device->disk_fd, &vtoc) >= 0) {
device->type = IG_DEV_EFI;
efi_free(vtoc);
}
@@ -737,7 +738,7 @@ get_start_sector(ig_device_t *device)
if (is_efi(device->type)) {
struct dk_gpt *vtoc;
- if (efi_alloc_and_read(device->disk_fd, &vtoc) <= 0)
+ if (efi_alloc_and_read(device->disk_fd, &vtoc) < 0)
return (BC_ERROR);
device->start_sector = vtoc->efi_parts[device->slice].p_start;
diff --git a/usr/src/cmd/clinfo/clinfo.c b/usr/src/cmd/clinfo/clinfo.c
index b4fbd09d28..c806ad99f7 100644
--- a/usr/src/cmd/clinfo/clinfo.c
+++ b/usr/src/cmd/clinfo/clinfo.c
@@ -19,13 +19,16 @@
*
* CDDL HEADER END
*/
+
+/*
+ * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
+ */
+
/*
* Copyright (c) 1998 by Sun Microsystems, Inc.
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
@@ -68,8 +71,8 @@ main(int argc, char **argv)
case 'n': /* print our node number */
if (_cladm(CL_CONFIG, CL_NODEID, &nid) != 0) {
- errmsg("node is not configured as part of a"
- "cluster");
+ errmsg("node is not configured as part of a "
+ "cluster");
return (1);
}
(void) printf("%s%u\n", cp, nid);
@@ -78,7 +81,7 @@ main(int argc, char **argv)
case 'h': /* print the highest node number */
if (_cladm(CL_CONFIG, CL_HIGHEST_NODEID, &hid) != 0) {
errmsg("node is not booted as part of a "
- "cluster");
+ "cluster");
return (1);
}
(void) printf("%s%u\n", cp, hid);
diff --git a/usr/src/uts/common/fs/nfs/nfs4_srv.c b/usr/src/uts/common/fs/nfs/nfs4_srv.c
index cd2151e9ac..efbd3f54f0 100644
--- a/usr/src/uts/common/fs/nfs/nfs4_srv.c
+++ b/usr/src/uts/common/fs/nfs/nfs4_srv.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
@@ -876,7 +876,7 @@ nullfree(caddr_t resop)
/* ARGSUSED */
static void
rfs4_op_inval(nfs_argop4 *argop, nfs_resop4 *resop, struct svc_req *req,
- struct compound_state *cs)
+ struct compound_state *cs)
{
*cs->statusp = *((nfsstat4 *)&(resop)->nfs_resop4_u) = NFS4ERR_INVAL;
}
@@ -3220,12 +3220,6 @@ rfs4_op_read(nfs_argop4 *argop, nfs_resop4 *resop, struct svc_req *req,
}
}
- if ((stat = rfs4_check_stateid(FREAD, vp, &args->stateid, FALSE,
- deleg, TRUE, &ct)) != NFS4_OK) {
- *cs->statusp = resp->status = stat;
- goto out;
- }
-
if (args->wlist) {
if (args->count > clist_len(args->wlist)) {
*cs->statusp = resp->status = NFS4ERR_INVAL;
@@ -8811,6 +8805,7 @@ rfs4_do_lock(rfs4_lo_state_t *lsp, nfs_lock_type4 locktype,
int error;
sysid_t sysid;
LOCK4res *lres;
+ vnode_t *vp;
if (rfs4_lease_expired(lo->rl_client)) {
return (NFS4ERR_EXPIRED);
@@ -8827,7 +8822,7 @@ rfs4_do_lock(rfs4_lo_state_t *lsp, nfs_lock_type4 locktype,
retry:
rfs4_dbe_lock(sp->rs_dbe);
- if (sp->rs_closed) {
+ if (sp->rs_closed == TRUE) {
rfs4_dbe_unlock(sp->rs_dbe);
return (NFS4ERR_OLD_STATEID);
}
@@ -8877,15 +8872,41 @@ retry:
*/
flag = (int)sp->rs_share_access | F_REMOTELOCK;
- error = setlock(sp->rs_finfo->rf_vp, &flock, flag, cred);
+ vp = sp->rs_finfo->rf_vp;
+ VN_HOLD(vp);
+
+ /*
+ * We need to unlock sp before we call the underlying filesystem to
+ * acquire the file lock.
+ */
+ rfs4_dbe_unlock(sp->rs_dbe);
+
+ error = setlock(vp, &flock, flag, cred);
+
+ /*
+ * Make sure the file is still open. In a case the file was closed in
+ * the meantime, clean the lock we acquired using the setlock() call
+ * above, and return the appropriate error.
+ */
+ rfs4_dbe_lock(sp->rs_dbe);
+ if (sp->rs_closed == TRUE) {
+ cleanlocks(vp, lsp->rls_locker->rl_pid, sysid);
+ rfs4_dbe_unlock(sp->rs_dbe);
+
+ VN_RELE(vp);
+
+ return (NFS4ERR_OLD_STATEID);
+ }
+ rfs4_dbe_unlock(sp->rs_dbe);
+
+ VN_RELE(vp);
+
if (error == 0) {
rfs4_dbe_lock(lsp->rls_dbe);
next_stateid(&lsp->rls_lockid);
rfs4_dbe_unlock(lsp->rls_dbe);
}
- rfs4_dbe_unlock(sp->rs_dbe);
-
/*
* N.B. We map error values to nfsv4 errors. This is differrent
* than puterrno4 routine.