Commit Graph

1244 Commits

Author SHA1 Message Date
reinoud 7b913c191b Make ecma167 header file compilable by pcc 2009-05-18 20:51:03 +00:00
pooka c94cfd7632 add some todo-items, based on a file which was lingering in my
local tree for apparently almost two years now
2009-05-18 15:47:28 +00:00
elad 863a01b5c1 Extract the open-coded authorization logic for chtimes() from various
file-systems and put it in a single function, genfs_can_chtimes().

This also makes UDF follow the same policy as all other file-systems.

Mailing list reference:

	http://mail-index.netbsd.org/tech-kern/2009/04/27/msg004951.html
2009-05-07 19:30:29 +00:00
elad 69db27dc69 Replace open-coded vaccess() in ntfs_access() with a call to vaccess().
Similarly to msdosfs, always add the exec bit to keep the current
behavior.

Mailing list reference:

    http://mail-index.netbsd.org/tech-kern/2009/04/21/msg004881.html
2009-04-29 22:33:33 +00:00
pooka 986e36ad6d replace outdated comment. no functional change 2009-04-29 11:01:50 +00:00
uch c519d37fde added error check. 2009-04-26 12:41:59 +00:00
elad f9642d24c5 Wrap some long lines in a comment, pointed out by ad@ - thanks!
While here, wrap two more long lines.
2009-04-25 21:26:20 +00:00
elad 54bf8cc67a Add genfs_can_mount() and use it to prevent some more code duplication of
the security checks when mounting a device (VOP_ACCESS() + kauth(9) call)).

Proposed with no objections on tech-kern@:

	http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004859.html

The vnode is always expected to be locked, so no locking is done outside
the file-system code.
2009-04-25 18:53:44 +00:00
elad 9670d2e41d Add genfs_can_mount() and use it to prevent some more code duplication of
the security checks when mounting a device (VOP_ACCESS() + kauth(9) call)).

Proposed with no objections on tech-kern@:

	http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004859.html

The vnode is always expected to be locked, so no locking is done outside
the file-system code.
2009-04-25 18:53:43 +00:00
elad f68b0219b0 Per discussion on tech-kern@:
- Replace use of label/goto with returns

  - Rename, change prototype of, and move functions from vfs_subr.c to
    genfs_vnops.c
2009-04-22 22:57:08 +00:00
reinoud 91d6e78060 Fix endian related bug when using discs with a meta-data partition on
big-endian machines.
2009-04-21 16:19:00 +00:00
elad b0745a039e Pass VREAD instead of FREAD to VOP_ACCESS().
Okay christos@.
2009-04-20 21:29:01 +00:00
elad 386808d4a0 Refactor some duplicated file-system code.
Proposed and received no objections on tech-kern@:

	http://mail-index.netbsd.org/tech-kern/2009/04/18/msg004843.html
2009-04-20 18:06:26 +00:00
tsutsui d779b85d3e Remove extra whitespace added by a stupid tool.
XXX: more in src/sys/arch
2009-04-18 14:58:02 +00:00
yamt c495a11d21 plug some pnbuf leaks. 2009-04-15 11:41:25 +00:00
markd 270aadb75a For chown make auth checks consistent with UFS. Fixes PR kern/40933. 2009-04-11 11:59:04 +00:00
perry e4c34b0c5f SAVENAME was not set for rename and delete as required
Patch from christos, fixes pr 41183
2009-04-11 00:21:57 +00:00
yamt 63d0089e0e - tmpfs_dir_lookup: simplify.
- add some assertions.
2009-04-10 03:40:05 +00:00
pooka 6d35065877 * create only one vnode per inode
* add locking
2009-04-09 09:56:30 +00:00
pooka 42ca2fba4f VOP_CLOSE in error branches 2009-04-09 07:55:55 +00:00
pooka f505490c8d Invariants should be tested for with KASSERT instead of semi-pretending
that them not holding is an acceptable error condition.
2009-04-05 15:10:41 +00:00
ad 4c75d20cd4 Turn up the volume on the warning message a bit and note that unionfs can
corrupt the underlying file system. This is an old problem but is now
much easier to trigger because VFS has gone fully multithreaded.
2009-04-04 10:32:49 +00:00
pooka bb78ae5d1b Fix yet another recent crashy bug in tmpfs rename: since the source
dirent is no longer cached in lookup and we do the lookup ourselves
in rename, we are most definitely not allowed to assert that it
matches the source vnode passed as an argument.  In case the source
node does not exist or has been replaced, punt with ENOENT.

Also, nuke some misleading prehistoric comments which haven't been
valid in over a year.

