Commit Graph

2161 Commits

Author SHA1 Message Date
hannken
2547f8421a Change mfs to use an anonymous vnode obtained with bdevvp()
for the specdev it mounts on.
2015-01-14 11:21:31 +00:00
hannken
ba1d531e8e Change chfs from hashlist to vcache. 2015-01-11 17:29:57 +00:00
hannken
bf7db7c8e6 Convert a bogus mnt_vnodelist traversal to vfs_vnode_iterator. 2015-01-11 17:28:22 +00:00
hannken
0a8dc26a6e Return immediately from successfull cache_lookup().
No need to unlock an unlocked vnode.
2015-01-11 17:27:54 +00:00
christos
ada19b7b7f clear i_dirhash sooner, but what lock protects it? 2014-12-20 00:28:05 +00:00
manu
287664b5c4 Bump UFS1 extended attribute max name length to 256
For extended attribute name max length, kernel filesystem-independant
code use either EXTATTR_MAXNAMELEN (BSD API) or XATTR_NAME_MAX (Linux API),
which are both defined as KERNEL_NAME_MAX and fits Linux limit of 255
without training \0.

UFS1 code had a lower limit that broke Linux compatibility. We can bump
the limit without sacrifying backward compatibility, because:

1) There is no API exposing this limit outside the kernel. Upper kernel
layers have a larger limit handle the increase without a hitch

2) Each attribute has its own backing store in the fileystem, the name
of the backing store matching the attribute name. A newer kernel can
create/read/write backing store for longer attribute names and will
have no problem with existing shorter names.
2014-12-19 10:59:21 +00:00
christos
853279d741 Restore apple ufs error handling. 2014-12-14 01:13:57 +00:00
christos
4ddba2941f - Add debugging for mount...
- Merge some error returns
- Check more errors
2014-12-14 00:36:07 +00:00
justin
1591612668 Avoid uninitialized variable error in some cases with gcc 2014-12-08 00:16:44 +00:00
christos
fdb1c07286 CID 977076: Widen before multiply. 2014-11-25 19:48:24 +00:00
manu
f4276d8b0e Fix uninitialized mutex usage
We use extended attribute mount mutex before testing if it had been
initialized, and as reported by Christos,  this caused panic with
LOCKDEBUG. Fix it by testing before using.
2014-11-19 16:26:47 +00:00
manu
239cf5506d Remove unused extended attributes kernel options
As Masao Uebayashi pointed to me, UFS_EXTATTR_AUTOSTART, LFS_EXTATTR_AUTOSTART
and UFS_EXTATTR_AUTOCREATE are not used anywhere in the code. Remove them
as they have been obsolete for a long time:
UFS_EXTATTR_AUTOSTART was replaced by mount -o extattr
LFS_EXTATTR_AUTOSTART was created to match obsolete UFS_EXTATTR_AUTOSTART
UFS_EXTATTR_AUTOCREATE was replaced by sysctl vfs.ffs.extattr_autocreate
2014-11-16 16:01:39 +00:00
manu
620512b8f3 Fix UFS1 extended attribute backend autocreation deadlock
UFS1 extended attribute backend autocration goes through a vn_open()
to create the backend file, and this forces us to release the lock
on the target node, in case the target is within the parents of the
backend file. That created a window within which another thread could
acquire a lock on the target vnode and deadlock awaiting for the
mount extended attribute lock.

We fix the problem by also releasing the mount extended attribute lock
when calling vn_open(), but that lets another thread race us for backend
creation. We just detect this using O_EXCL for vn_open() and by checking
for EEXIST return code. If we are raced, we fail backend creation but
this is not a problem since another thread succeeded on it: we just have
to use the result.
2014-11-15 05:03:55 +00:00
manu
7ac57848aa Fix use-after-free on failed unmount with extended attribute enabled
When unmount failed, for instance because the mount is still busy,
UFS1 extended attributes structures were left freed while the kernel
assumes extended attributes were still enabled. This led to using
UFS1 extended attributes structures after free. With LOCKDEBUG, with
quickly triggers a panic.

The problem is fixed by:
1) clear MNT_EXTATTR flag after extended attributes structures are freed
2) attempt to restart extended attributes after failed unmount
2) set MNT_EXTATTR correctly after extended attributes restart

As a side effect, extended attribute structures are now only initialized
when extended attributes are started for the filesystem.
2014-11-14 10:09:50 +00:00
maxv
be2f51b7f2 Do not uselessly include <sys/malloc.h>. 2014-11-09 18:23:28 +00:00
maxv
86c13aa357 Limit the superblock size to SBLOCKSIZE, not MAXBSIZE. Otherwise memcpy
will read beyond the allocated buffer.

Discussed a bit on tech-kern@.
2014-10-30 17:13:41 +00:00
christos
d9836fd090 simplify and correct. 2014-10-29 01:13:28 +00:00
njoly
3ab1cc3d9a One semicolon is enough. 2014-10-24 13:18:51 +00:00
slp
32bf72ea0a Move and unify indirect block truncate algorithm into a separate function.
Reviewed by joerg.
2014-10-21 10:39:26 +00:00
christos
f694e9cab1 simplify. 2014-10-20 11:57:05 +00:00
maxv
12c7ae02a5 Memory leak.
Found by my code scanner.

