Commit Graph

1244 Commits

Author SHA1 Message Date
hannken fff1c84c3d Msdosfs on-disk meta data is not sufficient to create or validate file handles.
Maintain a tree of file handles, create nodes from msdosfs_vptofh() and keep
them until either the file gets unlinked or the file system gets unmounted.

Fixes the msdosfs part of PR #43745 (fhopen of an unlinked file causes problems
on multiple file systems)
2011-04-04 19:16:58 +00:00
hannken 032b3dee5f Fix file handle operations for tmpfs by removing a now bogus test and
fixing the return value of tmpfs_fhtovp() in the not-found case.

When vmlocking2 was merged to head (Jan 2008 !!) the inode numbering was
changed.  Before inodes were numbered 2..tm_nodes_max-1 and after the
merge the numbers are derived from the nodes memory address.

Fixes PR #43605 (tmpfs file handles are broken)
2011-04-02 14:24:53 +00:00
hannken 5515232cfd Make zero length symlinks work on tmpfs.
Fixes PR #43843 (tmpfs dies with kassert panic for 0 length symlink target)
2011-04-01 17:40:54 +00:00
hannken b7bd248623 When truncating a file purge the fat cache after setting the new size
and after all io but before actually updating the cluster chain.

Both uvm_vnp_zerorange() and vtruncbuf() call get/putpages -> bmap -> pcbmap
and here the fat cache gets updated with information no longer valid after
truncation.
2011-03-22 20:33:51 +00:00
hannken fbf9a016fe When extending a file, either by truncating or by writing past EOF make
sure the unallocated remainder of the last page gets zeroed.

Detected by fsx.
2011-03-20 12:21:28 +00:00
hannken d8c44cec40 Remove a vnode reference leak from msdosfs_rename. Release tdvp if either
doscheckpath() or relookup() fails.

Adjust test fs/vfs/t_vnops.c and remove the link count test for msdos.

Fixes PR #44661
2011-03-19 20:05:21 +00:00
bouyer 063f96f3c2 merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
2011-03-06 17:08:10 +00:00
pooka cd8c039974 In rename, use char[12] for new names instead of [11]. At least
one routine called from here (unix2dosfn) expects and uses all of
a [12].

This may fix the "stack size exceeded" problem which has been
triggering in gson's test runs.  (i'm not entirely sure why it
doesn't trigger in anyone else's env)
2011-03-03 08:10:45 +00:00
christos b6ccfb3a6f simplify and avoid pointer gymnastics 2011-02-24 23:49:26 +00:00
christos aa30cd0dfb simplify and handle unaligned pointer access. 2011-02-24 23:48:59 +00:00
yamt 0741257326 puffs_msg_wait: check PARKFLAG_HASERROR before PARKFLAG_CALL. PR/44240. 2011-02-11 09:15:45 +00:00
christos 88453bd9e5 remove comments about needing to encode : since the on disk format does
not allow them. Also fix reversed encoding in lookup. From Taylor R Campbell.
2011-02-10 03:30:29 +00:00
christos 02c89a86f2 PR/44523: Taylor R Campbell: mount_hfs badly handles file names with slashes
in them, encode them as colons. XXX: Should encode : as :: too?
2011-02-10 01:49:51 +00:00
jakllsch f9880b2188 Make this build.
Also, the previous commit contanined "unintended" functional changes I'm
going to ignore.
2011-02-07 03:03:16 +00:00
christos 7b5e4e85d3 KNF, no functional changes intended. 2011-02-07 02:06:20 +00:00
njoly 7ca6722553 In sysvbfs_lookup(), deny last component write operation on a
read-only mount.
Fix PR/44302: sysvbfs allows unlink on fs mounted MNT_RDONLY.

Reviewed by pooka.
2011-01-31 18:48:50 +00:00
reinoud 9b7eade5c7 A not rewritable disc can be pseudo-overwritable. A pseudo-overwritable disc
can overwrite its logical volume integrity sequence so no need to make it
append-only for this class of discs.
2011-01-22 18:02:18 +00:00
reinoud b7716654f6 Lookup the physical partition backing up the logical one when searching for the
metadata partition overlap for BD-R.