Fixes PR kern/41128 by Nicolas Joly
2009-04-03 14:47:40 +00:00
pooka 696e7eae87 fix botch in previous 2009-03-27 06:35:10 +00:00
pooka f75bcfdea3 pretend to do some sort of cleanup in error branches 2009-03-26 20:05:07 +00:00
reinoud b9f5db933c Fix possible overshoot when allocating from a space bitmap when ffs(3) returns
a too big offset for the bitmap.
2009-03-25 20:04:52 +00:00
haad 3914ae191c Destroy mutexes used to guard hash table during vfs_detach. Fixes LOCKDEBUG
panic when ptyfs module is unloaded.
2009-03-24 22:05:24 +00:00
christos 9114dc885f Fix old userland compat. 2009-03-21 01:11:53 +00:00
reinoud a3665ba58f Fix panic due to memory leak on symlink creation. A test copy with 3000+
symlinks could get the machine down.
2009-03-20 23:06:52 +00:00
pooka 5ac2257698 Release dvp in mknod error branch.
Nicolas Joly, PR kern/41006
2009-03-19 13:47:32 +00:00
cegger e2cb85904d bcopy -> memcpy 2009-03-18 17:06:41 +00:00
cegger c363a9cb62 bzero -> memset 2009-03-18 16:00:08 +00:00
cegger 35fb64746b bcmp -> memcmp 2009-03-18 15:14:29 +00:00
cegger df7f595ecd Ansify function definitions w/o arguments. Generated with sed. 2009-03-18 10:22:21 +00:00
cegger 164477c65a ansify function definitions 2009-03-15 22:16:09 +00:00
cegger b8817e4aed ansify function definitions 2009-03-15 17:14:40 +00:00
christos 3cb697e64a Add a chroot flag, so that ptyfs can be mounted in a chrooted environment.
XXX: This is a hack, in reality we should allow multiple ptyfs mounts.
2009-03-15 16:43:55 +00:00
dsl 82357f6d42 ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
2009-03-14 21:04:01 +00:00
dsl 454af1c0e8 Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
2009-03-14 15:35:58 +00:00
dsl 02cdf4d2c8 Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
2009-03-14 14:45:51 +00:00
yamt b9a7e1db53 udf_write_filebuf: remove an write-only variable 2009-02-22 15:26:51 +00:00
reinoud 193ccd2d90 Improve write throttling by doing it on page-size basis. The `standard'
solution would cut up files unnessisary during allocation. It also made
assumptions about ucb wich were propably right but still.
2009-02-11 13:08:08 +00:00
reinoud 78466aa1e7 Add simplistic UBC async flushing as other FS's seem to do. Its a clutch and
needs to be addressed in UBC properly.
2009-02-10 21:24:27 +00:00
reinoud afd8cb8795 Remove dead code and double check if its allowed to write out non-sequential
there.
2009-02-10 17:49:02 +00:00
reinoud a02b732e06 Sequential writing goes before normal write. Its not likely to ever go wrong
but there could be a race otherwise.
2009-02-10 17:48:19 +00:00
reinoud 9609b0ed76 Implement session closure on sequential media when requested on mount. It will
allow CD-ROM/DVD-ROM/DB-ROM drives to read the media while still allowing them
to be appended later. It can also be seen as a way to make mountable
snapshots.
2009-02-08 19:14:52 +00:00
reinoud 2ac9ba8c48 If mounting for read-write dont allow a session number to be specified since
its currently still misbehaving. If supported later, it would allow one or a
series of sessions on a sequential recordable media to be ignored as if they
never were created.

Also fix a small comment: its not the direct but the bootstrap disc strategy
that we close down.
2009-02-08 19:04:41 +00:00
pooka 4c7be59b17 If fdvp is tvp, do nothing. Prevents local DoS panic described in
PR kern/38219... maybe.  This is hastily concocted fix for 5.0 and
I'm not sure if it has side-effects.
2009-02-07 19:42:57 +00:00
pooka 6b5b1701a9 Specify BROKEN DIRECTORY ENTRY printf comes from udf
(can happen e.g. with medium error)
2009-02-05 19:39:08 +00:00
abs d82fca09e4 Remove additional GEMDOS only check on fstype, and update comment 2009-02-05 18:39:15 +00:00
jmcneill a85de6510e From FreeBSD, 10 years ago;
Now empty DOS filesystems default to long file names. Non-empty filesystems
without traces of Win95 default to short file names, as before.
2009-01-23 12:46:23 +00:00
cegger 636f235e0d buildfix: re-adapt for major/minor returning 32bit value again. 2009-01-22 16:05:03 +00:00
yamt 70de973662 g/c BUFQ_FOO() macros and use bufq_foo() directly. 2009-01-13 13:33:58 +00:00
pooka 76e97947f5 Bump interface version number for the time_t/dev_t changes. 2009-01-12 18:48:35 +00:00
cegger e6e72079ad make this compile 2009-01-11 10:25:29 +00:00
cegger 08ebead94e make this compile 2009-01-11 09:51:38 +00:00
christos 461a86f9bd merge christos-time_t 2009-01-11 02:45:45 +00:00
jmcneill 4fcf0eb13c Remove pm_Heads check in msdosfs_mountfs; this value isn't really used,
FreeBSD and OpenBSD both removed this check years ago, and this makes an
8GB Memory Stick Pro Duo formatted with a PSP work.
2008-12-26 03:38:52 +00:00
cegger dcf705893e use M_ZERO on malloc() and remove subsequent bzero(). 2008-12-19 18:49:37 +00:00
reinoud f4d0142196 Implement auto-track repair on tracks marked damaged when searching for
writable tracks on session opening. Note that this an optionally implemented
feature and thus no error will be generated if it fails; the drive will most
likely autorepair it.
2008-12-18 15:41:44 +00:00
reinoud e2d4b2a7ea Fix critital panic when mounting a CD-R/DVD*R disc. The check for VV_ROOT was
not done correctly and could panic when requested to load a VAT descriptor
since the fileset was not yet fetched.
2008-12-18 13:03:49 +00:00
cegger 9b87d582bd kill MALLOC and FREE macros. 2008-12-17 20:51:31 +00:00
christos 9a5d3f2817 replace bitmask_snprintf(9) with snprintb(3) 2008-12-16 22:35:21 +00:00
reinoud 62c3c2d194 Check for a node being root on node creation so when the root node is disposed
of when working deep into the directory tree it can reliably be reget and
marked correctly as the FS root.

Fixed pwd(1) lock panic and possible endless loop in other tools.
2008-12-16 16:27:05 +00:00
pooka 81723cc93e The great QUOTA purge of '08: get rid of those #ifdef QUOTA and
#include "opt_quota.h" which do exactly nothing.  Speeds up kernel
compilation by 1.375*10^-20001 seconds.  But leave the most moxious
comment in msdosfs_vfsops untouched.
2008-12-16 16:18:25 +00:00
reinoud 0be5b3fe22 Fix endless loop occuring on empty directories listing on 512 bytes/sector
media like harddiscs. Also provide provide a `safety net' on readdir so it
will signal EOF when its requested an entry outside the directory.
2008-12-16 14:28:34 +00:00
reinoud 42dbf4bb33 Elaborate SYNC debug messages and rename some debug messages to a more
proper category.
2008-12-16 10:30:19 +00:00
reinoud cadb068686 Fix two buf_init()'s that are not needed since they were already initialised
by getiobuf().

