3231 Commits

Author SHA1 Message Date
rmacklem
b90ab2596f MFC: r286790
For the case where an NFSv4.1 ExchangeID operation has the client identifier
that already has a confirmed ClientID, the nfsrv_setclient() function would
not fill in the clientidp being returned. As such, the value of ClientID
returned would be whatever garbage was on the stack.
This patch fixes the problem by filling in these fields.
2015-08-28 22:42:37 +00:00
rmacklem
fee1840f08 MFC: r286046
This patch fixes a problem where, if the NFSv4 server has a previous
unconfirmed clientid structure for the same client on the last hash list,
this old entry would not be removed/deleted. I do not think this bug would have
caused serious problems, since the new entry would have been before the old one
on the list. This old entry would have eventually been scavenged/removed.
2015-08-01 22:56:42 +00:00
rmacklem
501e413352 MFC: r285113
If a "principal" argument isn't provided for a Kerberized NFS mount,
the kernel would generate a bogus one with a ":/<path>" suffix.
This would only occur for the case where there was no explicit
"principal" argument and the getaddrinfo() call in mount_nfs.c failed to a
return a cannonical name for the server.
This patch fixes this unusual case.
2015-07-31 21:31:58 +00:00
rmacklem
9c93ec1f0b MFC: r285066
Alex Burlyga reported a POLA violation for the new NFS client as
compared to the old NFS client via email to the freebsd-fs@ mailing list.
For the new client, when multiple clients attempted to create a symbolic
link concurrently, more that one client would report success instead of
EEXIST. This was caused by code in the new client that mapped EEXIST to
OK assuming it was caused by a retried RPC request.
Since the old client did not do this, the patch defaults to the old
behaviour and permits the new behaviour to be enabled via a sysctl.
2015-07-27 00:28:51 +00:00
kib
575dc6a9d5 MFC r284594:
Restore the td_cookie value upon detach.
2015-06-26 06:25:14 +00:00
delphij
201165c60b MFC r283889,r283891:
Clear p_stops when doing PT_DETACH and PROCFS_CTL_DETACH.

Without this, if a process was being traced by truss(1), which
uses different p_stops bits than gdb(1), the latter would
misbehave because of the unexpected bits.

Reported by:	jceel
Submitted by:	sef
Sponsored by:	iXsystems, Inc.
2015-06-15 18:16:23 +00:00
rmacklem
f46a7a1d85 MFC: r283753
Make the NFS server use shared vnode locks for a few cases
that are allowed by the VFS/VOP interface instead of using
exclusive locks.
2015-06-12 22:05:04 +00:00
rmacklem
c51db58338 Add TUNABLE_INT() macros so that the tunables MFC'd from
head as r284216 are set via /boot/loader.conf in stable/10.
This is a direct commit to stable/10 because TUNABLE_INT()
is deprecated in head.
2015-06-12 13:42:53 +00:00
rmacklem
953b730dd8 MFC: r283635
Make the size of the hash tables used by the NFSv4 server tunable.
No appreciable change in performance was observed after increasing
the sizes of these tables and then testing with a single client.
However, there was an email that indicated high CPU overheads for
a heavily loaded NFSv4 and it is hoped that increasing the sizes
of the hash tables via these tunables might help.
The tables remain the same size by default.
2015-06-10 12:17:19 +00:00
kib
49520bf551 MFC r283600:
Perform SU cleanup in the AST handler.  Do not sleep waiting for SU cleanup
while owning vnode lock.

On MFC, for KBI stability, td_su member was moved to the end of the
struct thread.
2015-06-10 02:04:02 +00:00
rmacklem
a7dc7c7729 MFC: r283330
The NFS client generated directory block(s) with d_fileno == 0
so that it would not return less data than requested.
Since returning less directory data than requested is not a problem
for FreeBSD and even UFS no longer returns directory structures
with d_fileno == 0, this patch stops the client from doing this.
Although entries with d_fileno == 0 should not be a problem,
the man pages no longer document that these entries should be
ignored, so there was a concern that these entries might be an
issue in the future.
2015-06-06 20:54:41 +00:00
rmacklem
7e70fa5ddf MFC: r283273
The NFS client wasn't handling getdirentries(2) requests for sizes
that are not an exact multiple of DIRBLKSIZ correctly. Fortunately
readdir(3) always uses an exact multiple of DIRBLKSIZ, so few applications
were affected. This patch fixes this problem by reducing the size
of the directory read to an exact multiple of DIRBLKSIZ.
2015-06-04 12:35:00 +00:00
mav
5562aba4db MFC r282881: Do not promote large async writes to sync.
Present implementation of large sync writes is too strict and so can be
quite slow.  Instead of doing that, execute large async write in chunks,
syncing each chunk separately.

