Commit Graph

147 Commits

Author SHA1 Message Date
perseant 737dec82d6 Change the way LFS does block accounting, from trying to infer from the
buffer cache flags, to marking the inode and/or indirect blocks with a
special disk address UNWRITTEN==-2 when a block is accounted for.  (This
address is never written to disk, but only used in-core.  This is essentially
the same method of block accounting as on the UBC branch, where the buffer
headers don't exist.)  Make sure that truncation is handled properly,
especially in the case of holey files.

Fixes PR#9994.
2000-05-05 20:59:20 +00:00
perseant 37f567639c Test whether the filesystem is an LFS before trying to read the alternate
superblock (whose disk address is stored in the primary superblock).  Also,
refuse to mount a filesystem whose superblocks overlap or where the alt.
superblock has a lower disk address than the primary superblock.

Solves PR#10001.
2000-04-29 00:23:00 +00:00
perseant 4ea5a53003 get rid of unused variable aflags 2000-04-24 19:07:16 +00:00
perseant eedb742e6e Fix problems outlined in PR#9926:
- lfs_truncate extends the file if called with length > i_ffs_size;
    - lfs_truncate errors out if called with length < 0;
	- lfs_balloc block accounting corrected for the case of blocks read
	  into the cache before they exist on disk;
	- mp->mnt_stat.f_iosize is initialized in lfs_mountfs.
2000-04-23 21:10:26 +00:00
augustss 169ac5b3c1 Remove register declarations. 2000-03-30 12:41:09 +00:00
jdolecek 89015c4648 Add new VFS op routine - vfs_done and call it on filesystem detach
in vfs_detach(). vfs_done may free global filesystem's resources,
typically those allocated in respective filesystem's init function.
Needed so those filesystems which went in via LKM have a chance to
clean after themselves before unloading. This fixes random panics
when LKM for filesystem using pools was loaded and unloaded several
times.

For each leaf filesystem, add appropriate vfs_done routine.
2000-03-16 18:08:17 +00:00
soren 95054da1a1 Fix doubled 'the's in comments. 2000-03-13 23:52:25 +00:00
bouyer 31a775880b lfs_truncate: handle synlinks with length > maxsymlink_len as regular files.
For symlinks > 60 chars we were bzero'ing part of (struct inode) past the
actual inode struct, corrupting memory following the current (struct inode)
resuling in a 'panic: pool_get(lfsinopl): free list modified' later.
This could also be the cause of random panics. With this fix LFS seems to be
useable for me now.
2000-03-12 01:45:01 +00:00
perseant dac789be22 Changes to stabilize LFS. The first two of these should also apply to the
1.4 branch.

* Use a separate per-fs lock, instead of ufs_hashlock, to protect the Inode
  free list.  This seems to prevent the "lockmgr: %d, not exclusive lock holder
  %d, unlocking" message I was mis-attributing last night to an unlocked vnode
  being passed to vrele.

* Change calling semantics of lfs_ifind, to give better error reporting:
  If fed a struct buf, it can report the block number of the offending inode
  block as well as the inode number.

* Back out rev 1.10 of lfs_subr.c, since the replacement code was slightly
  uglier while being functionally identical.

* Make lfs_vunref use the same free list convention as vrele/vput, so that
  vget does not remove vnodes from a hash list they are not on.
2000-01-19 00:03:04 +00:00
perseant bfde45e89f Make sure that vnodes are locked when inactivated (e.g. by the cleaner) 2000-01-16 09:15:51 +00:00
perseant 86b0e2dc16 Fix a problem in my changes of Dec 14th, that prevents removed vnodes
from being inactivated under some conditions.  Removed vnodes are now
inactivated when the VDIROP flag is cleared, and to prevent block
accounting problems this clearing has been postponed until
lfs_segunlock.
2000-01-16 05:56:14 +00:00
perseant a38b519087 correct typo (reference uninitialized variable) 2000-01-16 04:57:08 +00:00
perseant 1b67daa4b4 Expand the category of "metadata" in lfs_markv to include Ifile data blocks.
This prevents a rare condition in which Ifile "ifile" blocks, that is, the
blocks of the ifile which point VOP_VGET at the inode block containing the
requested inode, from being "unwritten" when cleaning during intense disk
activity.
2000-01-14 21:41:11 +00:00
perseant dbe30ed5d4 Better handling of various combinations of cleaning, vnode flushing, and
dirop writing.  In particular, lfs_writevnodes now writes all buffers from
a flushed vnode whether cleaning or not, and the same with the Ifile; and
lfs_segwrite does not attempt to write data from other non-cleaning vnodes,
even if a vnode is being flushed.
2000-01-14 21:38:46 +00:00
perseant 32bd59cdf6 Fix error returns on lfs vnops so that locks and reference counts are
preserved.  Handle dirop accounting in lfs_vfree for this case as well.
May address PR#8823.
1999-12-15 07:19:07 +00:00
perseant fa6a733240 In lfs_bwrite, don't mark buffers dirty if lfs is mounted read-only.
(Previously buffers could be marked dirty by the cleaner, and possibly by
other means.)

Also check for softdep mount in vfs_shutdown before trying to bawrite
buffers, since other filesystems don't need it and lfs doesn't bawrite.
(This fragment reviewed by fvdl.)

Partially addresses PR#8964.
1999-12-15 07:10:32 +00:00
simonb 3238e654f9 Use an explicitly sized type (u_int32_t) for inode numbers in the super
block instead of ino_t.  Reviewed by Konrad Schroder.
1999-12-08 23:17:31 +00:00
ragge 6aabd4d0c2 CL* discarding. 1999-12-04 12:11:13 +00:00
perseant 22979769c0 Handle the case of a vnode flush while dirops are active correctly in
lfs_segwrite.  Also, make sure a flush is called in SET_DIROP before sleeping
on its results.  Addresses PR #8863.
1999-12-03 21:47:44 +00:00
fvdl d901f6eae0 Be more careful to block bio interrupts for some data structures. There
were at least a few missed cases where vp->v_{clean,dirty}blkhd were
unprotected since the softdep/trickle sync merge.
1999-11-23 23:52:40 +00:00
perseant bb2093f24a Initialize i_ffs_effnlink, so every file doesn't look like it's already been
deleted for the purpose of dirops (particularly create and mkdir).  Addresses
PR#8815.
1999-11-21 19:25:31 +00:00
perseant ff33b3365d Fix spllevel problem with superblock exclusion and with segment write throttle.
May address PR#8383.
1999-11-17 20:08:30 +00:00
fvdl 0b1963121a Add Kirk McKusick's soft updates code to the trunk. Not enabled by
default, as the copyright on the main file (ffs_softdep.c) is such
that is has been put into gnusrc. options SOFTDEP will pull this
in. This code also contains the trickle syncer.

Bump version number to 1.4O
1999-11-15 18:49:07 +00:00
perseant fc5ecbb5a8 Back out my patch of the 8th (to address unreferenced inode problem).
Apparently this needs more thought.
1999-11-12 16:56:48 +00:00
perseant 26c34e715f If ifile blocks were written before dirops were complete, and then the
system crashed, inodes could be allocated that were not referenced.  (Though
not a serious problem, it evidences itself in phase 4 of fsck_lfs.)  Fix
this by marking if_daddr with UNASSIGNED before the inodes are actually
written; at mount time the ifile is checked for UNASSIGNED entries and
any that are found are linked back into the free list.  (The latter
functionality should move into the roll-forward agent when it materializes.)
1999-11-09 02:21:05 +00:00
perseant 3c63d0830f Address ufs_hashlock/ufs_ihashins protocol bug, discovered while doing a
post-mortem of a production machine.  Also, take the active dirop
count off of the fs and make it global (since it is measuring a global
resource) and tie the threshold value LFS_MAXDIROP to desiredvnodes.
1999-11-06 20:33:05 +00:00
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