Commit Graph

1826 Commits

Author SHA1 Message Date
maxv
9cd5bec30f Remove unused mbuf.h includes. 2018-12-10 14:46:24 +00:00
manu
0f1e9886f4 Fix use after RECLAIM in PUFFS filesystems
From hannken@

When puffs_cookie2vnode() misses an entry and vrele() it operations
puffs_vnop_reclaim() and puffs_vnop_fsync() get called with a VNON
vnode.

Do not notify the server in this case as the cookie is stale.
2018-11-06 02:39:49 +00:00
manu
031ff5c667 Add missing mutex pn->pn_sizemtx lock in puffs_vnop_open()
puffs_vnop_open() calls flushvncache(), which calls dosetattr()
if pn->pn_stat has PNODE_METACACHE_MASK. In that case, the lock
on pn->pn_sizemtx is mandatory and asserted.
2018-11-05 02:28:32 +00:00
jdolecek
bcc384fdef remove M_CANFAIL flag for malloc(9) - it was completely ignored, so had
actually no effect
2018-10-14 17:37:40 +00:00
riastradh
d1579b2d70 Rename min/max -> uimin/uimax for better honesty.
These functions are defined on unsigned int.  The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER!  Some subsystems have

	#define min(a, b)	((a) < (b) ? (a) : (b))
	#define max(a, b)	((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX.  Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate.  But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all.  (Who knows, maybe in some cases integer
truncation is actually intended!)
2018-09-03 16:29:22 +00:00
msaitoh
61e1eb0d0b - Cleanup for dynamic sysctl:
- Remove unused *_NAMES macros for sysctl.
  - Remove unused *_MAXID for sysctls.
- Move CTL_MACHDEP sysctl definitions for m68k into m68k/include/cpu.h and
  use them on all m68k machines.
2018-08-22 01:05:21 +00:00
reinoud
58853ff72b Fix length calculation 2018-08-09 20:30:26 +00:00
reinoud
e44c6c6eea Sync with UDFclient 2018-08-09 13:49:30 +00:00
christos
ef24a84407 FIx performance regression from rmind@:
Just from a very quick look, it seems like a regression introduced with
the vcache changes: the MP-safe flag is set too late and not inherited
by the root vnode.
2018-08-09 08:43:56 +00:00
kamil
417e06a66d Avoid undefined behavior semantics in msdosfs_fat.c
Do not change signedness bit with left shift.
While there avoid signed integer overflow.
Address both issues with using unsigned type.

msdosfs_fat.c:512:42, left shift of 1 by 31 places cannot be represented in type 'int'
msdosfs_fat.c:521:44, left shift of 1 by 31 places cannot be represented in type 'int'
msdosfs_fat.c:744:14, left shift of 1 by 31 places cannot be represented in type 'int'
msdosfs_fat.c:744:24, signed integer overflow: -2147483648 - 1 cannot be represented in type 'int [20]'
msdosfs_fat.c:840:13, left shift of 1 by 31 places cannot be represented in type 'int'
msdosfs_fat.c:840:36, signed integer overflow: -2147483648 - 1 cannot be represented in type 'int [20]'

Detected with micro-UBSan in the user mode.
2018-07-25 22:07:59 +00:00
kamil
982dbcfaff Avoid undefined behavior in ecma167-udf.h
Define the UDF_EXT_* symbols as unsigned values.
This prevents undefined behavior of altering the signedness bit in a part
of them. Swap the remaining symbols to unsigned values to keep the
consistency.

Required by GCC when building with Undefined Behavior Sanitizer.
2018-07-25 19:56:56 +00:00
reinoud
5ed53e53ea Enhance logical volume integrity descriptor handling and provide
bug-compatibility for Linux mkudffs 1.3 images.
2018-07-25 11:09:22 +00:00
maya
a50c06709e Remove duplicate ; 2018-06-06 01:49:07 +00:00
chs
e406c140eb add a genfs method to allow a file system to limit the range of pages
that are given to a single GOP_WRITE() call.  needed by ZFS.
2018-05-28 21:04:37 +00:00
chs
0656708806 allow tmpfs files to be larger than 4GB. 2018-05-28 21:04:35 +00:00
maxv
3c78537229 Fix inverted arguments in MGET(). 2018-04-26 19:27:04 +00:00
christos
87fd18f8e5 s/static inline/static __inline/g for consistency. 2018-04-19 21:50:06 +00:00
dholland
32cded6cc9 Typos. 2018-02-08 09:05:16 +00:00
maxv
9c3b74aee7 Remove unused (and a reference to ovbcopy along the way). 2018-02-01 17:22:45 +00:00
christos
05b75fe4b1 CID-1428639: make sure we always initialiaze hash, because if ultimately
the file is not found and we end up looping we need them.
2018-01-28 15:48:44 +00:00
sevan
87ebd86e7f Need strings.h for ffs()
Resolves implict declaration warning of ffs() when building tools via build.sh
2018-01-27 03:54:01 +00:00
christos
87d09387b3 support getargs, fix flush, fix mutex_destroy 2018-01-14 22:43:18 +00:00
christos
36038078db prevent assert on unmount. 2018-01-13 22:06:21 +00:00
christos
0d40f5669e fix module attachment and cdevsw 2018-01-09 16:19:39 +00:00
martin
602913a78d Include <sys/atomic.h> for the atomic funtions used in here. 2018-01-09 13:56:00 +00:00
christos
b985414b8f Merge autofs support from: Tomohiro Kusumi
XXX: Does not work yet
2018-01-09 03:31:12 +00:00
mlelstv
d8f0582ef8 relax sanity check. It's ok to have more FAT sectors than needed. 2017-11-27 15:02:05 +00:00
maya
18b796d442 Use C99 initializer for filterops
Mostly done with spatch with touchups for indentation