It would be good to fix large sync writes too, but I leave it to somebody
with more skills in this area.
2015-05-24 17:16:30 +00:00
trasz
56a7f3d096 MFC r279536:
Make fuse(4) respect FOPEN_DIRECT_IO.  This is required for correct
operation of GlusterFS.

PR:		192701
Submitted by:	harsha at harshavardhana.net
Reviewed by:	kib@
Sponsored by:	The FreeBSD Foundation
2015-05-15 11:03:19 +00:00
rmacklem
ad5b8ec6b4 MFC: r281960
MAXBSIZE defines both the largest UFS block size and the
largest size for a buffer in the buffer cache. This patch
defines a new constant MAXBCACHEBUF, which is the largest
size for a buffer in the buffer cache. Having a separate
constant allows MAXBCACHEBUF to be set larger than MAXBSIZE
on a per-architecture basis, so that NFS can do larger read/writes
for these architectures. It modifies sys/param.h so that BKVASIZE
can also be set on a per-architecture basis.
A couple of cases where NFS used MAXBSIZE instead of NFS_MAXBSIZE
is fixed as well.
2015-05-14 22:50:07 +00:00
mav
f8c0ace4a4 MFC r281738:
Change wcommitsize default from one empirical value to another.

The new value is more predictable with growing RAM size:

        hibufspace maxvnodes      old      new
i386:
  256MB   32980992     15800  2198732  2097152
    2GB   94027776    107677   878764  4194304
amd64:
  256MB   32980992     15800  2198732  2097152
    1GB  114114560     68062  1678155  4194304
    4GB  217055232    111807  1955452  4194304
   16GB 1717846016    337308  5097465 16777216
   64GB 1734918144   1164427  1490479 16777216
  256GB 1734918144   4426453   391983 16777216
2015-05-03 07:16:47 +00:00
rmacklem
cb89ee4fb1 MFC: r281962
Fix the NFS server's handling of a bogus NFSv2 ROOT RPC.
The ROOT RPC is deprecated in the NFSv2 RFC, RFC-1094
and should never be used by a client.
2015-05-02 12:18:28 +00:00
rmacklem
de0424ce26 MFC: r281628
mav@ has found that NFS servers exporting ZFS file systems
can perform better when using a 128K read/write data size.
This patch changes NFS_MAXDATA from 64K to 128K so that
clients can use 128K for NFS mounts to allow this.
The patch also renames NFS_MAXDATA to NFS_SRVMAXIO so
that it is clear that it applies to the NFS server side
only. It also avoids a name conflict with the NFS_MAXDATA
defined in rpcsvc/nfs_prot.h, that is used for userland RPC.
2015-04-30 12:44:20 +00:00
rmacklem
fba63dddeb MFC: r281562
File systems that do not use the buffer cache (such as ZFS) must
use VOP_FSYNC() to perform the NFS server's Commit operation.
This patch adds a mnt_kern_flag called MNTK_USES_BCACHE which
is set by file systems that use the buffer cache. If this flag
is not set, the NFS server always does a VOP_FSYNC().
This should be ok for old file system modules that do not set
MNTK_USES_BCACHE, since calling VOP_FSYNC() is correct, although
it might not be optimal for file systems that use the buffer cache.
2015-04-30 12:39:24 +00:00
pfg
34a6863b39 MFC r281756:
nfsrpc_createv4: fix double free.