Fixes a kernel panic on mounting a BD-R formatted with UDF 2.60
2011-01-22 14:51:43 +00:00
reinoud 9a9564f94d Split out the raw to indexed partitioning code protecting against roque
implementations that use `ramdom' numbers for the physical partitions breaking
lots of implementations. Known curlpit is MicroSoft Windows 7.

Not only the partition mappings need to be protected against this but also the metadata partition files.
2011-01-21 20:36:53 +00:00
reinoud 20846619eb Metadata partition (v2.50+) bugfix commit :
* fix copying of the extents of the metadata node to the metadatamirror node;
  it was not copying all extents.

* fix truncing metadata partition:
   * fix endian conversions
   * fix information length calculation so its truncated to the right length!

* allow for setting maximum extent length in extent merging. This is needed
  since extents in the metadata partition files are only to be in allocation
  unit sizes.

* adjust grow and shrink node to set the granularity of the maximum length of
  an extent when encountering a metadatafile or metadatamirror file.
2011-01-14 09:09:18 +00:00
pooka 07b10a7b73 Add some support for unionfs (not built by default). It's still
missing at least opaque directory support, but until someone figures
out how that should work on ffs (see PR kern/kern/44383), there's
no point in trying to figure out how it should work here.
2011-01-13 13:35:11 +00:00
reinoud 914876a617 Fix the case in where a file with a latin1 file name was created. It was then
erronously entered as thelatin1 file name in the dirhash whereas the matching
routing assumes both UTF-8. This would result in a file being created but not
stat-able since the dirhash couldn't find the entry unless it was remounted.
2011-01-13 13:13:31 +00:00
kefren 2f07b81209 add advlock to puffs. ok pooka@
should fix kern/43321
2011-01-11 14:04:54 +00:00
drochner bccb285ad5 destroy mutex/cv before freeing the struct holding them, fixes
LOCKDEBUG panic
2011-01-03 13:12:40 +00:00
dholland 13fc777536 Remove the special refcount behavior (adding an extra reference to the
parent dir) associated with SAVESTART in relookup().

Check all call sites to make sure that SAVESTART wasn't set while
calling relookup(); if it was, adjust the refcount behavior. Remove
related references to SAVESTART.

The only code that was reaching the extra ref was msdosfs_rename,
where the refcount behavior was already fairly broken and/or gross;
repair it.

Add a dummy 4th argument to relookup to make sure code that hasn't
been inspected won't compile. (This will go away next time the
relookup semantics change, which they will.)
2011-01-02 05:09:30 +00:00
hannken 53b57e3385 Extend the range of fstrans transactions to a sequence of vnode operations
on a locked vnode.  This leaves a suspended file system and therefore a
snapshot with either all or no operations of such a sequence done.
2010-12-27 18:49:42 +00:00
reinoud 0b639144a8 Running with DEBUG again revealed locking errors previously undetected. The
VAT writeout was done locked while marked locked as were the readin and
writeout of the metadata partition space table.

While here, also protect the (vp) argument of the UDF_SET_SYSTEMFILE() macro.

Tested on UDF 1.50 sequential, UDF 2.01 RW and UDF 2.50 metadata RW meda.
2010-12-22 12:38:42 +00:00
reinoud 3e8c574583 Growing the metadata partition is not yet implemented. Be so kind to report
this as unimplemented when the debug flag asks for it!
2010-12-22 12:15:02 +00:00
hannken 355e0e74e8 msdosfs_sync: check for dead vnode (denode == NULL) before testing denode flags. 2010-12-14 17:17:02 +00:00
dholland 14402d0ff1 Abolish the SAVENAME and HASBUF flags. There is now always a buffer,
so the path in a struct componentname is now always valid during VOP
calls.
2010-11-30 10:43:01 +00:00
dholland d4eb05390d Abolish struct componentname's cn_pnbuf. Use the path buffer in the
pathbuf object passed to namei as work space instead. (For now a pnbuf
pointer appears in struct nameidata, to support certain unclean things
that haven't been fixed yet, but it will be going away in the future.)

This removes the need for the SAVENAME and HASBUF namei flags.
2010-11-30 10:29:57 +00:00
dholland 8f6ed30d57 Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
2010-11-19 06:44:33 +00:00
pooka f129909f87 Apply patch from PR kern/44093 by yamt:
Interrupt server wait only on certain signals (same set at nfs -i)
instead of all signals.  According to the PR this helps with
"git clone" run on a puffs file system.
2010-11-15 20:31:41 +00:00
pooka a1a97722c2 Allow clients to reuse a "park".
Patch from <yamt>, fixes PR kern/44086 by him.
2010-11-12 17:46:09 +00:00
matt 19e6c76b2d Rename rb.h to rbtree.h, as it is more appropriate (c.f. ptree.h). Also
helps find code that hasn't been updated to use the new rbtree API.
2010-09-25 01:42:38 +00:00
rmind 879d5dfb5e Fixes/improvements to RB-tree implementation:
1. Fix inverted node order, so that negative value from comparison operator
   would represent lower (left) node, and positive - higher (right) node.
2. Add an argument (i.e. "context"), passed to comparison operators.
3. Change rb_tree_insert_node() to return a node - either inserted one or
   already existing one.
4. Amend the interface to manipulate the actual object, instead of the
   rb_node (in a similar way as Patricia-tree interface does).
5. Update all RB-tree users accordingly.

XXX: Perhaps rename rb.h to rbtree.h, since cleaning-up..

1-3 address the PR/43488 by Jeremy Huddleston.

Passes RB-tree regression tests.
Reviewed by: matt@, christos@
2010-09-24 22:51:50 +00:00
pgoyette 4973fb4e5e Remove extra char - not sure where that came from (duplicated vi command?)
I really need more caffeine.

Thanks pooka@ for noticing.
2010-08-11 13:26:25 +00:00
pgoyette 24d9c402d1 Keep condvar wmesg's within 8-char limit 2010-08-11 11:43:13 +00:00
mlelstv 2a392db81b Return EINVAL for rename and delete operations to the
root directory instead of the erroneous EROFS.
2010-07-30 16:40:43 +00:00
njoly 9cd958c424 Make sysvbfs rename work for filenames longer than {NAME_MAX}. 2010-07-26 13:43:26 +00:00
hannken 99afd136d0 It makes no sense to call vget() with LK_RETRY. 2010-07-25 09:54:37 +00:00
njoly feeade32b4 Remove bad cast, fix compilation with MSDOSFS_DEBUG. 2010-07-22 18:08:11 +00:00
hannken fb62bef947 Make holding v_interlock mandatory for callers of vget().
Announced some time ago on tech-kern.
2010-07-21 17:52:09 +00:00
hannken f457e09499 Lock the ntnode and recheck the fnode after calling getnewvnode().
Take v_interlock while the ntnode is locked.
2010-07-19 08:17:44 +00:00
njoly a1bce59b7f Fix build with SYSVBFS_VNOPS_DEBUG. 2010-07-17 00:13:42 +00:00
njoly c6aea3ff65 Small typo in comment. 2010-07-16 23:41:01 +00:00
hannken 438de34ae8 Always take the hash list lock before removing a node from the hash chain.
Release the hash list lock before calling getnewvnode() and check the
hash list again like other file systems do.

Take v_interlock before calling vget().
2010-07-16 08:23:28 +00:00
pooka b97a9a0af5 f_namemax is one of the static fields overridden by copy_statvfs_info(),
so be sure to set it to the value coming from the file server as
part of mount args.

exposed, like so many other problems, by njoly's tests
2010-07-15 21:55:05 +00:00
pooka 083df92b14 return same errno as ffs 2010-07-14 16:03:49 +00:00
pooka b79f37ef16 RENAME lookup semantics say return EISDIR if dvp = *vpp for the
last component .... obviously(!!)
2010-07-14 14:07:37 +00:00