Also remove ancient IPL_BIO reference from the time it was called from
interrupt context instead of the current soft interrupt.
2008-12-09 17:17:02 +00:00
reinoud ab146a4768 UDF_SHED_FREE state is now also handled by the state machine, so DO signal it.
Free'd up ecclines can now far more quicker be recycled.
2008-12-06 14:02:08 +00:00
reinoud 9b08c3c516 Two fold commit:
1) Enhance write speed significantly on RMW media like CD-RW, DVD-RW but also
on the DVD+RW and all other ECC blocked media. Significant speedups of access
to the device for say compilation on the DVD. Streaming copy is also still at
maximum speed though vast amounts of directory copy work can show side effects
that appear it to slow down but are actually logical when you consider that
most small files are embedded into the descriptors itself.

2) explicit wait for the created RMW thread to spinup
2008-12-05 13:19:42 +00:00
ad 49e50a21d6 PR kern/40110: null, overlay and umap modules loading -> panic (layerfs symbols not there)
Add a layerfs module.
2008-12-05 13:05:37 +00:00
pooka 1f2f77b6f8 Add specfs/fifofs support. Not really fully tested, but at least
vfs routines don't crash now.
(didn't have an image with matching device node numbers)

fixes PR kern/40055 by myself
2008-12-01 14:34:50 +00:00
reinoud 4b1a812950 Split uid/gid remapping code to be independent of eachother. 2008-12-01 14:19:01 +00:00
reinoud df11d3f1f5 Allow for the exclusive selection of `direct' for rdonly mounts; its disabled
for now since its a lot slower than `rmw' access.

For archs that have trouble with `rmw' for whatever reason can so use it as a
scapegoat to allways mount savely rdonly though slower.
2008-11-28 15:29:47 +00:00
reinoud 273d4a49cd Remove old comment and remove unused calculated variable 2008-11-28 14:33:36 +00:00
pooka 989608d6b7 Tyop: v -> vp. Spotted by Tom's ARM builds. 2008-11-28 10:57:03 +00:00
pooka b4099c3e1d Rototill all remaining file systems to use ubc_uiomove() instead
of the ubc_alloc() - uiomove() - ubc_release() dance.
2008-11-26 20:17:33 +00:00
pooka 010ce4930e more <sys/buf.h> police 2008-11-16 19:34:29 +00:00
reinoud a597e786dd Specify blobsize as the `pagingsize' of the eccline blob pool. This will relax
the requirements of the pagingsize.
2008-11-15 18:26:50 +00:00
pooka 39beb124fd In case writing past EOF, fail if extending the file fails (most
likely due to the file system being full).

Otherwise we'd fail in VOP_PUTPAGES(), which might not happen during
VOP_WRITE(), thus giving the caller the wrong impression that
writing was succesful.
2008-11-14 12:59:44 +00:00
reinoud 69f1577429 Introduce an extra state to wich all pushed ecclines are pushed on. This
extra state has a holding time in wich no writeouts will be done
effectively collecting more sectors before its even sheduled for writing.
2008-11-01 23:51:25 +00:00
reinoud e9d599f49d Explicitly set buffer's block numbers. Blocks were always read/written
correctly only the sheduling could go less than optimal.
2008-11-01 19:50:32 +00:00
reinoud 3e0547f2dd Fix to prevent a closed sequential media to be opened for read/write. 2008-10-29 18:09:47 +00:00
joerg f1481725b6 Remove logic to compute relative pathes to chroots. It breaks the
default case of ptyfs mounted under /dev/pts as any chroot would get
/%d as slave names. This allows null mounts of ptyfs to work.
To allow pty allocation from within chroots, either no ptyfs must be
mounted or a null mount exist.
2008-10-26 23:06:41 +00:00
reinoud 1bd1646ad6 Switch UDF over to the vfs_dirhash.c dirhash code. 2008-09-27 13:05:34 +00:00
ad 43f2119341 PR kern/39307 (mfs will sometimes panic at umount time)
Change dounmount() so that it never drops the caller provided reference.
Garbage collecting 'struct mount' is up to the caller.
2008-09-25 14:17:29 +00:00
ad 25b04084c4 Don't assign vnode::v_mount. getnewvnode() does it. 2008-09-24 09:37:13 +00:00
christos 9380d4efdb replace 0xa0 with space from Andy Shevchenko 2008-09-10 19:25:33 +00:00
tron 7c4ff5fbb4 Remove duplicate definition of "smbfs_node_pool".
Fix based on a patch provided by Juan RP in PR kern/39494.
2008-09-07 13:13:04 +00:00
pooka 811ee024bf Actually, use FWRITE for device open only if we aren't doing MNT_RDONLY.
This still allows to mount read-only images with -o ro.
2008-09-04 12:28:14 +00:00
pooka 9e37085d2e Install sysvbfs argument structure header into userlandia. 2008-09-04 12:07:29 +00:00
pooka 4e73c87bfa Open devvp for both reading and writing. 2008-09-04 12:02:10 +00:00
gmcgarry 36a81a3bed Don't use unnamed structures. 2008-09-03 22:57:46 +00:00
gmcgarry a5659ecaae Hack around zero vararg macro list on PCC. 2008-09-03 22:56:51 +00:00
reinoud 627e960617 Back out dirhash kernel module for now. 2008-08-30 10:49:27 +00:00
reinoud c25ced8779 Remove all remaining traces of UDF_READWRITE since it has been removed as
option.
2008-08-29 15:04:18 +00:00
reinoud d9f39b2f6d Remove spurious old header file dependency that slipped trough. 2008-08-29 14:54:54 +00:00
reinoud 0a5ad4e15d Add dirhash kernel module for sharing dirhashing support with other FS
other than UDF. Its FS agnostic and could be used for any FS

Note to self: manpage needs to follow.
2008-08-29 14:20:25 +00:00
reinoud 17f11577de forgot to destroy an additional mutex and an condition variable. 2008-08-29 13:55:45 +00:00
reinoud b887c39003 Remove the need for the kernel option UDF_READWRITE to be able to write to
discs since writing is mature enough.
2008-08-08 18:25:56 +00:00
reinoud c3d5fdb471 Don't panic on read-errors but set flag that the packet is doomed. Its not
clear if i could read the individual sectors correctly since the entire
read packet is also one big ECC block.
2008-08-07 15:54:12 +00:00
reinoud a287d23dee Rewrite allocation scheme's determination and implementation replacing the
old somewhat naive selection scheme that didn't allow different allocation
settings for nodes, directory information (FIDs) and data.

Also fix some curious side-effects of atime updates on RMW devices.
2008-08-06 13:41:12 +00:00
reinoud 5e89a5a8f1 Fixup important bug in internal recorded data fixup. Although most unlikely
it could result in theory result in descriptor trashing.

On the performance side, it would try to fixup *every* descriptor even if
it wasn't an internally allocated one. Performance loss wasn't that big but
every bit helps.
2008-08-05 19:29:54 +00:00
reinoud 17cb09d3ee Remove comments on `need to read in'; they are read in. 2008-07-29 10:08:16 +00:00
pooka f00b7c9b12 Solve the fstat-wants-to-look-at-kernel-data-structures in a nicer
way: don't export the fs internals to innocent userspace programs
which just want to mount the file system.
2008-07-29 09:10:09 +00:00
reinoud 71c9aa3395 Streamline allocation to prepare it for metadata partition. Also add
preliminary Metadata partition write support but its disabled still since
its not finished yet and not functioning correctly. All other formats are
checked and should work fine.
2008-07-28 19:41:13 +00:00
pooka 966308f7e8 shuffle around some more defs for fstat
noticed by Kurt Schreiner on current-users
2008-07-28 18:00:20 +00:00
pooka 97f4be43e9 Install mount argument structure header just like every other file system. 2008-07-28 12:42:12 +00:00
reinoud 7ac1927ba2 Delay physical partition spacebitmaps from volume-descriptor-checking until
the other supporting structures are read in.
2008-07-27 11:38:23 +00:00
reinoud 5c3627bcdf Unify naming scheme and source code beautify for better readablility. 2008-07-27 11:21:21 +00:00
reinoud 4e0493c8f8 Forgot to rename those two references to write_space_bitmap too. 2008-07-26 20:52:04 +00:00
reinoud 8f7887a864 Clarify the current spacemap read/write code is reading/writing physical
partition space maps. This in preperation of Metadata spacetable
reading/writeout work.
2008-07-26 20:49:33 +00:00
reinoud 3653a53255 Clarify not implemented allocation schemes; mostly UDF 2.50
HD-DVD/BluRay-RE and UDF 2.60 for BluRay-R
2008-07-26 20:33:36 +00:00
reinoud 0dca08adcb Add metadata bitmap ICB file type 2008-07-25 15:37:56 +00:00
reinoud 5b49df17d8 No use walking empty hashtables when purging. 2008-07-22 21:39:08 +00:00
reinoud ff7ad972a5 Limit the UDF dirhash to a configurable amount of memory. The performance
penalty even with a limited dirhash of 128kb is acceptable but it should be
set by machine memory size though.
2008-07-22 19:06:55 +00:00
reinoud 3efc85e77e Limit sectorsize to max. 4096 bytes. This prevents a panic when declaring
the node pool since standard pools are limited upto 4096 aparently.
Pagesize limit even?
2008-07-19 16:36:40 +00:00
reinoud aa9f26d0bd Use the allocation descriptor types selected on mount when growing from an
internal to an extent recording.
2008-07-19 16:23:09 +00:00
reinoud a2718fb081 Use ecma-167 constants instead of homegrown to prevent double mapping. 2008-07-19 16:14:09 +00:00
reinoud a1f7916969 Choose which time of allocation descriptors to use on new nodes based on
the number of partition mappings.
2008-07-19 16:00:35 +00:00
reinoud a48555c3a3 Hopefully fix gcc type puned warning. 2008-07-18 16:21:12 +00:00
reinoud e7c5eefcfb fix comment 2008-07-18 15:55:32 +00:00
reinoud 5f233d9346 On dirhash lookup, don't retrieve info you already have. 2008-07-18 14:18:51 +00:00
reinoud f0040136a6 Remove double check 2008-07-18 13:39:41 +00:00
reinoud 43188548d8 First retrieve length and hash values *before* advancing to the next entry.
On hashline collision it would check a random one next.
2008-07-18 13:34:05 +00:00
reinoud aa9cb3deaa Instead of bombing out when trying to mount a disc RW when UDF_READWRITE is
not defined, downgrade it to a read-only mount.
2008-07-18 12:45:08 +00:00
reinoud 2ac28d554b Implement directory hashing to speed up directory traversals. Speed
improvements of at least 4 times in untarring and roughly 100 to 500 times
on file creation in big directories. Lookup of files was O(n*n) and is now
O(1) even for file creation. Free spaces in the directory are kept in a
seperate list for fast file creation.

The postmark benchmark gives:

UDF old:
pm>set transactions 2000
pm>set number 3000
pm>run
Creating files...Done
Performing transactions..........Done
Deleting files...Done
Time:
        1593 seconds total
        681 seconds of transactions (2 per second)

Files:
        3956 created (2 per second)
                Creation alone: 3000 files (4 per second)
                Mixed with transactions: 956 files (1 per second)
        990 read (1 per second)
        1010 appended (1 per second)
        3956 deleted (2 per second)
                Deletion alone: 2912 files (9 per second)
                Mixed with transactions: 1044 files (1 per second)

Data:
        5.26 megabytes read (3.38 kilobytes per second)
        21.93 megabytes written (14.10 kilobytes per second)
pm>



UDF new:
pm>set transactions 2000
pm>set number 3000
pm>run
Creating files...Done
Performing transactions..........Done
Deleting files...Done
Time:
        19 seconds total
        3 seconds of transactions (666 per second)

Files:
        3956 created (208 per second)
                Creation alone: 3000 files (230 per second)
                Mixed with transactions: 956 files (318 per second)
        990 read (330 per second)
        1010 appended (336 per second)
        3956 deleted (208 per second)
                Deletion alone: 2912 files (970 per second)
                Mixed with transactions: 1044 files (348 per second)

Data:
        5.26 megabytes read (283.66 kilobytes per second)
        21.93 megabytes written (1.15 megabytes per second)
2008-07-17 19:10:22 +00:00
reinoud 441bae21b1 Dont round up nanosecond count; if its nearing wrap one could get a count
of >1 second resulting in invalid time stamps on disc.
2008-07-17 15:37:59 +00:00
reinoud 31a383903d Since the rename logic now locks its source directory too, we ought to
unlock the source directory again on exit. The stub that doesn't allow
cross directory renames for now jumped to the wrong exit point and thus
left a locked directory node that paniced on next locking.
2008-07-17 11:00:29 +00:00
reinoud d61a135a38 Make UDF allocation-sanity check optional even if the DEBUG flag is
specified. This should be sysctl-able when compiled with the DEBUG flag
eventually.
2008-07-16 09:36:08 +00:00
reinoud e4424d53b1 Keep the directory to read '..' from locked until its dirent is read and
its location is extracted.

Also lock the source directory so its contents can safely be changed...
patch from tmpfs.
2008-07-15 15:49:05 +00:00
reinoud b62b494f22 Fix spelling in comment 2008-07-11 15:16:53 +00:00
reinoud 4503919107 Fix chtimes permission checking. This sanitised version is hopefully DTRT. 2008-07-10 17:38:31 +00:00
reinoud cb6e2404af On node creation, follow tmpfs and UFS by generating the uid/gid pair. This
fixes the lack of file ownership preservation on file/directory creation.

See PR kern/39124
2008-07-10 16:41:00 +00:00
reinoud 0381f71bf3 Allow the renaming of directories *within* their current directory. No
cross-directory renaming is allowed yet.
2008-07-10 15:29:51 +00:00
reinoud e3eced36a8 Clarifying comments 2008-07-10 14:16:02 +00:00
reinoud e367a2e837 Force allocation extent descriptor CRC length to 8 for UDF versions prior
to version 2.01.
2008-07-09 18:10:57 +00:00
reinoud 4d5c88faa5 Support for allocation extents descriptor writing to allow for arbitrary
heavily fragmented files.

Also fixing some (rare) allocation bugs and function name streamlining.

Tested on harddisc, CD-RW and CD-R i.e. all three basic backend classes.
2008-07-07 18:45:26 +00:00
reinoud ef780ea2df Add node-rebuild flag to indicate that the node was rebuild up and thus the
allocation extents have changed.
2008-07-03 19:29:42 +00:00
reinoud 2cd20af057 Create new udf_verbose class. 2008-07-03 18:03:22 +00:00
reinoud d3bf9c7bba Fix rare allocation problem when a fragmented file is truncated to a
non-zero length and the last extent was allocated.
2008-07-03 18:03:01 +00:00
reinoud 0687ceb21e Avoid panic when trying to mount a non existent block device like a
/dev/vnd0 that is not configured.
2008-07-03 18:01:08 +00:00
reinoud 5eeb4f695a Update node sanity check system and redo allocation recording fixing
corruptions that could take place when overwriting sparse files.

Still one rare corruption possible where blocks are accidentally marked
free, but the cause is not yet found and looking at the pattern it won't
happen in every day use.
2008-07-02 13:25:33 +00:00
reinoud af39897a83 Fix serious allocation recording bug if overwriting piece that was
allocated before. Fixes regression test on random overwriting data.

Also fix endian issues and add extra documentation to variables.
2008-06-30 16:43:13 +00:00
perry 10cfc49bff __FUNCTION__ -> __func__ 2008-06-30 00:46:41 +00:00
rumble f0fae83846 In smbfs_done, do not call pool_destroy on the same pool twice in a row.
Now smbfs.kmod can be unloaded without panicking the system.
2008-06-29 18:45:20 +00:00
reinoud 14d24a6772 When shrinking the file, do clean the freed part in the descriptor; all
unused space need to be zero filled.
2008-06-28 14:47:11 +00:00
rumble 28f5ebd853 Create sysctl entries during module initialisation and destroy them
appropriately.

Many of these file systems are now ready for modularisation.
2008-06-28 01:34:05 +00:00
reinoud d769966488 Count the length correctly when encountering an allocation extension
redirect in the sanity checking.
2008-06-26 13:28:45 +00:00
reinoud 93d7f858ba Disable read/write mounting for metadatapartition since attempts to delete
files now corrupt the image due to the lack of allocation scheme support.
2008-06-25 16:06:29 +00:00
reinoud 30c78783eb Allow metadata partitioned discs to be mounted read-write even though its
allocation scheme is not implemented yet. Creating new files or deleting
anything is thus not possible.
2008-06-25 15:59:24 +00:00
reinoud ca7a0d4ebd Fix lookup problems in very fragmented metadata partitions that use
allocation extent descriptors.
2008-06-25 15:28:29 +00:00
reinoud 7536094ea3 Bump maximum number of allocation extents descriptors in a file/directory;
10 did seem far too many, but aparently ``640 kb should be enough for
everyone''.
2008-06-25 15:27:14 +00:00
reinoud e5ee834164 Fix extended allocation descriptor handling in translate file extent 2008-06-25 10:46:35 +00:00
reinoud 35d8dddabd Fix allocation extensions descriptor reading and do free them on node
destruction!
2008-06-25 10:03:14 +00:00
cegger dfd2a09df6 make this build with SMB_VNODE_DEBUG. makes i386 ALL kernel build again. 2008-06-24 17:04:11 +00:00
reinoud 06993e5f51 Make readsymlink bug-tolerant to MacOS X symlink construction bug. It puts
the name ".." on a parent path component. To prevent other similar errors,
name length checking is not done but the passed name that shouldn't be
passed is ignored.
2008-06-24 15:57:13 +00:00
reinoud dc6314f8ae We are not allowed zero length names in softlinks. 2008-06-24 15:42:07 +00:00
reinoud a88cc8528f Support the creation of extended attributes for file creation in the
kernel and check and update them when found.

Note that it won't *insert* an extended attribute yet if it hasn't found it
while updating the birthtime.
2008-06-24 15:35:57 +00:00
reinoud 31c0e74b8e If we're fixing up the internal attributes, is it then wise to check if
they are valid first? Might be on the safe side in the end but disabled for
now.
2008-06-24 15:32:52 +00:00
reinoud 826b10cc95 Fix attribute length calculation and fix naming convention. 2008-06-24 15:30:33 +00:00
gmcgarry 92d3d70827 Remove gcc extension of variadic macros with comma elimination. 2008-06-24 10:23:48 +00:00
reinoud 6eab4517fa Elaborate file times extension times definition. 2008-06-21 00:12:09 +00:00
skd 4537375ada add NULL arg so it will compile. 2008-06-20 00:07:47 +00:00
skd 8ec4d769f6 add arg so it will compile. 2008-06-19 23:57:22 +00:00
christos 13a3f67856 - setting the birthdate is valid in setattr.
- don't call nanotime if not needed.
- don't call tempfs_update() if tempfs_chtimes succeeded, because it just did.
2008-06-19 19:03:44 +00:00
reinoud 9d15fe5137 Cleanup file access,modification,attribute and birthtime setting of files
and make the modification time when set never older than the creation time.
2008-06-18 21:23:32 +00:00
reinoud a61f3416a6 Change comments on marking buffer busy. 2008-06-17 14:14:05 +00:00
reinoud 09dda43103 Remove bogus KASSERT(); if we shrink the file, the number of allocated
blocsk are of course not the same... duh!
2008-05-20 21:31:52 +00:00
jmcneill e9336f3218 Add module dependency on putter. 2008-05-20 14:19:18 +00:00
christos b423ea8c48 fix argument type. 2008-05-19 23:48:04 +00:00
reinoud 8902baa622 Implement wide char support for UDF by properly implementing unicode-16 to
UTF-8 like cd9660 and ntfs already do.
2008-05-19 20:12:36 +00:00
ad a0fd5bc68d Until these get fixed or replaced:
WARNING: the foo file system is experimental and may be unstable
2008-05-18 13:56:12 +00:00
reinoud f6082a17d0 Cleaner gcc initialisation detection failure notice. 2008-05-17 08:07:21 +00:00
reinoud 2e63f0acb5 Fix `uninitialised variable' warning issued by the sh3 compiler. gcc can't
detect that the `last_node' variable will be set before used since it can't
parse the semantics of `TAILQ_EMPTY()' that is used as a guard first.

Thanks for H?rvard for finding and reporting it :)
2008-05-17 07:46:35 +00:00
hannken 5d2bff060a Make sure all cached buffers with valid, not yet written data have been
run through copy-on-write.  Call fscow_run() with valid data where possible.

