Commit Graph

3213 Commits

Author SHA1 Message Date
Mateusz Guzik
020b8f17a0 Provide vfs suspension support only for filesystems which need it.
Need is expressed by providing vfs_susp_clean function in vfsops.

Differential Revision:	D952
Reviewed by:	kib (previous version)
MFC after:	2 weeks
2014-10-19 06:59:33 +00:00
Edward Tomasz Napierala
5742494d29 Remove useless debug.
Sponsored by:	The FreeBSD Foundation
2014-10-17 12:06:48 +00:00
Marcelo Araujo
f9246664f5 Make the sysctl(8) for checkutf8 positively defined and improve
the description of it.

Submitted by:	Ronald Klop <ronald-lists@klop.ws>
Reviewed by:	rmacklem
Approved by:	rmacklem
Sponsored by:	QNAP Systems Inc.
2014-10-17 02:11:09 +00:00
Davide Italiano
2be111bf7d Follow up to r225617. In order to maximize the re-usability of kernel code
in userland rename in-kernel getenv()/setenv() to kern_setenv()/kern_getenv().
This fixes a namespace collision with libc symbols.

Submitted by:   kmacy
Tested by:      make universe
2014-10-16 18:04:43 +00:00
Marcelo Araujo
3dd6b7ff3d Add two sysctl(8) to enable/disable NFSv4 server to check when setting
user nobody and/or setting group nogroup as owner of a file or directory.
Usually at the client side, if there is an username that is not in the
client's passwd database, some clients will send 'nobody@<your.dns.domain>'
in the wire and the NFSv4 server will treat it as an ERROR.
However, if you have a valid user nobody in your passwd database,
the NFSv4 server will treat it as a NFSERR_BADOWNER as its believes the
client doesn't has the username mapped.

Submitted by:	Loic Blot <loic.blot@unix-experience.fr>
Reviewed by:	rmacklem
Approved by:	rmacklem
MFC after:	2 weeks
2014-10-16 02:24:19 +00:00
Konstantin Belousov
e511f63a04 Style changes for deadfs:
- ANSIfy VOPs.
- Remove trivial comments.
- Remove ARGSUSED.
- Remove copies of the vop_XXX_args structure definitions in comments.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2014-10-15 13:22:33 +00:00
Konstantin Belousov
f12aa60c62 When vnode bypass cannot be performed on the cdev file descriptor for
read/write/poll/ioctl, call standard vnode filedescriptor fop.  This
restores the special handling for terminals by calling the deadfs VOP,
instead of always returning ENXIO for destroyed devices or revoked
terminals.

Since destroyed (and not revoked) device would use devfs_specops VOP
vector, make dead_read/write/poll non-static and fill VOP table with
pointers to the functions, to instead of VOP_PANIC.

Noted and reviewed by:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2014-10-15 13:16:51 +00:00
Konstantin Belousov
dd0218f2bd Change the deadfs poll VOP to return POLLIN|POLLRDNORM if the caller
is interested in i/o state.  Return POLLNVAL for invalid bits, similar
to poll_no_poll().  Note that POLLOUT must not be returned, since
POLLHUP is set.

Noted and reviewed by:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2014-10-15 13:08:53 +00:00
Edward Tomasz Napierala
4cdc52bdef 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).

Tested by:	dhw@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-15 09:28:45 +00:00
Konstantin Belousov
df5c9c0411 Do not set IN_ACCESS flag for read-only mounts. The IN_ACCESS
survives remount in rw, also it is set for vnodes on rootfs before
noatime can be set or clock is adjusted.  All conditions result in
wrong atime for accessed vnodes.

Submitted by:	bde
MFC after:	1 week
2014-10-11 19:09:56 +00:00
Edward Tomasz Napierala
3e4adf76c4 Add assertion to catch duplicated notes.
Sponsored by:	The FreeBSD Foundation
2014-10-11 05:11:23 +00:00
Edward Tomasz Napierala
1609230854 Remove remnants of some cleanup; no functional changes.
Sponsored by:	The FreeBSD Foundation
2014-10-09 18:49:58 +00:00
Edward Tomasz Napierala
5d28b9ed32 Simplify; no functional changes.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-08 09:44:02 +00:00
Mateusz Guzik
3a222fe000 devfs: tidy up after 272596
This moves a var to an if statement, no functional changes.

