Commit Graph

171 Commits

Author SHA1 Message Date
perseant b46550bdcf Better fix for PR# 8577: before setting dirops, check for cross-device
rename and error out.  This avoids possible problems with attempting
rename between two LFSs.
1999-11-05 20:14:56 +00:00
perseant ea1f38ce2f Check that the destination vnode is on an LFS before trying to twiddle
its superblock.  Fixes PR#8577.
1999-11-01 18:29:33 +00:00
perseant fde29faf34 Under degenerate access patterns (e.g. `bonnie' benchmark) lfs_check could
fail, because the particular block being requested was always in the cache
(although other routines that cannot afford to call lfs_check have in the
meantime stuffed the cache full of dirty blocks).  Partially addresses PR 8383.
1999-10-21 16:53:43 +00:00
enami fee96e1746 Check if the type of device node isn't VBAD before touching v_specinfo. If
the device vnode is revoked, the field is NULL and touching it causes null
pointer derefercence.
1999-10-20 14:32:09 +00:00
wrstuden e5bf8dc4d5 Catch a few cases missed earlier where we need to lock the vnode before
calling VOP_CLOSE().
1999-10-18 19:52:24 +00:00
mycroft 02781a3483 Fix printf() formats. 1999-10-01 22:07:42 +00:00
augustss ada52e1f37 Add #include <sys/device.h> so this file compiles again. 1999-09-08 08:29:45 +00:00
sommerfeld c0411740d8 Avoid dereferencing NULL rootvp if booting diskless. 1999-09-08 03:45:22 +00:00
perseant c588aaf55f Make changes that will allow an LFS filesystem to be used as the root
filesystem.  In particular,

- Fix mknod deadlock, described in PR 8172.
- Enable lfs_mountroot.
- Make lfs_writevnodes treat filesystems mounted on lfs device nodes properly,
  by flushing that device rather than trying to add blocks to the device inode.

This, in combination with lfs boot blocks, will allow operation of an all-lfs
system.
1999-09-03 22:48:51 +00:00
wrstuden 3bf14d81e9 Add support for fcntl(2) to generate VOP_FCNTL calls. Any fcntl
call with F_FSCTL set and F_SETFL calls generate calls to a new
fileop fo_fcntl. Add genfs_fcntl() and soo_fcntl() which return 0
for F_SETFL and EOPNOTSUPP otherwise. Have all leaf filesystems
use genfs_fcntl().

Reviewed by: thorpej
Tested by: wrstuden
1999-08-03 20:19:16 +00:00
wrstuden 976aedb7ac Adjust mountroot routines to vrele rootvp in case of mount error. Closes
PR 7977 by Neil Carson, <neil@brini.com>.
1999-07-17 01:08:28 +00:00
wrstuden 379a26972f Modify file systems to deal with struct lock in struct vnode. All leaf
fs's other than nfs use genfs_lock() for locking.

Modify lookup routines to set PDIRUNLOCK when they unlock the parrent.
1999-07-08 01:05:58 +00:00
tls 4d649c3adb squash some compiler warnings on debug printfs by casting to int 1999-06-17 22:22:41 +00:00
perseant a818a47169 Minor changes to the segment live bytes calculation. In particular, fixed
a bug in fragment extension that could run the count negative.  Also, don't
overcount for inodes, and don't count segment summaries.  Thus, for empty
segments the live bytes count should now be exactly zero.
1999-06-15 22:25:41 +00:00
drochner b121ed29dd complete the previous
reindent syscall args
1999-06-09 12:18:19 +00:00
christos e2b181b130 prefix the lfs syscalls with sys_ 1999-06-09 04:52:11 +00:00
perseant 88207e0cba Fixed lfs_update (and related functions) so that calls from lfs_fsync
will DTRT with vnodes marked VDIROP.  In particular, the message
"flushing VDIROP" will no longer appear, and the filesystem will remain
stable in the event of a crash.

This was particularly a problem with NFS-exported LFSes, since fsync
was called on every file close.
1999-06-01 03:00:40 +00:00
scottr bdd60e98f9 Include opt_ddb.h so we will get the Debugger() prototype. 1999-05-04 00:35:37 +00:00
perseant 4427f80b15 Other half of the ufs_hashlock locking fix (oops) 1999-04-16 16:23:46 +00:00
perseant 2d12a2d41d Fix locking panic on ufs_hashlock 1999-04-16 00:41:58 +00:00
perseant 40458c9d34 Fix lost lock in lfs_markv -- a typo-class bug, obvious when you look at it. 1999-04-14 19:37:28 +00:00
perseant 40cebde457 Check the superblock version field, and refuse to mount the filesystem
if the version number is higher than we know about.  This allows, e.g.,
changes in the format of the ifile, segment size restrictions and boundaries,
etc., which would not affect existing fields in the superblock, but which
would drastically affect the filesystem, to be smoothly integrated at a
later date.
1999-04-12 00:47:17 +00:00
perseant 65ba757424 Improve the debugging printfs in the cleaner syscalls (in particular, make
it obvious that they're coming from lfs).
1999-04-12 00:40:06 +00:00
perseant 8d72b3204a Disallow threshold-initiated cache flush when dirops are active. Also, make
SET_ENDOP use lfs_check instead of inlining most of it.
1999-04-12 00:36:47 +00:00
perseant a520288478 Fix block counting during file truncation, if not truncating to zero. 1999-04-12 00:30:08 +00:00
perseant bffea14a3f Make sure that the wakeup occurs for vnodes that lfs_update might be sleeping
on (nodes which are not marked IN_MODIFIED/IN_CLEANING, but which have dirty
buffers), by marking them with the appropriate flag if dirtybuffers were added
while the write was in progress.
1999-04-12 00:25:13 +00:00
perseant e6b7726c9a Better checking for held inode locks in lfs_fastvget, for a number of error
conditions.  Also change the default setting of lfs_clean_vnhead to 0, which
seems to make the locking problems go away (although this is difficult to
test as I can't reliably reproduce them).
1999-04-12 00:11:01 +00:00
perseant 7221719dc7 Fix "lfs_ifind: dinode xxx not found" panic. When inodes were freed,
then immediately reloaded, their dinodes were located in an inode block
which was not on disk at the advertized location, nor in the cache (although
it would be flushed to disk next segment write).  Fix this by using getblk()
instead of lfs_newbuf() for inode blocks.
1999-04-12 00:04:21 +00:00
perseant 97c6743666 Fix inode reporting in lfs_statfs (the meaning of f_files and f_ffree was
reversed).
1999-04-11 23:58:17 +00:00
perseant d24ffa7077 Mark the current segment with SEGUSE_ACTIVE at mount time, rather than waiting
for the first write.  If this is not done, the cleaner may try to clean the
current segment out from under the writer if the filesystem is mounted after
a crash (or any other time that the dirty:clean segment ration is high enough).
1999-04-11 23:31:09 +00:00
perseant 6a87896854 Take out the `#ifdef USE_UFSHASH'; use ufs_hashlock to lock the inode free
list instead of free_lock.
1999-04-11 23:24:04 +00:00
perseant 46ae977773 Change the reference to "newlfs" in the CHANGES file to the correct "newfs_lfs" 1999-04-10 18:31:05 +00:00
mycroft 9e81cc5022 Fix obvious bugs:
* The MNT_UPDATE case had a null pointer dereference.  (This is a good example
  of why blindly adding bogus initializiers is a FUNDAMENTALLY BAD IDEA!)
* Make sure the whole ufsmount is zeroed, as the export code relies on this.
* If we decided to use the second/alternate superblock, make sure to copy the
  in-core version from the right buffer.
Also, reenable NFS exporting.
1999-04-04 09:56:44 +00:00
perseant 7ea5ec6723 Fix buffer handling problems in lfs_vinvalbuf 1999-04-01 23:28:09 +00:00
perseant 4158afaaf3 Add initialization to quell compiler warning (only on some platforms?) 1999-03-30 16:11:43 +00:00
perseant 322fef73ae Move variable initialization to the top of lfs_vflush 1999-03-30 16:03:16 +00:00
perseant 5589f33082 Fix unit mismatch in debugging code in lfs_segclean; also put it properly
within `#ifdef DEBUG_LFS'.
1999-03-29 22:13:07 +00:00
perseant 3e0bf5e0d8 Fix the other missing dirop wakeup 1999-03-29 21:54:26 +00:00
perseant f058684b7f lfs_truncate calls vinvalbuf to invalidate all currently-hald buffers, which
in turn forces a flush of the vnode, whether or not it is involved in a dirop.
(This can happen during a remove or rmdir, when the directory is shrunk.)
Because of the nature of dirops, however, flushing a vnode involved in a dirop
is disallowed (and was marked with a panic).  This patch has lfs_truncate
call a specialized vinvalbuf that only invalidates buffers following the new
end-of-file, and thus does not require a flush.  Also the panic is demoted,
in case I missed any other path to lfs_vflush.
1999-03-29 21:51:38 +00:00
perseant fbc5e63cd6 Make sysctl variable lfs_clean_vnhead do what it was supposed to do,
namely, toggle whether vnodes loaded only for cleaning (as opposed to
normal filesystem use) are freed to the *head* of the vnode free list,
rather than the tail.  This should avoid a possible cache flushing
effect, if the cleaner cleans a segment containing a large number of
live inodes.
1999-03-25 22:38:28 +00:00
perseant cffa290130 Since dirop vnodes can't be flushed, they hold a reference until their
dirop is completely written to disk.  This means that ordinary calls to
ufs vnops which would ordinarily call VOP_INACTIVE through vrele/vput,
don't.  This patch detects that condition after such vnops have been
run, and calls VOP_INACTIVE if it would ordinarily have been called by
the ufs call.
1999-03-25 22:33:03 +00:00
perseant a3748f1cc7 Fixes to make dirops and lfs_vflush play together well. In particular,
if we are short on vnodes, lfs_vflush from another process can grab a
vnode that lfs_markv has already processed but not yet written; but
lfs_markv holds the seglock.  When lfs_vflush gets around to writing it,
the context for copyin is gone.  So, now lfs_markv calls copyin itself,
rather than having lfs_writeseg do it.
1999-03-25 22:26:52 +00:00
perseant 6b51bdc17c Lock buffers with B_BUSY between data checksum calculation and write, so
some other process doesn't change the data after it was checksummed.
1999-03-25 22:02:36 +00:00
perseant 1cacaa295f Change lfs_sb_cksum to use offsetof() instead of an inlined version.
Fix lfs_vref/lfs_vunredf to ignore VXLOCKed vnodes that are also being
flushed.

Improve the debugging messages somewhat.
1999-03-25 21:54:10 +00:00
perseant e6ef2d67dd clean up unused/required #ifdefs 1999-03-25 21:39:18 +00:00
tron 057ae88da9 Don't include "opt_uvm.h" any more. 1999-03-24 11:05:31 +00:00
mrg d2397ac5f7 completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
1999-03-24 05:50:49 +00:00
perseant d1afff4165 Move dlfs_pad to the end of struct dlfs (after the pad), for upward
compatibility.
1999-03-17 18:38:34 +00:00
perseant c5fb3ffb03 Fix pad on lfs.h so it is really 512 bytes, as advertized 1999-03-17 16:49:00 +00:00
perseant e1c9a578a8 New CHANGES files that describes briefly all nontrivial changes made to
the LFS since the 4.4lite2 code was merged into NetBSD.

TODO updated to remove everything marked DONE in 4.4, and add in a list
of more current things to do.

Get rid of comments about the cleaner syscall code and missing fragment
support from README.
1999-03-15 00:46:47 +00:00
perseant 1b8f5ea3c3 New sources should leave the LFS in a more-or-less working state. Changes
include:

	- DIROP segregation is enabled, and greater care is taken
	  to make sure that a checkpoint completes.  Fsck is not
	  needed to remount the filesystem.
	- Several checks to make sure that the LFS subsystem does not
	  overuse various resources (memory, in particular).
	- The cleaner routines, lfs_markv in particular, are completely
	  rewritten.  A buffer overflow is removed.  Greater care is taken
	  to ensure that inodes come from where lfs_cleanerd say they come
	  from (so we know nothing has changed since lfs_bmapv was called).
	- Fragment allocation is fixed, so that writes beyond end-of-file
	  do the right thing.
1999-03-10 00:20:00 +00:00
mycroft b174019ccc Pass null pointers to VOP_UPDATE rather than having all the callers fetch the
current time themselves.
1999-03-05 21:09:48 +00:00
mycroft 86ed73efb4 Permit the access and modify time pointers passed to VOP_UPDATE to be null,
meaning the current time.
1999-03-05 20:47:06 +00:00
wrstuden 862a56e88b Modify vfsops to seperate vfs_fhtovp() into two routines. vfs_fhtovp() now
only handles the file handle to vnode conversion, and a new call,
vfs_checkexp(), performs the export verification.
1999-02-26 23:44:43 +00:00
bouyer 22d556f6cf Make sure a buffer optained from bread() is always bresle()'d in case of
error. Closes PR kern/1448 from Wolfgang Solfrank.
1999-02-10 13:14:08 +00:00
mycroft d4026f6eb5 GC the B_CACHE bit. 1998-11-09 01:18:34 +00:00
cgd af24dfc946 argument to dbtob needs to be cast to u_quad_t here to avoid shift lossage 1998-11-06 23:02:12 +00:00
thorpej 5ecbc50348 Use DINODE_SIZE rather than sizeof(struct dinode). 1998-10-23 00:32:35 +00:00
pk 3059ae05ba Apply patch from PR#5542: buffer overflow in lfs_markv(). 1998-09-15 10:53:22 +00:00
pk 37109879dc PR#6032: define fixed sized on-disk superblock structure. 1998-09-11 21:27:12 +00:00
thorpej 38cf17f475 Use the pool allocator and the "nointr" pool page allocator for LFS inodes. 1998-09-01 03:26:05 +00:00
thorpej 9f42788795 Add some braces to make egcs happy. 1998-08-25 04:43:46 +00:00
sommerfe 7ba7fbbb23 Always include fifos; "not an option any more". 1998-06-24 20:58:44 +00:00
sommerfe becaafeea0 defopt for options FIFO 1998-06-22 22:00:59 +00:00
cgd 651b44e211 Rework the way kernel include files are installed. In the new method,
as with user-land programs, include files are installed by each directory
in the tree that has includes to install.  (This allows more flexibility
as to what gets installed, makes 'partial installs' easier, and gives us
more options as to which machines' includes get installed at any given
time.)  The old SYS_INCLUDES={symlinks,copies} behaviours are _both_
still supported, though at least one bug in the 'symlinks' case is
fixed by this change.  Include files can't be build before installation,
so directories that have includes as targets (e.g. dev/pci) have to move
those targets into a different Makefile.
1998-06-12 23:22:30 +00:00
scottr 7171cca4b8 Protect various config(8)-generated files from inclusion while
building LKMs.  Fixes PR 5557.
1998-06-09 07:46:31 +00:00
scottr d48f258f90 Use the newly-defined opt_quota.h. 1998-06-08 04:27:50 +00:00
kleink 382743ada3 Convert fsync vnode operator implementations and usage from the old `waitfor'
argument and MNT_WAIT/MNT_NOWAIT to `flags' and FSYNC_WAIT.
1998-06-05 19:53:00 +00:00
kleink d4a8052f98 Fix some arithmetics lossage on typeless pointers. 1998-05-08 18:31:13 +00:00
bouyer 091dafd39f Add support for reading/writing FFS in non-native byte order, conditioned
to "options FFS_EI". The superblock and inodes (without blk addr) are
byteswapped at disk read/write time, other metadatas are byteswapped
when used (as they are acceeded directly in the buffer cache).
This required the addition of a "um_flags" field to struct ufsmount.
ffs_bswap.c contains superblock and inode byteswap routines also used
by userland utilities.
1998-03-18 15:57:26 +00:00
drochner 22dbd3c3da Don't cast the quad_t file size to u_long, this can cause overflows. 1998-03-03 09:02:51 +00:00
fvdl 221505c12f Make this compile again with UVM 1998-03-03 01:49:21 +00:00
fvdl d201db498e Remove accidentally enabled lfs_mountroot from vfsops struct. 1998-03-01 22:16:39 +00:00
fvdl e5bc90f40c Merge with Lite2 + local changes 1998-03-01 02:20:01 +00:00
thorpej 95e2e3b91b Include the LFS option header. 1998-02-19 00:54:39 +00:00
thorpej b5bf2ed6d0 Place a pointer to an array of our vnodeopv_desc *'s in our vfsops
structure, for use by vfs_attach().
1998-02-18 07:05:47 +00:00
chs abf50cf8c3 add UVM stuff. 1998-02-07 17:28:18 +00:00
thorpej df7ad322f2 Nuke spurious semicolon, from Konrad Schroder <perseant@hhhh.org>. 1998-01-13 03:30:39 +00:00
mjacob 949982f2a4 In calculating the f_bavail field, don't take 32 bit quantities and
multiply them by 90 (to be divided by 100) and expect them to be sane
for very large values (I was getting a negative 'avail' count).
1997-10-16 18:29:11 +00:00
lukem 319d918511 prototype lfs_cksum ifndef KERNEL 1997-09-15 06:44:48 +00:00
drochner 8c0a9bab00 Don't cast 64bit (off_t) file sizes to vm_offset_t (32bit on many
architectures), truncate them intelligently instead.
The truncation is done centralized in vnode_pager.c.
This prevents from wrap-over effects when parts of large (>2^32 byte) files
are mmapped.
Don't allow to mmap above the numerical range of vm_offset_t.
This is considered a temporary solution until the vm system handles the
object sizes/offsets more cleanly.
1997-07-04 20:22:09 +00:00
pk 2e8a55e122 TIMESPEC_TO_TIMEVAL => TIMEVAL_TO_TIMESPEC 1997-06-13 08:59:51 +00:00
bouyer 76c414a957 Add support for ext2fs, this needed a few modifications to ufs/ufs/inode.h:
- added an "union inode_ext" to struct inode, for the per-fs extentions.
  For now only ext2fs uses it.
- i_din is now an union:
	union {
		struct  dinode ffs_din; /* 128 bytes of the on-disk dinode. */
		struct ext2fs_dinode e2fs_din; /* 128 bytes of the on-disk dinode. */
	} i_din
  Added a lot of #define i_ffs_* and i_e2fs_* to access the fields.
- Added two macros: FFS_ITIMES and EXT2FS_ITIMES. ITIMES calls the rigth
  macro, depending on the time of the inode. ITIMES is used where necessary,
  FFS_ITIMES and EXT2FS_ITIMES in other places.
1997-06-11 10:09:37 +00:00
mycroft 66c4e32b11 Just increment the generation count. Using the time is bogus and defeats
fsirand(8).
1997-03-10 06:18:28 +00:00
cgd 90688fce27 Change the second and third args to struct vfsops' (*vfs_mount)() to
'const char *', and 'void *', respectively.  The second arg is taken directly
from user arguments, and is const there, so must be const in the prototypes
and functions.  The third arg is also taken directly from user arguments.
It doesn't have to be changed, but since it's cleaner to keep the type
the same as the user arg's type, and I'm already making the 'const char *'
change...
1996-12-22 10:10:12 +00:00
is ebe1c82eda Make the struct lfs 512 bytes long on 32bit machines whose compiler doesn't
align 32bit integers. Use explicit sized typing at some other places.

XXX This still won't fix lfs for 64bit machines, as we have some
assumptions about sizeof(pointer)=sizeof(u_int32_t) in here, and (if I
looked right) a misaligned u_int64_t. The right fix (to cite cgd) will
be to seperate on-disk-representation from in-core, but I don't have
the time (at the moment) to do this.
1996-12-05 19:01:46 +00:00
cgd f6e4567c57 cast int64_t-sized types to "long long" before printing them with %qd.
gcc thinks that the 'q' modifier describes a "long long", and so -Wformat
whines when printing with 'q' on the alpha, since int64_t-sized types are
done with variations on "long" rather than "long long".
1996-11-15 23:11:56 +00:00
christos 90c7de0919 revert previous kprintf changes 1996-10-12 21:58:44 +00:00
christos de1b2b437e printf -> kprintf, sprintf -> ksprintf 1996-10-10 17:16:17 +00:00
mycroft 2bc736661a Implement poll(2). 1996-09-07 12:40:22 +00:00
mycroft c52352c819 Add a set of generic file system operations that most file systems use.
Also, fix some time stamp bogosities.
1996-09-01 23:47:48 +00:00
mycroft 261382c331 Change VOP_UPDATE() semantics:
* Make 2nd and 3rd args timespecs, not timevals.
* Consistently pass a Boolean as the 4th arg (except in LFS).
Also, fix ffs_update() and lfs_update() to actually change the nsec fields.
1996-05-11 18:26:27 +00:00
pk 44af669e3d Appease gcc: unused variables if !QUOTA 1996-03-25 12:53:35 +00:00
christos 48fda0b4ca Fix printf format strings 1996-03-17 02:16:18 +00:00
christos 7e24291099 Protect include in lfs_cksum.c so that it can be used by userland programs. 1996-02-16 02:22:05 +00:00
christos e2c2c98181 di_size is a quad and needs %qu not %lu 1996-02-12 22:08:47 +00:00
christos 11e9f2ce94 Add fwd declaration for struct ucred 1996-02-12 15:20:12 +00:00
christos 7bd9e243f3 lfs prototypes 1996-02-09 22:28:45 +00:00
mycroft 53fccab940 Fix vop_link, vop_symlink, and vop_remove semantics in several ways:
* Change the argument names to vop_link so they actually make sense.
* Implement vop_link and vop_symlink for all file systems, so they do proper
  cleanup.
* Require the file system to decide whether or not linking and unlinking of
  directories is allowed, and disable it for all current file systems.
1996-02-09 14:45:36 +00:00
jtc dd05bd5124 Rename struct timespec fields to conform to POSIX.1b 1996-02-01 00:04:52 +00:00