Commit Graph

1561 Commits

Author SHA1 Message Date
reinoud a987c68f3a vp is used, so don't (void) it 2013-07-13 19:40:14 +00:00
reinoud 2b15913865 Rework udf_gro_rename() to be more linear instead of nesting if/else
branching.
2013-07-13 19:39:02 +00:00
reinoud 8ad309e64f In case there is trouble determining the number of entries in a directory,
return its not empty to be on the safe side.
2013-07-12 16:14:10 +00:00
reinoud d9c51d931b Resort to the easiest way to check if a directory is deleted: the flag that
tells that there is no FID (dirent) pointing to it anymore.
2013-07-11 19:41:19 +00:00
reinoud da86562477 Small cleanup 2013-07-11 15:43:12 +00:00
reinoud c689e7fed3 Remove the dirent checks and references. UDF doesn't need/use them on rename
so just to make sure, we remove all references/checks to not trigger bugs
thats are not really ours.
2013-07-10 19:14:07 +00:00
reinoud a7795a09e4 Implement udf_rename() using the new genfs_rename() framework.
Fixes PR kern/47986
2013-07-10 15:10:56 +00:00
reinoud 1cabaf0e68 Clarify the sticky-bit check 2013-07-08 08:21:12 +00:00
reinoud a0054fd5a4 Pull forward the node creation returned from the lookup call. Its vnode is
used in the access determination on delete/rename of TXT files.

Thanks for joerg@ and clang for detecting this!
2013-07-07 20:16:22 +00:00
reinoud eb513d5160 Implement a real empty-directory checking for rmdir().
Should should fix the other part of PR kern/47987
Solves tests/vfs/t_vnops udf_dir_notempty
2013-07-07 19:49:44 +00:00
reinoud d2126d9622 Fixes chflags. They were silently rejected before but the VFS standard demands
it complains with EOPNOTSUPP.

Fixes chflags test case.
2013-07-05 20:40:20 +00:00
reinoud 16cc237e7c Provide additional checks to udf_lookup and restructure it a bit.
Should fix PR 47988
2013-07-05 20:04:57 +00:00
reinoud 1a547d0334 Remove spurious empty line 2013-07-03 15:39:22 +00:00
reinoud ab09c24f7a On removing a directory make sure the leaf directory doesn't have a valid '..'
link anymore. In a corner case this leaf can be held by a process as a CWD. It
is guaranteed to be empty at this stage so we trunc it removing the only valid
FID, being the '..' entry.