The LP_UFSCOW hack is no longer needed to protect ffs_copyonwrite() against
endless recursion.

- Add a flag B_MODIFY to bread(), breada() and breadn().  If set the caller
  intends to modify the buffer returned.

- Always run copy-on-write on buffers returned from ffs_balloc().

- Add new function ffs_getblk() that gets a buffer, assigns a new blkno,
  may clear the buffer and runs copy-on-write.  Process possible errors
  from getblk() or fscow_run().  Part of PR kern/38664.

Welcome to 4.99.63

Reviewed by: YAMAMOTO Takashi <yamt@netbsd.org>
2008-05-16 09:21:59 +00:00
reinoud 69e96f0544 Introduce new UDF debug class and split rmw strategy debugging prints. 2008-05-15 14:22:40 +00:00
reinoud 1ff90d64ad Add accidently removed lines when i pruned the code for release. Important
update.
2008-05-15 10:57:40 +00:00
reinoud e979c658c9 Import writing part of the UDF file system making optical media like CD's
and DVD's behave like floppy discs. Writing is supported upto and including
version 2.01; version 2.50 and 2.60 will follow.

Also extending the UDF implementation to support symbolic links and
hardlinks.

Added are the mmcformat(8) tool to format rewritable CD/DVD discs and
newfs_udf(8).