MFC after:	1 week
2014-10-06 07:22:48 +00:00
Mateusz Guzik
1d1b55fbba devfs: don't take proctree_lock unconditionally in devfs_close
MFC after:	1 week
2014-10-06 06:20:35 +00:00
Edward Tomasz Napierala
d19c297e5f Make autofs use shared vnode locks.
Reviewed by:	kib
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-04 09:37:40 +00:00
Edward Tomasz Napierala
baf9297e87 Fix autofs debug macros.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-03 10:18:22 +00:00
Edward Tomasz Napierala
2eaebf35d6 Make autofs(4) use shared lock for lookups, instead of exclusive one.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-03 09:58:05 +00:00
Marcelo Araujo
d8a5961f88 Fix failures and warnings reported by newpynfs20090424 test tool.
This fix addresses only issues with the pynfs reports, none of these
issues are know to create problems for extant real clients.

Submitted by:	Bart Hsiao <bart.hsiao@gmail.com>
Reworked by:	myself
Reviewed by:	rmacklem
Approved by:	rmacklem
Sponsored by:	QNAP Systems Inc.
2014-10-03 02:24:41 +00:00
Edward Tomasz Napierala
28a23d3d82 Call uma_zfree() outside of lock, and improve comment.
Sponsored by:	The FreeBSD Foundation
2014-10-02 10:37:56 +00:00
Edward Tomasz Napierala
759489f9e2 Make autofs timeout handling use timeout task instead of callout;
that's because the handler can sleep on sx lock.

Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2014-10-02 10:31:32 +00:00
Edward Tomasz Napierala
5a66f6b3c4 Fix thinko that, with two map entries like shown below, in that order,
made autofs mix them up: the second one wasn't visible in ls(1) output,
and trying to access it would trigger mount for the first one.

foobar		host:/foobar
foo		host:/foo

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2014-09-23 11:27:43 +00:00
John Baldwin
9696feebe2 Add a new fo_fill_kinfo fileops method to add type-specific information to
struct kinfo_file.
- Move the various fill_*_info() methods out of kern_descrip.c and into the
  various file type implementations.
- Rework the support for kinfo_ofile to generate a suitable kinfo_file object
  for each file and then convert that to a kinfo_ofile structure rather than
  keeping a second, different set of code that directly manipulates
  type-specific file information.
- Remove the shm_path() and ksem_info() layering violations.

Differential Revision:	https://reviews.freebsd.org/D775
Reviewed by:	kib, glebius (earlier version)
2014-09-22 16:20:47 +00:00
Edward Tomasz Napierala
31a4b1aa03 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
2014-09-21 10:34:15 +00:00
Edward Tomasz Napierala
787b524980 Fix typos.
Sponsored by:	The FreeBSD Foundation
2014-09-18 10:33:23 +00:00
Konstantin Belousov
d15b55c554 Provide the unique implementation for the VOP_GETPAGES() method used
by ffs and ext2fs.  Remove duplicated call to vm_page_zero_invalid(),
done by VOP and by vm_pager_getpages().  Use vm_pager_free_nonreq().

