diff options
Diffstat (limited to 'usr/src/uts/common/os/fio.c')
-rw-r--r-- | usr/src/uts/common/os/fio.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/usr/src/uts/common/os/fio.c b/usr/src/uts/common/os/fio.c index 6dc0d00011..bfee77130d 100644 --- a/usr/src/uts/common/os/fio.c +++ b/usr/src/uts/common/os/fio.c @@ -21,7 +21,7 @@ /* * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, Joyent Inc. All rights reserved. + * Copyright 2015, Joyent Inc. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -40,6 +40,7 @@ #include <sys/vnode.h> #include <sys/pathname.h> #include <sys/file.h> +#include <sys/flock.h> #include <sys/proc.h> #include <sys/var.h> #include <sys/cpuvar.h> @@ -851,7 +852,8 @@ flist_fork(uf_info_t *pfip, uf_info_t *cfip) */ cfip->fi_nfiles = nfiles = flist_minsize(pfip); - cfip->fi_list = kmem_zalloc(nfiles * sizeof (uf_entry_t), KM_SLEEP); + cfip->fi_list = nfiles == 0 ? NULL : + kmem_zalloc(nfiles * sizeof (uf_entry_t), KM_SLEEP); for (fd = 0, pufp = pfip->fi_list, cufp = cfip->fi_list; fd < nfiles; fd++, pufp++, cufp++) { @@ -952,6 +954,8 @@ closef(file_t *fp) return (error); } ASSERT(fp->f_count == 0); + /* Last reference, remove any OFD style lock for the file_t */ + ofdcleanlock(fp); mutex_exit(&fp->f_tlock); /* @@ -1209,7 +1213,8 @@ f_getfl(int fd, int *flagp) error = EBADF; else { vnode_t *vp = fp->f_vnode; - int flag = fp->f_flag | (fp->f_flag2 << 16); + int flag = fp->f_flag | + ((fp->f_flag2 & ~FEPOLLED) << 16); /* * BSD fcntl() FASYNC compatibility. |