Limitations:
        all operations can be performed on the file system though the
        sheduling is currently optimised for archiving workloads.

        mv(1)/rename(2) is currently only implemented for non-directories.
2008-05-14 16:49:47 +00:00
simonb 2fd5130380 mnt_data is a pointer, set it to NULL not 0 when we're finished with it. 2008-05-13 08:31:12 +00:00
simonb 03a48736d2 Use the correct malloc type when free()ing the ptyfs mount structure.
Fixes the "free 2: inuse 0, probable double free" panic when using ptyfs
and KMEMSTATS.
2008-05-13 05:36:43 +00:00
rumble a1221b6d4a Convert file systems to dynamically attach with the new module interface.
Make VFS hooks dynamic while we're here and say farewell to VFS_ATTACH and
VFS_HOOKS_ATTACH linksets.

As a consequence, most of the file systems can now be loaded as new style
modules.

Quick sanity check by ad@.
2008-05-10 02:26:09 +00:00
ad 42d0626726 PR kern/38141 lookup/vfs_busy acquire rwlock recursively
Simplify the mount locking. Remove all the crud to deal with recursion on
the mount lock, and crud to deal with unmount as another weirdo lock.

Hopefully this will once and for all fix the deadlocks with this. With this
commit there are two locks on each mount:

- krwlock_t mnt_unmounting. This is used to prevent unmount across critical
  sections like getnewvnode(). It's only ever read locked with rw_tryenter(),
  and is only ever write locked in dounmount(). A write hold can't be taken
  on this lock if the current LWP could hold a vnode lock.