Reported by:	Oliver Pinter, clang static checker
Obtained from:	HardenedBSD (63cac77c42c0c3fc67da62f97d5ab651d52ae707)
Reviewed by:	rmacklem
2015-04-24 02:14:01 +00:00
pfg
3d58bff4f8 MFC r281670, r281703:
Drop experimental ext2fs dir_index support.

The htree directory index is a highly desirable feature for research
purposes and was meant to improve performance in our ext2/3 driver.
Unfortunately our implementation has two problems:

- It never really delivered any performance improvement.
- It appears to corrupt the filesystem in undetermined circumstances.

Strictly speaking dir_index is not required for read/write support in
ext2/3 and our limited ext4 support still works fine without it.

Regain stability in the ext2 driver by removing it. We may need it back
(fixed) if we want to support encrypted ext4 support but thanks to the
wonders of version control we can always revert this change and bring it
back.

PR:	191895
PR:	198731
PR:	199309
2015-04-22 00:38:11 +00:00
kib
1d6a22da62 MFC r281121:
Do not call msdosfs_sync() on the read-only msdosfs mounts.

PR:    199152
2015-04-12 07:05:20 +00:00
kib
cf6596d5ab MFC r281120:
Assert that an msdosfs mount is not read-only when FAT modifications
are requested.
2015-04-12 07:03:26 +00:00
rmacklem
3c334aaa55 MFC: r276347
r245508 modified the NFS client's Setattr RPC to
use VA_UTIMES_NULL to indicate whether it should
set the time to the current tod on the server.
This had the side effect of making the NFS client
use the client's timestamp for exclusive create,
starting with FreeBSD9.2.
Unfortunately a bug in some Solaris NFS servers
causes these servers to return NFS_OK to the
Setattr RPC done during exclusive create, but not
actually set the file's mode, leaving the file's
mode == 0.
This patch restores the NFS client's behaviour to
use the server's tod for the exclusive open's
Setattr RPC, to avoid the Solaris server bug and
to restore the pre-FreeBSD9.2 NFS behaviour.
2015-04-10 23:43:01 +00:00
kib
e5886b520a MFC r280308 (by delphij):
Disable timestamping on devfs read/write operations by default.

MFC r280949:
Refine r280308.  Use seconds precision for devfs timestamps by default.
2015-04-08 02:15:13 +00:00
kib
6c211b7cb3 MFC r280342:
msdosfs: mark unused compat-mount fields.
2015-04-05 01:03:11 +00:00
rwatson
6102a34d38 Merge r263233 from HEAD to stable/10:
Update kernel inclusions of capability.h to use capsicum.h instead; some
  further refinement is required as some device drivers intended to be
  portable over FreeBSD versions rely on __FreeBSD_version to decide whether
  to include capability.h.

Sponsored by:	Google, Inc.
2015-03-19 13:37:36 +00:00
kib
7379a65eb4 MFC r279401:
Some fixes for fdescfs lookup code Do not ever return doomed vnode from.
lookup. Reuse the vn_vget_ino_gen() helper to handle parallel unmounts .
2015-03-14 08:42:40 +00:00
trasz
95a939758e MFC r271927:
Turns out -1 is a perfectly valid error number, ERESTART.  Remove useless
code written under assumption that it wasn't.

Sponsored by:	The FreeBSD Foundation
2015-03-07 20:00:26 +00:00
trasz
1fbf58cee9 MFC r274859:
Implement "automount -c".

Sponsored by:	The FreeBSD Foundation
2015-03-07 19:36:06 +00:00
trasz
97710cbe33 MFC r273127:
Make automountd(8) inform autofs(4) whether directory being handled can
have wildcards.  This makes it possible for autofs(4) to avoid requesting
automountd(8) action on access to nonexistent nodes - unless wildcards
are actually used.

Note that this change breaks ABI for automountd(8).

MFC r278521:

Restore ABI compatibility, broken in r273127.  Note that while this fixes
ABI with 10.1, it breaks ABI for 11-CURRENT, so rebuild of automountd(8)
is neccessary.