Reviewed by:	alc (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	6 weeks (after r271596)
2014-09-15 12:28:29 +00:00
Alan Cox
396b3e34b4 Avoid an exclusive acquisition of the object lock on the expected execution
path through the NFS clients' getpages functions.

Introduce vm_pager_free_nonreq().  This function can be used to eliminate
code that is duplicated in many getpages functions.  Also, in contrast to
the code that currently appears in those getpages functions,
vm_pager_free_nonreq() avoids acquiring an exclusive object lock in one
case.

Reviewed by:	kib
MFC after:	6 weeks
Sponsored by:	EMC / Isilon Storage Division
2014-09-14 18:07:55 +00:00
Alan Cox
3e5c84e292 We don't need an exclusive object lock on the expected execution path
through {ext2,ffs}_getpages().

Reviewed by:	kib, pfg
MFC after:	6 weeks
Sponsored by:	EMC / Isilon Storage Division
2014-09-13 18:26:13 +00:00
Pedro F. Giffuni
6e582ca2a5 Extra space from r271467.
MFC after:	2 months
2014-09-12 15:54:18 +00:00
Pedro F. Giffuni
1d0fce9bfe ext2fs: add ext2_getpages().
Literally copy/pasted from ffs_getpages().

Tested with:	fsx
MFC after:	2 months
2014-09-12 15:49:21 +00:00
Gleb Smirnoff
27ad26d8c7 Remove unused arguments for VOP_GETPAGES(), VOP_PUTPAGES(). 2014-09-10 12:36:41 +00:00
Robert Watson
70ac4fa640 Garbage collect NFSMINOFF() from the NFS stack; this unused macro replicates
mbuf-initialisation logic that is best left to centralised mbuf utility
code rather than scattered around the kernel.

MFC after:	3 days
Sponsored by:	EMC / Isilon Storage Division
2014-09-05 17:05:51 +00:00
Edward Tomasz Napierala
7cb570d0ae Fix bug that, assuming a/ is a root of NFS filesystem mounted on autofs,
prevented "mv a/from a/to" from working, while "cd a && mv from to" was ok.

PR:		192948
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2014-08-24 17:03:52 +00:00
Edward Tomasz Napierala
f81018caf2 Autofs softc needs to be global anyway, so don't pass it as a local
variable, and don't store in autofs_mount.  Also rename it from 'sc'
to 'autofs_softc', since it's global and extern.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2014-08-23 11:45:14 +00:00
Edward Tomasz Napierala
a32ba4e63e Add comment explaining one of the quirks in autofs.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2014-08-23 11:38:31 +00:00
Edward Tomasz Napierala
f5440d1a9d Fix includes.
Suggested by:	pluknet@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2014-08-21 15:59:25 +00:00
Edward Tomasz Napierala
925fd94584 Use __FBSDID() properly.
Suggested by:	pluknet@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2014-08-21 15:07:25 +00:00
Edward Tomasz Napierala
2f438a99cd Rework ".." lookup; previous one failed to properly busy the mountpoint.
Reviewed by:	kib@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2014-08-20 13:46:51 +00:00
Edward Tomasz Napierala
3914ddf8a7 Bring in the new automounter, similar to what's provided in most other
UNIX systems, eg. MacOS X and Solaris.  It uses Sun-compatible map format,
has proper kernel support, and LDAP integration.

There are still a few outstanding problems; they will be fixed shortly.

Reviewed by:	allanjude@, emaste@, kib@, wblock@ (earlier versions)
Phabric:	D523
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
2014-08-17 09:44:42 +00:00
Rick Macklem
03738f6076 Change the NFS server's printf related to hitting
the DRC cache's flood level so that it suggests
increasing vfs.nfsd.tcphighwater.

Suggested by:	h.schmalzbauer@omnilan.de
2014-08-10 01:13:32 +00:00
Konstantin Belousov
effc6a3593 VOP_LOOKUP() may relock the directory vnode for some reasons. Since
nullfs vnode shares vnode lock with lower vnode, this allows the
reclamation of nullfs directory vnode in null_lookup().  In this
situation, VOP must return ENOENT.

More, since after the reclamation, the locks of nullfs directory vnode
and lower vnode are no longer shared, the relock of the ldvp does not
restore the correct locking state of dvp, and leaks ldvp lock.
Correct this by unlocking ldvp and locking dvp.

Use cached value of dvp->v_mount.

Reported by:	bdrewery
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2014-08-08 11:39:05 +00:00
Pedro F. Giffuni
7c1be3f5c7 Revert r269523:
Providing a higher EXT2_LINK_MAX limit is a bad idea for ext2/3.

Discussed with:	bde
2014-08-05 01:25:14 +00:00
Pedro F. Giffuni
55806cca37 set EXT2_LINK_MAX to LINK_MAX
In linux EXT4_LINK_MAX is now 64000.  We can't really do that
since i_nlink and va_nlink are signed so setting higher values
is likely to cause trouble.

This is a system limitation so set the EXT_LINK_MAX to
what the system can handle.

MFC after:	3 days
2014-08-04 16:41:06 +00:00
Warner Losh
2296211265 Set the erase block size properly in the case the underlying media
doesn't advertise an erase block size.

Submitted by: bjg@
Pointy hat to: imp@
2014-08-02 05:05:16 +00:00
Warner Losh
d48bcddafe Follow the ufs practice for disallowing permission changes as well as
writes to files for read-only file systems. Since there are already
checks in nandfs_setattr that return an error, this moves detection of
the error earlier.
2014-08-02 05:05:10 +00:00
Warner Losh
b65c3b8fab Fix a minor style(9) issue. 2014-08-02 05:05:05 +00:00
Konstantin Belousov
e7375b6fa5 Do not generate 1000 unique lock names for nfsrc hash chain locks.
It overflows witness.

Shorten the names of some nfs mutexes.

Reported and tested by:	pho
No objections from:	rmacklem, mav
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2014-07-31 19:24:44 +00:00
Konstantin Belousov
0ebe0000b6 Assert that nullfs vnode has VV_ROOT set whenever lower vnode has.
Assert that dotdot lookup on the root vnode is not performed.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2014-07-28 14:20:31 +00:00
Konstantin Belousov
289dd6dd7c Fix typo.
MFC after:	3 days
2014-07-24 23:14:03 +00:00
Warner Losh
1efe717e13 Fix typo in comment: noone -> no one.
Fix minor style(9) nits.
2014-07-23 16:18:51 +00:00