- kmutex_t mnt_updating. This is taken by threads updating the mount, for
  example when going r/o -> r/w, and is only present to serialize updates.
  In order to take this lock, a read hold must first be taken on
  mnt_unmounting, and the two need to be held across the operation.

One effect of this change: previously if an unmount failed, we would make a
half hearted attempt to back out of it gracefully, but that was unlikely to
work in a lot of cases. Now while an unmount that will be aborted is in
progress, new file operations within the mount will fail instead of being
delayed. That is unlikely to be a problem though, because if the admin
requests unmount of a file system then s(he) has made a decision to deny
access to the resource.
2008-05-06 18:43:44 +00:00
ad ed8a08bae0 PR kern/37950 Unmounting psshfs immediately panics the machine
puffs_getvnode() was inserting vnodes into mnt_vnodelist without taking
a reference to the mount for each. When vnodes are scrubbed, refs to the
vnodes mount structure are dropped => boom.
2008-05-06 12:33:16 +00:00
ad e071d39c84 - Convert hashinit() to use kmem_alloc(). The hash tables can be large
and it's better to not have them in kmem_map.
- Convert a couple of minor items along the way to kmem_alloc().
- Fix some memory leaks.
2008-05-05 17:11:16 +00:00
ad dae796ef8b Convert cd9660 to attach as a module. 2008-05-03 15:57:41 +00:00
ad 1498ad220e Make various bits of debug code compile again. 2008-04-30 14:07:13 +00:00
ad 928a6b2096 PR kern/38135 vfs_busy/vfs_trybusy confusion
The previous fix worked, but it opened a window where mounts could have
disappeared from mountlist while the caller was traversing it using
vfs_trybusy(). Fix that.
2008-04-30 12:49:16 +00:00
ad e3610f1886 kern/38135 vfs_busy/vfs_trybusy confusion
The symptom was that sometimes file systems would occasionally not appear
in output from 'df' or 'mount' if the system was busy. Resolution:

- Make mount locks work somewhat like vm_map locks.
- vfs_trybusy() now only fails if the mount is gone, or if someone is
  unmounting the file system. Simple contention on mnt_lock doesn't
  cause it to fail.
- vfs_busy() will wait even if the file system is being unmounted.
2008-04-29 23:51:04 +00:00
ad baa3395f8f PR kern/38057 ffs makes assuptions about devvp file system
PR kern/33406 softdeps get stuck in endless loop

Introduce VFS_FSYNC() and call it when syncing a block device, if it
has a mounted file system.
2008-04-29 18:18:08 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
ad 6d70f903e6 Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
  be sent from a hardware interrupt handler. Signal activity must be
  deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
  and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
2008-04-24 15:35:27 +00:00
ad a9ca7a3734 Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
2008-03-21 21:54:58 +00:00
rmind c6186face4 Welcome to 4.99.55:
- Add a lot of missing selinit() and seldestroy() calls.

- Merge selwakeup() and selnotify() calls into a single selnotify().

- Add an additional 'events' argument to selnotify() call.  It will
  indicate which event (POLL_IN, POLL_OUT, etc) happen.  If unknown,
  zero may be used.

Note: please pass appropriate value of 'events' where possible.
Proposed on: <tech-kern>
2008-03-01 14:16:49 +00:00
matt 9a1bbaab37 Convert to ansi definitions from old-style definitons. 2008-02-27 19:59:48 +00:00
matt 8014191a2e Convert to ansi definitions from old-style definitons. 2008-02-27 19:43:36 +00:00
ad 1a710239b8 A port of FreeBSD's updated unionfs. This is a work in progress. In
particular, unionfs_lookup() needs a lot of attention.
2008-02-18 16:44:22 +00:00
dholland 81117ea33b Restore a fragment of a comment that apparently got lost in a merge slipup
in 1998.
2008-02-09 17:49:39 +00:00
jmmv 5a8838cb59 u_int is not a C99 standard type, so spell it out completely as
unsigned int.
2008-02-06 11:23:53 +00:00
jmmv 565f731b68 Drop trailing whitespace. 2008-02-06 11:22:12 +00:00
ad 648f07789f Do genfs_node_init() earlier. PR kern/36162. 2008-02-05 15:18:36 +00:00
ad 1eba00507a Limit kva usage to 8TB and the number of inodes to 2G. Should fix
PR kern/37951.
2008-02-05 15:02:45 +00:00
ad 22c6a20ebd Lock v_knlist with the vnode interlock. PR kern/37881. 2008-02-05 14:19:52 +00:00
ad d7b9a25622 Remove debugging code that's no longer needed. 2008-01-31 13:13:20 +00:00
tnn d1e420ee23 - Needs sys/atomic.h for atomic_inc_uint()
- Quench compiler warning about signed/unsigned mismatch when building LKM
2008-01-31 08:23:04 +00:00
ad 2290e4283f Expunge references to lockmgr. 2008-01-30 14:16:42 +00:00
ad 9ef95126d8 Replace crufty use of lockmgr. 2008-01-30 14:08:00 +00:00
ad e556d15453 Make it compile. I'll leave it to pooka to figure out what is the correct
thing here because I don't understand what this code is doing.
2008-01-30 11:57:24 +00:00
ad 25153c3ec9 PR kern/37706 (forced unmount of file systems is unsafe):
- Do reference counting for 'struct mount'. Each vnode associated with a
  mount takes a reference, and in turn the mount takes a reference to the
  vfsops.
- Now that mounts are reference counted, replace the overcomplicated mount
  locking inherited from 4.4BSD with a recursable rwlock.
2008-01-30 11:46:59 +00:00
ad 3490efcc63 Replace struct lock on vnodes with a simpler lock object built on
krwlock_t. This is a step towards removing lockmgr and simplifying
vnode locking. Discussed on tech-kern.
2008-01-30 09:50:19 +00:00
pooka 81de436273 init genfs_node before potential vput() 2008-01-29 18:22:24 +00:00
pooka 13d9236c46 Nuke #ifdef __OtherOS__ clutter to make maintaining slightly easier. 2008-01-29 18:21:10 +00:00
pooka feea4545b8 For code clarity typedef void *puffs_cookie_t.
No functional change.
2008-01-28 21:06:36 +00:00
dholland 717e1785a5 Fix some race conditions in rename.
Introduce a per-FS rename lock and new vfsops to manipulate it.
Get this lock while renaming. Also add another relookup() in do_sys_rename,
which is a hack to kludge around some of the worst deficiencies of
ufs_rename.
reviewed-by: pooka (and an earlier rev by ad)
posted on tech-kern with no objections.
2008-01-28 14:31:15 +00:00
ad b9839de884 Replace use of lockmgr(). 2008-01-27 21:58:39 +00:00
ad 29426ebab2 - Fix several problems with the inode hash.
- Replace use of lockmgr().
2008-01-26 14:25:38 +00:00
ad e49174fa0c - Fix probelms with inode hash: make MPSAFE, don't allocate with held locks.
- Replace use of lockmgr().
2008-01-25 20:49:15 +00:00
ad de81194d0c - Make new vnode construction MPSAFE.
- Replace use of lockmgr().
2008-01-25 20:29:28 +00:00
ad 1997a1e1f4 Remove VOP_LEASE. Discussed on tech-kern. 2008-01-25 14:32:11 +00:00
ad 703069c0e9 specfs changes for PR kern/37717 (raidclose() is no longer called on
shutdown). There are still problems with device access and a PR will be
filed.