Solves part of PR kern/47987
Solves tests/vfs/t_vnops udf_dir_rmdirdotdot
2013-07-03 14:35:28 +00:00
reinoud e6b5374ef7 Typo in debug message: we are removing a directory and not a file. 2013-07-03 12:55:34 +00:00
reinoud d0b9530090 On growing a node that was recorded inside the (E)FE, don't forget to set the
size of the node to the NEW size. This was reported by the `t_io
udf_shrinkfile' testcase.

Fixes PR kern/47985
2013-07-03 11:50:59 +00:00
matt d2b8f70ecf Make this compile again. 2013-06-28 17:13:34 +00:00
christos c22fbb82f6 remove useless initialization, KNF
http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html
2013-06-28 15:46:37 +00:00
christos b9bf0e6c5d prevent memory leak on error
http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html
2013-06-28 14:49:14 +00:00
reinoud 793c315af2 Since UDF volumes are always mounted async, the simple UBC purging with
VOP_PUTPAGES() was never triggered resulting in far too much data in the UBC
that needed to be written out. This could result in instability on small
memory machines.
2013-06-27 09:38:08 +00:00
dholland e1610ba4cb Stick ffs_, ext2_, chfs_, filecore_, cd9660_, or mfs_ in front of
the following symbols so as to disambiguate fully. (Christos already
did the lfs ones.)

   lblkno
   lblktosize
   lfragtosize
   numfrags
   blkroundup
   fragroundup
2013-06-23 07:28:36 +00:00
dholland dab2b35444 blkoff() -> cd9660_blkoff()
blksize() -> cd9660_blksize()
2013-06-19 18:16:53 +00:00
dholland 4671554398 blkoff() -> filecore_blkoff()
blksize() -> filecore_blksize()
2013-06-19 18:16:10 +00:00
pooka b2d1226abe Don't change a read-only file system. 2013-05-15 16:44:03 +00:00
reinoud 52cff03007 Fix Typo 2013-05-08 10:39:17 +00:00
reinoud fa5ee9f6e0 Fix serious file read problem due to not-so-clear VOP_BMAP description. Should
fix PR 45605.
2013-05-08 10:29:22 +00:00
jakllsch e7f2d5bd6f Don't attempt to mount file system with clusters larger than MAXBSIZE. 2013-04-15 14:10:59 +00:00
plunky 5ec364d4d9 C99 section 6.7.2.3 (Tags) Note 3 states that:
A type specifier of the form

	enum identifier

  without an enumerator list shall only appear after the type it
  specifies is complete.

which means that we cannot pass an "enum vtype" argument to
kauth_access_action() without fully specifying the type first.
Unfortunately there is a complicated include file loop which
makes that difficult, so convert this minimal function into a
macro (and capitalize it).

(ok elad@)
2013-03-18 19:35:35 +00:00
yamt ca4fff9c14 comments
use sizeof(var) instead of sizeof(type) where possibly confusing
2013-03-06 11:40:22 +00:00
yamt 03d1621dc1 comment 2013-03-06 11:39:37 +00:00
christos db2e654869 A little more debugging. 2013-01-28 00:17:18 +00:00
christos 50df1c7d20 don't need sys/mount.h in userland. 2013-01-27 22:04:19 +00:00
christos 3c0f9bd4e8 tidy up debugging printfs; no functional change. 2013-01-27 20:15:58 +00:00
christos 1ed2e30d40 fix fstat build. 2013-01-26 19:45:02 +00:00
christos 691bcd5dbb more cross-compile friendly. 2013-01-26 16:51:51 +00:00
christos 929f8943ca expose more stuff if MAKEFS is defined for the headers, and arrange for
the source file to be compilable from userland.
2013-01-26 00:21:49 +00:00
pooka a0e33ce1e2 Do the protocol consistency check hack only when compiling ELF. 2013-01-16 21:10:14 +00:00
hannken d845821cd8 Move the initialization of n to after the error branch.
From Taylor R Campbell <riastradh@netbsd.org>
2012-12-28 08:03:59 +00:00
hannken 1a15b095d2 Revert rev. 1.20 now that bread() has been fixed.
PR kern/46282 (6.0_BETA crash: msdosfs_bmap -> pcbmap -> bread -> bio_doread)
2012-12-20 11:44:39 +00:00
hannken 312d89f0de Change bread() and breadn() to never return a buffer on
error and modify all callers to not brelse() on error.

Welcome to 6.99.16

PR kern/46282 (6.0_BETA crash: msdosfs_bmap -> pcbmap -> bread -> bio_doread)
2012-12-20 08:03:41 +00:00
msaitoh b6e1d8e8d8 Fix off by one error. 2012-12-07 06:50:15 +00:00
mbalmer e3f283b63f Fix misspelling: accommodate is a long enough word to have room for two 'c's
and two 'm's.
2012-12-01 11:41:49 +00:00
nakayama fb4e31b6db Improve smbfs timestamp handling.
Don't round timestamp to 2 seconds resolution if the server
supports the CAP_INFOLEVEL_PASSTHRU capability.
2012-11-30 23:24:21 +00:00
nakayama 33e8b488e1 - Remove redundant vput() before vgone().
- Avoid unnecessary mutex_exit() in smbfs_node_alloc().
- Set NGONE bit to from-name vnode to invalidate the smbnode cache.
2012-11-29 11:58:49 +00:00
nakayama 9dae46742e Various fixes for smbfs:
- Implement NGONE to fix caching issue described in PR kern/25070.
  Mostly taken from FreeBSD r125637.

- Revert revision 1.70 of smbfs_vnops.c to fix setattr to opened
  direcotry.  In case of SMB_CAP_NT_SMBS, NOPEN is set after
  smbfs_smb_ntcreatex() call.  If NOPEN is set in front, it will
  immediately return by condition at do_open label.

- In smbfs_close(), call smbfs_smb_close() and drop NOPEN bit in
  the case of direcotry.  Otherwise smbfs_rmdir() fails when the
  directory was opened.
2012-11-28 13:34:24 +00:00
nakayama 5f60ff96cb - fix endian cofusion around FID, which is used as is, so no need
to do byte swapping.
- put right value to ByteCount of SMB_COM_NT_CREATE_ANDX request.

The fix makes smbfs actually works on big-endian port.
2012-11-24 19:48:24 +00:00
dholland 35ed690545 Excise struct componentname from the namecache.
This uglifies the interface, because several operations need to be
passed the namei flags and cache_lookup also needs for the time being
to be passed cnp->cn_nameiop. Nonetheless, it's a net benefit.

The glop should be able to go away eventually but requires structural
cleanup elsewhere first.

This change requires a kernel bump.
2012-11-05 17:27:37 +00:00
dholland 1617a81dd1 Disentangle the namecache from the internals of namei.
- Move the namecache's hash computation to inside the namecache code,
instead of being spread out all over the place. Remove cn_hash from
struct componentname and delete all uses of it.

 - It is no longer necessary (if it ever was) for cache_lookup and
cache_lookup_raw to clear MAKEENTRY from cnp->cn_flags for the cases
that cache_enter already checks for.

 - Rearrange the interface of cache_lookup (and cache_lookup_raw) to
make it somewhat simpler, to exclude certain nonexistent error
conditions, and (most importantly) to make it not require write access
to cnp->cn_flags.

This change requires a kernel bump.
2012-11-05 17:24:09 +00:00
dholland 26486df952 Fix build of fs/unionfs (the extra unused copy of onionfs) for the
quota changes.
2012-11-05 17:16:59 +00:00
jakllsch 48958e522b Stylistic changes in comments/strings:
"FAT" and "fat" are different things, use the appropriate case.
"GEMDOS" is all caps.
2012-11-04 17:57:59 +00:00
jakllsch 1203d9864d And correct a typo that wasn't corrected in previous. 2012-11-04 17:35:27 +00:00
jakllsch 3a46a43ff0 Correct constant in comment to match the expression it is derived from. 2012-11-04 17:33:46 +00:00
jakllsch a8a5260437 Check that the FSInfo block's next free cluster suggestion is actually
a cluster within the bounds of the volume too.
2012-11-04 17:18:56 +00:00
jakllsch 1afc21ab39 ((u_long)-1) will not always be 0xffffffff, which is what we actually
want to test against to determine if the FSInfo block's next free
cluster suggestion is valid
2012-11-04 17:16:37 +00:00
christos 81f024e94e rename ptyfs_flag -> ptyfs_status to avoid confusion with ptyfs_flags 2012-10-24 23:36:15 +00:00
christos 0966ff043a fix the mystery of the bad directory times. 2012-10-23 23:31:00 +00:00
jakllsch 8b020b7eee We don't actually want to round the number of elements in the bitmap
down.  Fixes a self-inflicted buffer overrun.

(This was detected by chance that the top of the bitmap coincided with
a page boundary.)
2012-10-03 23:32:43 +00:00
mlelstv c7b0abd4dd Use getdisksize() to find out geometry, fetch only other magic values
from disklabel.
2012-10-03 07:20:50 +00:00
riastradh 7fad9ac861 Uncomment call to genfs_rename_cache_purge.
Fixes a side issue mentioned in PR kern/46990.

I left this commented to preserve the old behaviour of tmpfs_rename,
but it is obviously broken to omit the cache purge, and I'm surprised
nobody had encountered any problems with it until now.
2012-09-27 17:40:51 +00:00
riastradh d0eacb2c29 Check tmpfs_rmdired_p after tmpfs_vnode_get when walking up the tree.
tmpfs_vnode_get drops all locks except possibly the reclaiming bit
lock to keep the tmpfs node from being reclaimed while we're still
interested in it.  Consequently, it does not keep the directory's
existence invariant, so we must check that after tmpfs_vnode_get.

Fixes PR kern/46990.  Tested by Wolfgang Stukenbrock.
2012-09-25 16:11:42 +00:00
christos c209ba9c66 let us get mounted multiple times. 2012-09-18 23:42:52 +00:00
christos 381769fc11 Always do the chroot filename mapping; it is pointless not to do it. 2012-09-18 21:33:55 +00:00
manu ff88f232cf Missing bit in previous commit (PUFFS_KFLAG_CACHE_DOTDOT option to avoid
looking up ..)
2012-08-11 01:10:11 +00:00
manu 2a9a80bb36 Add PUFFS_KFLAG_CACHE_DOTDOT so that vnodes hold a reference on their
parent, keeping them active, and allowing to lookup .. without sending
a request to the filesystem.

Enable the featuure for perfused, as this is how FUSE works.
2012-08-10 16:49:35 +00:00
manu 9bd2034d93 Missing bit in previous commit (prevent race between create|mknod|mkdir|symlink
and reclaim)
2012-08-10 14:52:56 +00:00
manu 244cd4a742 Fix race condition between (create|mknod|mkdir|symlino) and reclaim, just
like we did it between lookup and reclaim.
2012-08-10 08:42:10 +00:00
manu fe25386a9a Backout previous bugfix attempt for unmounts. That changes did not
address the real problem.
2012-08-09 07:46:18 +00:00
matt b1afbb311c Fix -fno-common found by building i386/conf/ALL 2012-07-28 00:43:22 +00:00
drochner dba2da8249 gcc -fno-common fallout 2012-07-27 22:55:29 +00:00
manu b8b95eab4a Rename slow sopreq queue into node sopreq queue, to refet the fact that
is only intended for postponed node reclaims.
When purging the node sopreq queue, do not call puffs_msg_sendresp(), as
it makes no sense.
2012-07-27 07:38:44 +00:00
manu efa196dac9 puffs mounts share global pools. This means that the puffs_vfsops cannot
be vfs_detach'ed by module autounload before puffs_vfsop_unmount() completes
and has freed ressource from the pools. By holding a reference on
puffs_vfsops from each mount, we ensure that no race can occur here.

Works around the crash in kern/46734
2012-07-27 07:25:56 +00:00
manu 3d50d37923 Backout NCHNAMLEN check for cache_enter. That change collided with rmind's
move of this exact check into cache_enter
2012-07-23 19:06:10 +00:00
manu 00896e49d4 Di not call cache_enter with path components bigger than NCHNAMLEN, as it
panics the kernel.
2012-07-23 12:15:30 +00:00
manu c4b1a0ab97 Fix hang unmount bug introduced by last commit.
We introduced a slow queue for delayed reclaims, while the existing
queue for unmount, flush and exist has been renamed fast queue. Both
queues had timestamp for when an operation should be done, but it was
useless for the fast queue, which is always used to run an operation
ASAP. And the timestamp test had an error that turned ASAP into "at next
tick", but nobody what there to wake the thread at next tick, hence
the hang. The fix is to remove the useless and buggy timestamp test for
fast queue.
2012-07-22 17:40:46 +00:00
rmind d65753d972 Move some the test for MAKEENTRY into the cache_enter(9). Make some
variables in vfs_cache.c static, __read_mostly, etc.

No objection on tech-kern@.
2012-07-22 00:53:18 +00:00
manu 8502ba8ea3 - Improve PUFFS_KFLAG_CACHE_FS_TTL by reclaiming older inactive nodes.
The normal kernel behavior is to retain inactive nodes in the freelist
until it runs out of vnodes. This has some merit for local filesystems,
where the cost of an allocation is about the same as the cost of a
lookup. But that situation is not true for distributed filesystems.
On the other hand, keeping inactive nodes for a long time hold memory
in the file server process, and when the kernel runs out of vnodes, it
produce reclaim avalanches that increase lattency for other operations.

We do not reclaim inactive vnodes immediatly either, as they may be
looked up again shortly. Instead we introduce a grace time and we
reclaim nodes that have been inactive beyond the grace time.

- Fix lookup/reclaim race condition.

The above improvement undercovered a race condition between lookup and
reclaim. If we reclaimed a vnode associated with a userland cookie while
a lookup returning that same cookiewas inprogress, then the kernel ends
up with a vnode associated with a cookie that has been reclaimed in
userland. Next operation on the cookie will crash (or at least confuse)
the filesystem.

We fix this by introducing a lookup count in kernel and userland. On
reclaim, the kernel sends the count, which enable userland to detect
situation where it initiated a lookup that is not completed in kernel.
In such a situation, the reclaim must be ignored, as the node is about
to be looked up again.
2012-07-21 05:17:10 +00:00
dsl 609d5cf3c1 Fix build - eg i386/ALL 2012-07-12 17:24:47 +00:00
tsutsui 28d320dc7a Revert rev 1.95 since getdisksize() no longer returns secsize=0. 2012-07-07 16:18:50 +00:00
tsutsui 2c05e4d76c Add a sanity check if secsize returned from getdisksize() isn't bogus.
This prevent possible panic "panic: buf mem pool index 23" later in
vfs_bio.c:buf_mempoolidx().
(I'm not sure if it's okay for getdisksize() to assume that
 partinfo taken from DIOCGPART is properly initialized
 on all disk(9) devices or not)

See also:
http://mail-index.NetBSD.org/source-changes/2012/06/30/msg035298.html
2012-06-30 11:01:41 +00:00
joerg 4b586f4e8b Assert that out_hr is not NULL in hfslib_read_header_node 2012-06-15 21:59:39 +00:00
agc 4775edcbb6 calculate inode capacities using the correct values 2012-06-14 01:08:22 +00:00
joerg 15a60c04b8 Ensure that error is initialized in all code paths. 2012-06-13 22:56:50 +00:00
agc 6b981736db cosmetic change: fix two casts to be of the appropriate type 2012-06-11 21:11:40 +00:00
christos fd4605203e - fix some mallocs not to have casts and specify sizeof(*var)
- if the index magic is 0, don't complain, just return an error.
- make dprintfs use __func__
2012-06-02 16:26:24 +00:00
riastradh 21ca295647 Fix omitted VN_KNOTE(fvp, NOTE_RENAME) in tmpfs_rename.
Missed that line while refactoring tmpfs_rename to use genfs_rename.
2012-05-09 22:46:25 +00:00
riastradh aff071a220 Adapt tmpfs_rename to use genfs_rename. 2012-05-09 00:16:07 +00:00
tsutsui 8eac82d05c Move bfs_file_setsize() from bfs.c to sysvbfs_vnops.c
(and rename it to sysvbfs_file_setsize()) because it's actually
part of vnode ops and bfs.c is also pulled by standalone bootloaders
which don't want vnode header mess.
2012-05-08 14:28:55 +00:00
rmind f1d428af19 - Replace some malloc(9) uses with kmem(9).
- G/C M_IPMOPTS, M_IPMADDR and M_BWMETER.
2012-04-30 22:51:27 +00:00
chs 8306a9eddf change vflushbuf() to take the full FSYNC_* flags.
translate FSYNC_LAZY into PGO_LAZY for VOP_PUTPAGES() so that
genfs_do_io() can set the appropriate io priority for the I/O.
this is the first part of addressing PR 46325.
2012-04-29 22:53:59 +00:00
dsl e05eb71de5 Remove everything to do with 'struct malloc_type' and the malloc link_set.
To make code in 'external' (etc) still compile, MALLOC_DECLARE() still
  has to generate something of type 'struct malloc_type *', with
  normal optimisation gcc generates a compile-time 0.
MALLOC_DEFINE() and friends have no effect.
Fix one or two places where the code would no longer compile.
2012-04-29 20:27:31 +00:00
manu 2af7ec529e - Makesure update_va does not change vnode size when it should not. For
instance when doing a fault-issued VOP_GETPAGES within VOP_WRITE, changing
size leads to panic: genfs_getpages: past eof.
-Handle ticks wrap around for vnode name andattribute timeout
2012-04-18 00:42:50 +00:00
hannken 4856f6556b pcbmap(): We cannot use bread() here as for the pagedaemon getblk()
may fail leading to a panic in bread().
          Replace bread() with getblk() / VOP_STRATEGY() and return
          an error if getblk() fails.

Fixes PR#46282: 6.0_BETA crash: msdosfs_bmap -> pcbmap -> bread -> bio_doread

This is an interim solution for easy pullup.  The final solution
is be to change bread() to not return a buffer on error.  As
we have to change all callers of bread() this will not qualify
for a pullup.
2012-04-09 11:10:06 +00:00
manu 6e9ef39515 Add name and atttribute cache with filesytem provided TTL.
lookup, create, mknod, mkdir, symlink, getattr and setattr messages
have been extended so that attributes and their TTL can be provided
by the filesytem. lookup, create, mknod, mkdir, and symlink messages
are also extended so that the filesystem can provide name TTL.
2012-04-08 15:04:41 +00:00
njoly c379c0d9df Add missing braces in previous commit. 2012-04-03 14:58:55 +00:00
njoly 796009d11f Report the SF_ARCHIVED file flag if set. 2012-04-02 07:30:22 +00:00
njoly ea834bf0c0 Make v7fs_getattr() report file flags, and adjust v7fs_setattr() to
allow unsetting SF_APPEND flag.
2012-03-31 21:44:28 +00:00
njoly 6b7e4e42d8 sysvbfs do not support file flags; fail with EOPNOTSUPP. 2012-03-30 18:27:55 +00:00
njoly 8725631c5c Pass operations flags to genfs_can_chtimes(), not file ones. 2012-03-22 22:16:21 +00:00
christos fa04ef14fe don't re-define MIN 2012-03-21 15:55:50 +00:00
christos 65f52d6225 handle file resizing. 2012-03-18 02:40:55 +00:00
jakllsch cc443ff60b Prevent access beyond end of PUFFS file on read,
similar to as is done for NFS.
2012-03-16 23:13:48 +00:00
elad 0c9d8d15c9 Replace the remaining KAUTH_GENERIC_ISSUSER authorization calls with
something meaningful. All relevant documentation has been updated or
written.

Most of these changes were brought up in the following messages:

    http://mail-index.netbsd.org/tech-kern/2012/01/18/msg012490.html
    http://mail-index.netbsd.org/tech-kern/2012/01/19/msg012502.html
    http://mail-index.netbsd.org/tech-kern/2012/02/17/msg012728.html

Thanks to christos, manu, njoly, and jmmv for input.

Huge thanks to pgoyette for spinning these changes through some build
cycles and ATF.
2012-03-13 18:40:26 +00:00
chs 4515341194 in tmpfs_readdir(), skip the . and .. processing on removed directories,
since the latter will crash in this case.
2012-02-27 16:10:56 +00:00
joerg 45883dbd84 Only use MALLOC_DECLARE if it exists. Helps with the dirty _KERNEL
tricks fstat is using.
2012-02-03 04:29:17 +00:00
joerg 609d852960 Include sys/malloc.h for MALLOC_DECLARE. 2012-01-28 16:24:35 +00:00
njoly af1deb8b05 Check credentials when setting uid, gid or mode attributes. 2012-01-27 21:46:42 +00:00
para e62ee4d475 extending vmem(9) to be able to allocated resources for it's own needs.
simplifying uvm_map handling (no special kernel entries anymore no relocking)
make malloc(9) a thin wrapper around kmem(9)
(with private interface for interrupt safety reasons)

releng@ acknowledged
2012-01-27 19:48:38 +00:00
njoly f5adce712b Check parent directory write permission for DELETE operation.
ok uch@.
2012-01-27 12:22:02 +00:00
rmind 0adcb88bc3 tmpfs_access: simplify, no need to separate the logic. 2012-01-22 03:13:19 +00:00
manu e146830324 Fix a race condition where the filesystem lookups a vnode that is
being recycled, producing ENOENT while the file does exist.

Approved by yamt
2012-01-19 08:14:41 +00:00
martin 89eb27aa2c Add a few KASSERT() - I have a crash that likely will cause one of them to
fire...
2012-01-17 09:30:16 +00:00
njoly 973e485533 Start making fs read(2) fail with EISDIR if the implementation does
not allow read on directories (kernfs, rumpfs, ptyfs and sysvbfs).
Adjust man page accordingly, and add a small corresponding vfs
testcase.
2011-12-12 19:11:21 +00:00
hannken 1ebfe67c9f The union file system is as stable as other layered file systems so
no longer print a warning to the console.

Gnats is waiting ...
2011-12-05 11:12:10 +00:00
hannken ea1a52c704 When union_allocvp() finds a node being cleaned out and the caller holds
a lock, ignore the node and continue.  To allow the cleaning to succeed
the current threadmust make progress.
For a brief time the cache may contain more than one vnode referring to
a lower node.

Don't unlock the hash mutex if getnewvnode fails -- we don't hold it.
2011-11-25 11:19:10 +00:00
hannken 035b1022bb Use hashinit() / hashdone() to create the union node hash list.
Cleanup the hash lookup in union_allocvp().

Needs more work as there is still a possible deadlock between
union_allocvp() and vclean().
2011-11-23 19:39:11 +00:00
hannken 4e825063cf Replace flag based union node locking with generic vnode lock, support
shared and nowait locks and protect un_uppervp and un_*sz with mutex.

Mark file system MPSAFE.
2011-11-21 18:29:22 +00:00
hannken 026265a4d0 Add missing fstrans_done().
Should fix PR #45635 (KASSERT "fli->fli_trans_cnt == 0" failed)
2011-11-21 10:46:56 +00:00
tls 3afd44cf08 First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>.  This change includes
the following:

	An initial cleanup and minor reorganization of the entropy pool
	code in sys/dev/rnd.c and sys/dev/rndpool.c.  Several bugs are
	fixed.  Some effort is made to accumulate entropy more quickly at
	boot time.

	A generic interface, "rndsink", is added, for stream generators to
	request that they be re-keyed with good quality entropy from the pool
	as soon as it is available.

	The arc4random()/arc4randbytes() implementation in libkern is
	adjusted to use the rndsink interface for rekeying, which helps
	address the problem of low-quality keys at boot time.

	An implementation of the FIPS 140-2 statistical tests for random
	number generator quality is provided (libkern/rngtest.c).  This
	is based on Greg Rose's implementation from Qualcomm.

	A new random stream generator, nist_ctr_drbg, is provided.  It is
	based on an implementation of the NIST SP800-90 CTR_DRBG by
	Henric Jungheim.  This generator users AES in a modified counter
	mode to generate a backtracking-resistant random stream.

	An abstraction layer, "cprng", is provided for in-kernel consumers
	of randomness.  The arc4random/arc4randbytes API is deprecated for
	in-kernel use.  It is replaced by "cprng_strong".  The current
	cprng_fast implementation wraps the existing arc4random
	implementation.  The current cprng_strong implementation wraps the
	new CTR_DRBG implementation.  Both interfaces are rekeyed from
	the entropy pool automatically at intervals justifiable from best
	current cryptographic practice.

	In some quick tests, cprng_fast() is about the same speed as
	the old arc4randbytes(), and cprng_strong() is about 20% faster
	than rnd_extract_data().  Performance is expected to improve.

	The AES code in src/crypto/rijndael is no longer an optional
	kernel component, as it is required by cprng_strong, which is
	not an optional kernel component.

	The entropy pool output is subjected to the rngtest tests at
	startup time; if it fails, the system will reboot.  There is
	approximately a 3/10000 chance of a false positive from these
	tests.  Entropy pool _input_ from hardware random numbers is
	subjected to the rngtest tests at attach time, as well as the
	FIPS continuous-output test, to detect bad or stuck hardware
	RNGs; if any are detected, they are detached, but the system
	continues to run.

	A problem with rndctl(8) is fixed -- datastructures with
	pointers in arrays are no longer passed to userspace (this
	was not a security problem, but rather a major issue for
	compat32).  A new kernel will require a new rndctl.

	The sysctl kern.arandom() and kern.urandom() nodes are hooked
	up to the new generators, but the /dev/*random pseudodevices
	are not, yet.

	Manual pages for the new kernel interfaces are forthcoming.
2011-11-19 22:51:18 +00:00
christos d11ea3ea81 Obey MNT_RELATIME, the only addition is that mkdir in ufs sets IN_ACCESS too. 2011-11-18 21:18:50 +00:00
hannken 7c028d0f99 VOP_ABORTOP() has no specific lock requirements so there is no need
to force locked vnodes here.  It should be impossible to come here
with a nil upper node.

Relock the directory vnode after copyup.  A locked union node with an
unlocked upper vnode can no longer exist so make FIXUP() an assertion.
2011-11-14 18:42:57 +00:00
hannken 3e29235de5 Remove a needless vnode lock/unlock dance. This is a leftover from the
removal of VOP_LEASE().

Function union_removed_upper() always works on unlocked upper vnodes so
remove the test-and-unlock and add an assertion.
2011-11-14 18:38:13 +00:00
hannken d84a65dd80 VOP_OPEN() needs a locked vnode. All these copy-and-pasted xxxfs_mount()
implementations need more review.
2011-11-14 18:35:12 +00:00
christos 1058c21f81 use getdisksize() 2011-11-13 23:08:47 +00:00
christos 3cc8e640ed remove unused call to DIOCGPART that was only used for debugging.
malloc M_WAITOK, does not fail.
2011-11-13 23:07:11 +00:00
christos 05bbfb83a3 use getdisksize() 2011-11-13 23:03:55 +00:00
christos 3aa8e3d303 use getdisksize, M_ZERO, and malloc M_WAITOK doesn't fai. 2011-11-13 18:29:08 +00:00
dholland 0b69cddad2 Avoid panic on error path, from PR 45607. The error path is exercised
because this is using DIOCGPART to get the volume size, which doesn't
work on wedges. It should be calling getdisksize() instead.
2011-11-13 17:22:51 +00:00
hannken 405b01b248 Add a comment that pn_sizemtx should be useless as VOP_GETATTR now
needs a shared lock at least.
2011-10-30 13:24:13 +00:00
hannken 113be15313 VOP_GETATTR() needs a shared lock at least. 2011-10-23 08:42:06 +00:00
manu 399ad65db5 Remove #ifdef DIAGNOSTIC guards around KASSERT, as the macro contains them 2011-10-19 01:39:29 +00:00
hannken 7e4dd4325b VOP_GETATTR() needs a shared lock at least.
While here fix a typo (fvp -> tvp).
2011-10-18 20:20:29 +00:00
manu bd77be0ce7 Make sure pagedaemon does not sleep for memory in puffs_vnop_sleep.
Add KASSERT on any sleeping memory allocation to check it cannot happen again.
2011-10-18 15:39:09 +00:00
hannken 749d77682d VOP_GETATTR() needs a shared lock at least. 2011-10-18 09:22:53 +00:00
manu 7f182e39c1 Roll back the change that forced kernel threads to not sleep in PUFFS.
The change does not make consensus, since only pagedaemon should need it.
Other threads will tolerate sleeping, and problems here are only symptoms
that something is going wrong in memory management. The cause, not the
symptoms, need to be fixed.
2011-10-17 23:54:01 +00:00
hannken 2083e28d1f VOP_GETATTR() needs a shared lock at least.
While here fix a typo (fvp -> tvp).
2011-10-16 12:41:45 +00:00
hannken 34f54c83be As vnalloc() always allocates with PR_WAITOK there is no longer the need
to test its result for NULL.
2011-10-07 09:35:04 +00:00
christos 8b0d7f915b rename SMBFS_MAXFNAMELEN to SMBFS_MAXNAMLEN for consistency 2011-09-27 02:05:10 +00:00
christos d4bb8ac2b1 don't get affected by the NAME_MAX bump. Use the same constant as the
rest of the extrattr code.
2011-09-27 01:48:57 +00:00
christos 1e439c8185 define NILFS_MAXNAMLEN and use it. 2011-09-27 01:34:41 +00:00
christos 2fcd0204c6 return UDF_MAXNAMLEN instead of NAME_MAX 2011-09-27 01:33:30 +00:00
christos 367fc9326f return TMPFS_MAXNAMLEN instead of NAME_MAX 2011-09-27 01:32:21 +00:00
christos 5377c21fee use ISO_MAXNAMLEN instead of NAME_MAX 2011-09-27 01:27:44 +00:00
christos d30021427a use NAME_MAX instead of MAXNAMLEN 2011-09-27 01:14:47 +00:00
christos 3a8df9f090 - rename UDF_MAX_NAMELEN -> UDF_MAXNAMLEN
- use NAME_MAX instead of MAXNAMLEN
2011-09-27 01:13:16 +00:00
christos a00d98eb66 define and use TMPFS_MAXNAMLEN instead of MAXNAMLEN 2011-09-27 01:10:43 +00:00
christos 4fa49ab869 define and use ISO_MAXNAMLEN instead of MAXNAMLEN 2011-09-27 01:01:43 +00:00
manu 38de55a5dd Fix the build that was broken by struct lwp *updateproc reference in
RUMP-visible code. Instead of checking that updateproc (aka ioflush,
aka syncer) will not sleep in PUFFS code, I check for any kernel thread:
after all none of them are designed to hang awaiting for a remote filesystem
operation to complete.
2011-09-23 01:57:32 +00:00
manu da3795c23e Make sure ioflush does not sleep in PUFFS code path, waiting for a mutex,
a memory allocation, or a response from the filesystem.

This avoids deadlocks in the following situations:
1) when memory is low: ioflush waits the fileystem, the fielsystem waits
   for memory
2) when the filesystem does not respond (e.g.: network outage ona
   distributed filesystem)
2011-09-21 15:36:33 +00:00
christos 025e844498 don't update access/change times on open. 2011-09-16 18:43:44 +00:00
plunky 7f3d4048d7 NULL does not need a cast 2011-08-31 18:31:02 +00:00