Sponsored by:	The FreeBSD Foundation
2015-03-07 19:32:19 +00:00
kib
06a96cf2f5 MFC r279362:
The VNASSERT in vflush() FORCECLOSE case is trying to panic early to
prevent errors from yanking devices out from under filesystems.  Only
care about special vnodes on devfs, special nodes on other kinds of
filesystems do not have special properties.
2015-03-06 09:22:05 +00:00
pfg
d9009c4721 MFC r278790, r278802:
Initialize the allocation of variables related to the ext2 allocator.

Use malloc to clear the values and initialize e2fs_contigdirs
during allocation.  free() e2fs_contigdirs upon error.

While here clean up small style issues.
2015-02-22 02:14:49 +00:00
pfg
e68df85091 MFC r278791:
Reuse value of cursize instead of recalculating.

Reported by:	Clang static checker
2015-02-22 01:42:45 +00:00
kib
7ca5c317ae MFC r277828:
Update mtime for tmpfs files modified through memory mapping.

MFC r277969:
Update both ctime and mtime for writes to tmpfs files.

MFC r277972:
Remove single-use boolean.

MFC r278151:
Remove duplicated assignment.
2015-02-11 09:02:21 +00:00
dim
7ddbf9a99c MFC r277953:
Fix a -Wcast-qual warning in smbfs_subr.c, by using __DECONST.  No
functional change.
2015-02-09 07:45:46 +00:00
kib
834093cd48 MFC r278000:
Update directory times immediately after an entry is created or
removed.
2015-02-07 08:42:11 +00:00
hselasky
34369aa374 MFC r277179, r277199 and r277391:
Add a kernel function to delist our kernel character devices, so that
the device name can be re-used right away in case we are destroying
the character devices in the background.
2015-02-05 20:49:13 +00:00
dim
d98d4221ce MFC r277952:
Fix a -Wcast-qual warning in udf_vnops.c, by using __DECONST.  No
functional change.
2015-02-03 08:03:19 +00:00
pfg
c6be6095bb MFC r277354, r277365:
ext2: Garbage-collect some unused variables

Reported by:	clang static analysis
2015-02-02 15:52:11 +00:00
dim
c01327573e MFC r277899:
Fix a bunch of -Wcast-qual warnings in cd9660_util.c, by using
__DECONST.  No functional change.
2015-02-02 07:42:03 +00:00
dim
3541d65302 MFC r277898:
Fix a bunch of -Wcast-qual warnings in msdosfs_conv.c, by using
__DECONST.  No functional change.
2015-02-02 07:37:25 +00:00
jamie
c6bc15d7ab MFC r277855:
Add allow.mount.fdescfs jail flag.

PR:		192951
Submitted by:	ruben@verweg.com
2015-01-31 17:35:53 +00:00
kib
b397ed48ff MFC r277827:
tmpfs does not use UVM on FreeBSD.
2015-01-31 11:04:41 +00:00
pfg
bad15605e4 MFC r277340, r277349:
Remove dead code.
After the ext2 variant of the "orlov allocator" was implemented,
the case for a negative or zero dirsize disappeared.

Drop the dead code and unsign dirsize given that it can't be
negative anyways.

ext2fs: fix for uninitialized pointer read.
path.ep_bp was being used uninitialized in ext4_ext_find_extent().

CID:		1062344
CID:		1008669
2015-01-28 15:36:24 +00:00
kib
b45c95ab3d MFC r277390:
Ignore devfs directory entries for devices being destroyed.
2015-01-26 11:37:16 +00:00
kib
9ddc339f8b MFC r277321:
Make SIGSTOP working for sleeps done while waiting for fifo readers or
writers in open(2), when the fifo is located on an NFS mount.
2015-01-25 13:09:53 +00:00
pfg
ea5c22141a MFC r277301:
ext2: cosmetical issues

Minor sorting and note when the cases are expected to fall through.
2015-01-24 21:23:53 +00:00
kib
511130787f MFC r276007:
Handle MAKEENTRY cnp flag in the VOP_CREATE().
2015-01-04 00:46:06 +00:00
kib
a355201d21 MFC r275897:
Set NOCACHE flag for CREATE namei() calls, do not specially handle
MAKEENTRY in VOP_LOOKUP().
2015-01-01 10:44:20 +00:00