- Kill checkalias(). Allow multiple vnodes to reference a single device.

- Don't play dangerous tricks with block vnodes to ensure that only one
  vnode can describe a block device. Instead, prohibit concurrent opens of
  block devices. As a bonus remove the unreliable code that prevents
  multiple file system mounts on the same device. It's no longer needed.

- Track opens by vnode and by device. Issue cdev_close() when the last open
  goes away, instead of abusing vnode::v_usecount to tell if the device is
  open.
2008-01-24 17:32:52 +00:00
pooka 661097a9a5 Remove bogus KASSERT: we can't make any assumptions about a dirent's
node in unmount since it might have been freed already.

fixes PR kern/37667.  per discussion with ad & simonb.
2008-01-17 18:22:52 +00:00
ad 42c90ece4c Fix dodgy tests of v_usecount. 2008-01-17 10:39:14 +00:00
ad 6d827ae10e Correct previous. 2008-01-17 10:28:24 +00:00
ad 33b917a83d smbfs_reclaim: fix a broken assertion. 2008-01-17 10:25:01 +00:00
ad bf01c1fd6b union_putpages: fix a locking botch. 2008-01-16 10:10:18 +00:00
christos d4fda54fa5 PR/37696: Paul Ripke: add large read / readahead support (Introduce run-length
detection to msdosfs_bmap(), from FreeBSD)
2008-01-05 18:42:14 +00:00
ad 0664a0459b Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
2008-01-04 21:17:40 +00:00
pooka 933a1a1af1 Politely refuse to mount a file system which says its FAT size is
zero - our implementation can't handle it (how sensible handling
a case like that would be is a whole other debate).

fixes panic reported by Jukka Salmi on current-users
2008-01-04 14:58:16 +00:00
pooka 89943d2ace fix vmlocking2 fallout: fstrans_mount/unmount 2008-01-03 18:09:35 +00:00
pooka 34fa5dc385 struct vop_foo_args comment police: a_l has ceased to be 2008-01-03 02:18:20 +00:00
pooka d53e261066 valloc -> vnalloc, vfree -> vnfree
Avoids collision with userland valloc(3).

no functional change
ad ok
2008-01-03 01:26:28 +00:00
pooka 4f32bae2c1 More type-punning workarounds. Curiously the kernel compilation
flags cause gcc to not complain.
2008-01-02 22:37:19 +00:00
pooka b8121d8a80 silence gcc about break type-punning 2008-01-02 22:33:10 +00:00
ad 4a780c9ae2 Merge vmlocking2 to head. 2008-01-02 11:48:20 +00:00
pooka a5ee2954b8 namespace a bit: vfsops -> puffs_vfsop_x() and vops -> puffs_vnop_x() 2007-12-30 23:04:12 +00:00
reinoud a661982b31 Use uvm_vnp_setwritesize() on file extending to instruct UVM to NOT read-in
the newly added space first. This significantly speeds up write speed for
msdosfs and making it at par with ffs wich already had this patched.

Speed increase measured on my IDE disc from 2Mb/sec to 32 Mb/sec
2007-12-28 17:46:48 +00:00
perry b6a2ef7569 Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h
2007-12-25 18:33:32 +00:00
perry 9b2b412c19 __FUNCTION__ -> __func__ 2007-12-15 00:39:14 +00:00
lukem 9a633d3a1a use __KERNEL_RCSID() instead of __RCSID() 2007-12-11 12:05:27 +00:00
lukem ceed9c722c use __KERNEL_RCSID() 2007-12-11 11:52:26 +00:00
pooka 319ddafdc5 Now that "l" is gone both as an argument to operations and from
componentname, remove all vestiges of puffs_cid.
2007-12-08 19:57:02 +00:00
pooka db06a930e6 Remove cn_lwp from struct componentname. curlwp should be used
from on.  The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
2007-12-08 19:29:36 +00:00
ad 1bea664342 Merge ihash locking changes from the vmlocking branch. 2007-12-08 14:48:33 +00:00
ad 6a3b582fe3 Merge locking changes + fixes from the vmlocking branch. 2007-12-08 14:41:11 +00:00
pooka 4e38160d4d Do not "return 1" from kqfilter for errors. That value is passed
directly to the userland caller and results in a mysterious EPERM.
Instead, return EINVAL or something else sensible depending on the
case.
2007-12-05 17:19:46 +00:00
pooka 7d5d7f4ff9 Send a response message for flush operations from the kernel instead
of abusing the return value of write(2).
2007-12-05 12:11:56 +00:00
pooka c024a3a48f Add a bit to differentiate if a message is a request or a response. 2007-12-04 19:43:42 +00:00
pooka 1ff78520d8 Destroy genfs_node in reclaim. And init it earlier in vget so that we
don't try to destroy an uninited lock should vget fail.
2007-11-30 11:23:10 +00:00
reinoud 1783f9c4fa Pullup fixes from UDF RW support project. This commit fixes the
mmc_discinfo conceptional bug and also vastly improves VAT searching.
2007-11-27 18:10:42 +00:00
pooka 6a3d9a187d Remove "puffs_cid" from the puffs interface following l-removal
from the kernel vfs interfaces.  puffs_cc_getcaller(pcc) can be
used now should the same information be desired.
2007-11-27 11:31:17 +00:00