@@
expression a;
identifier b,c,d;
identifier p;
@@
const struct filterops p =
- 	{ a, b, c, d
+ 	{
+ 	.f_isfd = a,
+ 	.f_attach = b,
+ 	.f_detach = c,
+ 	.f_event = d,
};
2017-10-25 08:12:37 +00:00
skrll
b240eba556 Remove some unnecessary duplicatioN 2017-08-27 06:18:16 +00:00
mlelstv
5815ca8f4d Add more sanity checks for BPB parameters. Handle FAT12 format for media
with sectors >= 32kByte.

Does fix PR 52485.
2017-08-20 11:48:15 +00:00
hannken
76aa2ae1d5 Make union_newlower() ans union_newupper() local to union_subr.c,
expand and remove union_updatevp() and take care to transfer the
vnode lock from the union vnode to its new upper vnode without
breaking the fstrans state.

Add assertions that un_lowervp and un_uppervp never change from
non-NULL to non-NULL.
2017-07-17 09:22:36 +00:00
hannken
5985f10515 No need to call vflush from failing udf_mount(). If the system nodes
really have to disappear we should change vrele() to vrecycle() here.
2017-06-24 12:13:16 +00:00
chs
fd34ea77eb remove checks for failure after memory allocation calls that cannot fail:
kmem_alloc() with KM_SLEEP
  kmem_zalloc() with KM_SLEEP
  percpu_alloc()
  pserialize_create()
  psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
2017-06-01 02:45:05 +00:00
hannken
5dc331fb8e When a vnode has an invalid type because the type changed on the
server replace vgone() with new operation smbfs_uncache() that
removes the vnode from the name cache and changes the vcache key
to an unique and illegal key to prevent further lookups.
2017-05-28 16:36:37 +00:00
riastradh
93562e3f53 Eliminate crusty debugging sludge.
We have a mostly sane vnode lifecycle now.  If this needs debugging,
it should be done once at the call site of VOP_RECLAIM.
2017-05-26 14:34:19 +00:00
riastradh
7f7aad09bd Make VOP_RECLAIM do the last unlock of the vnode.
VOP_RECLAIM naturally has exclusive access to the vnode, so having it
locked on entry is not strictly necessary -- but it means if there
are any final operations that must be done on the vnode, such as
ffs_update, requiring exclusive access to it, we can now kassert that
the vnode is locked in those operations.

We can't just have the caller release the last lock because some file
systems don't use genfs_lock, and require the vnode to remain valid
for VOP_UNLOCK to work, notably unionfs.
2017-05-26 14:20:59 +00:00
hannken
3194ba799d Use VCALL() to lock or unlock the lower node. 2017-05-24 09:55:18 +00:00
hannken
2aedd7ca2a Move v_writecount adjustment from revoke to reclaim. 2017-05-07 08:21:57 +00:00
riastradh
6fa7b15833 Change VOP_REMOVE and VOP_RMDIR to preserve lock/ref on dvp.
No change to vp -- the plan is to replace the node by the
componentname in the vop parameters, and let all directory vops do
lookups internally.

Proposed on tech-kern with no objections:
https://mail-index.netbsd.org/tech-kern/2017/04/17/msg021825.html
2017-04-26 03:02:47 +00:00
hannken
20bb034f5b Remove unused argument "nextp" from vfs_busy() and vfs_unbusy().
Remove argument "keepref" from vfs_unbusy() and add vfs_ref() where needed.
2017-04-17 08:32:00 +00:00
hannken
ebb8f73b4b Add vfs_ref(mp) and vfs_rele(mp) to add or remove a reference to
struct mount.  Rename vfs_destroy(mp) to vfs_rele(mp) and replace
incrementing mp->mnt_refcnt with vfs_ref(mp).
2017-04-17 08:31:01 +00:00
riastradh
87fb32292e Make VOP_INACTIVE preserve vnode lock on return.
Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2017/04/01/msg021751.html

Ride 7.99.68, a bumpy bus of incremental vfs improvements!
2017-04-11 14:24:59 +00:00
hannken
9888a178c6 Update mtime when updating file size.
PR kern/51762 (mtime not updated by open(O_TRUNC))
2017-04-08 08:49:44 +00:00
christos
6b0cbcd6e2 use ubc_zerorange 2017-04-06 00:02:19 +00:00
christos
b53a5a0ca4 use MAX_PAGE_SIZE. 2017-04-04 21:07:50 +00:00
riastradh
30509f8074 KASSERT(mutex_owned(vp->v_interlock)) in vnode iterator selector. 2017-04-01 19:35:56 +00:00
hannken
3c404d2c80 Protect tmpfs_getpages() against reclaiming vnodes. 2017-03-30 09:09:26 +00:00
hannken
1f6768b2fd Add field "mnt_lower" to "struct mount" to track the file system
a layered file system is mounted on.

Welcome to 7.99.65
2017-03-06 10:10:07 +00:00
hannken
8c855e05d7 Handle v_writecount from union_open(), union_close() and union_revoke()
so lower file system vnodes get marked as open for writing.
2017-03-06 10:08:49 +00:00
hannken
90ead62d2f Change the protocol to update a mounted file system from read-write
to read-only and vice versa:

- Add an internal flag IMNT_WANTRDONLY.
- Set either IMNT_WANTRDWR or IMNT_WANTRDONLY if going from or to read-only.
- After successfull call to VFS_MOUNT() set or clear MNT_RDONLY.

Adapt tmpfs and rumpfs to the new protocol.  Other file systems will be
updated when they get the IMNT_CAN_RWTORO property.

Welcome to 7.99.64
2017-03-01 10:44:47 +00:00