ok christos@
2014-10-20 06:41:51 +00:00
snj
f0a7346d21 src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
2014-10-18 08:33:23 +00:00
uebayasi
b31f13fb95 To make sure that I'm not doing wrong, try to define ffs/ufs/vfs dependencies
a little more strictly.
2014-10-10 12:20:13 +00:00
matt
b98bea4ab9 curlwp can never be NULL now. 2014-09-19 23:52:34 +00:00
joerg
42af341101 Prefer cprng_fast32 over random. A good distribution even in the lower
bits beat any minor performance advantage randomo(9) might have,
especially given the disk IO involved.
2014-09-08 20:52:37 +00:00
joerg
73bd7ce90d Timestamps are bad sources of entropy, so just use cprng_fast32. 2014-09-08 17:41:11 +00:00
matt
9d33f033c0 Don't nest structure definitions. 2014-09-05 06:10:07 +00:00
he
7fcec1e880 Plug memory leak in add_peb_to_free() and add_peb_to_in_use()
in case there's a duplicate in the tree.
2014-09-01 16:48:42 +00:00
he
9e25a2c2c8 Plug memory leak in error returns and normal operation in
chfs_gcollect_pristine().
2014-09-01 16:46:56 +00:00
he
3f59fd906f Plug memory leaks in error returns in chfs_readvnode(). 2014-09-01 16:33:20 +00:00
he
cb8ef348c1 Plug memory leak in a corner case in chfs_get_data_nodes(). 2014-09-01 16:31:17 +00:00
he
84353ac61b Plug leak in chfs_scan_eraseblock() of the allocated buffer.
Make sure to release it both on success and failure returns.
OK'ed by ttoth@
2014-09-01 16:27:38 +00:00
hannken
d0fd8c21fa Use mount from argument "mp", "vp->v_mount" is not valid here.
PR kern/49142 (panic in ext2fs_loadvnode mounting an ext2fs filesystem)

Needs pullup to -7
2014-08-22 16:49:30 +00:00
maxv
7078ad0de8 http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html#Report-2
#04-0x02: Remove 'doclusterread' and 'doclusterwrite' (unused).
2014-08-12 06:49:10 +00:00
dholland
5366fdc4a7 Switch the FFS code for discarding free blocks to use VOP_FDISCARD. 2014-07-25 08:24:31 +00:00
dholland
05d075b3ae Add VOP_FALLOCATE and VOP_FDISCARD to every vnode ops table I can
find.

The filesystem ones all call genfs_eopnotsupp - right now I am only
implementing the plumbing and we can implement fallocate and/or
fdiscard for files later.

The device ones call spec_fallocate (which is also genfs_eopnotsupp)
and spec_fdiscard, which dispatches to the device-level op.

The fifo ones all call vn_fifo_bypass, which also ends up being
EOPNOTSUPP.
2014-07-25 08:20:51 +00:00
christos
cb7ffd4c7b move the flag setting higher to avoid KASSERT (dholland) 2014-07-11 16:17:29 +00:00
christos
0a57ec5aa3 CID 975226: hande error from UFS_WAPBL_BEGIN 2014-07-10 15:15:54 +00:00
dholland
42bd51ac43 Fix unchecked UFS_WAPBL_BEGIN. Coverity 975226.
Unfortunately it looks like all we can do on error here is printf.
2014-07-10 06:27:15 +00:00
dholland
e1f8b7119c Use an explicit compare to 0 for an immediate error result, not !.
Using ! is perfectly clear on variables like "error" or "result",
but directly on a function call it tends to look like a mistake.
2014-07-10 06:02:40 +00:00
maxv
8fce630b04 Remove ROOTNAME (unused). 2014-07-09 08:43:54 +00:00
dholland
01e782f371 Revert the following changes:
src/sys/sys/quotactl.h 1.37
   src/sys/compat/netbsd32/netbsd32.h 1.101
   src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
   src/sys/kern/vfs_quotactl.c 1.39
   src/sys/kern/vfs_syscalls.c 1.483
   src/sys/ufs/lfs/ulfs_quota.c 1.11
   src/sys/ufs/ufs/ufs_quota.c 1.116
   src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.
2014-06-28 22:27:50 +00:00
joerg
ef53e37514 Don't t use a C++ keyword as field name. 2014-06-12 21:39:45 +00:00
joerg
11581dcbbb Introduce two helper functions to centralise the namecache statistics
in vfs_cache.c. Use consistent locking around the per-cpu data.
2014-06-03 19:30:29 +00:00
hannken
7bd94e9e7c Testing "v_usecount == 1" for exclusive reference will not always
work -- remove and test only readonly.
2014-05-30 08:40:09 +00:00
dholland
b85f717916 Fix previous. Anyone have a brown paper bag? 2014-05-26 19:16:39 +00:00
ryoon
31862f646a Close comments 2014-05-26 19:12:43 +00:00
dholland
f4a58ec096 remove ffs-only IN_SPACECOUNTED 2014-05-26 18:58:32 +00:00
dholland
fc1073487c Remove lfs-only inode flags. 2014-05-26 18:52:50 +00:00
hannken
6e91d8f4bf Remove ext2fs_checkpath(). It is a relic from the pre-genfs_rename era. 2014-05-25 14:07:19 +00:00