Commit Graph

1244 Commits

Author SHA1 Message Date
perseant 81ded5df65 Make lfs_vref/lfs_vunref not need to know about VXLOCK and VFREEING
explicitly (especially since we didn't know about VFREEING at all before),
but notice the EBUSY return from vget() instead.

Fix some more MP locking protocol issues, most of which were pointed out by
Christian Ehrhardt this morning on tech-kern.
2006-04-13 23:46:28 +00:00
perseant 575f22cf94 Another MP locking fix. 2006-04-11 22:08:00 +00:00
perseant 74b70f471b Remove mostly useless BUFPAGES warning message from lfs_{un,}mount. 2006-04-10 23:51:50 +00:00
bouyer eb7f9aba74 Revert previous; I mixed bpp and *bpp when reading ffs_balloc_ufs1().
ffs_balloc() will always allocate a new buffer or leave it as NULL,
so coverity is wrong here, we're not using a freed argument.
2006-04-10 22:01:06 +00:00
bouyer a4181a9049 If we brelse ibp, set ibp to NULL, to avoid reusing it later in balloc()
or in our code at the next iteration.
Coverity ID 2706
2006-04-10 21:50:18 +00:00
perseant 07ebfab840 Optimize the free list search a little more; in particular use words
instead of bytes for the index, and never search below fs->lfs_freehd.

Fix a bug in the previous version of the search (an erroneous assumption
that ino_t was signed).

Free the bitmap when we unmount the filesystem.
2006-04-10 21:20:19 +00:00
perseant 017f856cba Don't leak vnode references if we fail to lock a vnode in lfs_flush_pchain().
Also fix another (probably only academic) simple_lock protocol error.
2006-04-10 21:17:21 +00:00
perseant fbf75b2bf7 Correct a locking bug in the recent pager optimization. 2006-04-10 18:42:48 +00:00
yamt 539544d937 ffs_gop_size: revert a problematic part of 1.78.
problems reported by Kouichirou Hiratsuka and Jukka Salmi on current-users@.
2006-04-09 21:59:35 +00:00
perseant 39ce23c169 Implement a somewhat finer-grained mechanism for paging LFS-backed pages.
The writer daemon, if it does not need to flush the whole filesystem,
now only writes the vnodes for which the pagedaemon has requested pageouts
(although it does not pay attention to the page ranges the pagedaemon
supplies).
2006-04-08 00:26:34 +00:00
perseant ff84dd347a Keep the free list ordered. This solves a problem first pointed out to me
by Michel Oey, in which an aged LFS writes up to an extra Ifile block for
every file created; and paves the way for the truncation of the Ifile when
many files are deleted.
2006-04-08 00:16:56 +00:00
perseant 7c22dcc8a6 Several minor bug fixes:
* Correct (weak) segment lock assertions in lfs_fragextend and lfs_putpages.
* Keep IN_MODIFIED set if we run out of avail in lfs_putpages.
* Don't try to (re)write buffers on a VBLK vnode; fixes a panic I found
  while running with an LFS root.
* Raise priority of LFCNSEGWAIT to PVFS; PUSER is way too low for
  something the pagedaemon is relying on.
2006-04-07 23:59:28 +00:00
perseant d28248e84e Make the segment lock aware of LWPs. Fixes a (somewhat confusing)
"lockmgr: pid 3997, not exclusive lockholder 3997, unlocking" panic I
encountered while running blogbench on an LFS.
2006-04-07 23:44:14 +00:00
uwe 7494d34448 Tell config to generate fs_ffs.h as vfs_bio.c checks for defined(FFS).
Include that header in vfs_bio.c so that bioops are not redefined.
2006-04-05 00:52:16 +00:00
pavel 929734802b Correct typo in a panic message. 2006-04-04 17:12:57 +00:00
perseant 51afd83ada Make sure we unlock to zero when avoiding 3-way deadlock; otherwise we
simply have a different form of deadlock.
2006-04-01 00:13:01 +00:00
perseant 418bf18f53 Handle the "filesystem is clean" flag correctly when upgrading from
read-only to read-write mount.  This makes "root on lfs" work for me,
although it looks like a different traceback from PR#32667.
2006-03-31 02:31:37 +00:00
yamt c5fcdd1719 some cleanups after the introduction of GOP_SIZE_MEM flag.
- remove GOP_SIZE_READ/GOP_SIZE_WRITE flags.
  they have not been used since the change.
- ufs_balloc_range: remove code which has been no-op since the change.
  thanks Konrad Schroder for explaining the original intention of the code.
- ffs_gop_size: don't extend past eof, in the case of GOP_SIZE_MEM.
  otherwise genfs_getpages end up to allocate pages past eof unnecessarily.
2006-03-30 12:40:06 +00:00
perseant 0a4e8d80c1 Double-checkpoint on unmount. This ensures that vnodes belonging to removed
files are really freed, preventing occasional spurious EBUSY returns from
vflush().
2006-03-28 23:57:41 +00:00
perseant afc725a1c7 Don't let the pagedaemon wait for pages, since that is just asking for
a deadlock.
2006-03-28 01:29:55 +00:00
perseant dddf5c5171 Improvements to LFS's paging mechanism, to wit:
* Acknowledge that sometimes there are more dirty pages to be written to
  disk than clean segments.  When we reach the danger line,
  lfs_gop_write() now returns EAGAIN.  The caller of VOP_PUTPAGES(), if
  it holds the segment lock, drops it and waits for the cleaner to make
  room before continuing.

* Note and avoid a three-way deadlock in lfs_putpages (a writer holding
  a page busy blocks on the cleaner while the cleaner blocks on the
  segment lock while lfs_putpages blocks on the page).
2006-03-24 20:05:32 +00:00
hannken cd28767efa ffs_balloc*(): Add an assertion for "bpp != NULL" if B_METAONLY is set.
From Coverity CIDs 1170..1173
2006-03-23 11:16:47 +00:00
matt 0486735479 More MALLOC -> malloc changes. 2006-03-19 17:50:42 +00:00
rtr aa6b2db95f init struct vnode *vp = NULL
coverity 2724 / run 6
XXX in future runs coverity may complain about deref NULL now but comment
    on line 382 indicates this should not be possible
2006-03-19 04:10:02 +00:00
rtr 7818c9e2d0 don't bother checking of ts == NULL before assigning since we know that
it is.
solves coverity 2725 / run 6
2006-03-19 03:58:34 +00:00
bouyer 9d8928a40d Fix dead error condition, coverity ID 747. 2006-03-18 13:56:51 +00:00
bouyer d8a43c47ae Fix a dead error condition, coverity ID 603. 2006-03-18 13:54:21 +00:00
bouyer b1dc0ca141 Remove dead code, fixing coverity ID 745. nameiop can only be CREATE
or DELETE here. This code got cut-n-pasted from ufs_loolup.c, but
is only used in whiteout support. ext2fs doesn't support whiteout.
2006-03-18 13:49:19 +00:00
bouyer f7123013b8 bread() will always return a valid bp. So remplace the (always true) if (bp)
with a KASSERT.
Should fix Coverity ID 2444.
2006-03-18 12:48:38 +00:00
christos 5a57baa413 don't use MALLOC with a non-constant size; use malloc instead. 2006-03-17 23:29:07 +00:00
tls a67eab5ee4 From Konrad Schroeder, in response to strange df output on anoncvs.netbsd.org:
We were returning the wrong value for free space.  Now we're not.
2006-03-17 23:21:01 +00:00
christos 1b2709754a cleanup more SET/CLR/ISSET lossage 2006-03-05 17:33:33 +00:00
yamt ec5a93183a merge yamt-uio_vmspace branch.
- use vmspace rather than proc or lwp where appropriate.
  the latter is more natural to specify an address space.
  (and less likely to be abused for random purposes.)
- fix a swdmover race.
2006-03-01 12:38:10 +00:00
thorpej 58853410ae Use device_class() instead of accessing dv_class directly. 2006-02-21 04:32:38 +00:00
perry fbae48b901 Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
2006-02-16 20:17:12 +00:00
dsl 6f0f9f8763 Make almost everything #include <sys/bswap.h> instead of <machine/bswap.h>
The bswap.h and endian.h files are all rather incestuous, but I want to
get the constant folding stuff into one place - sys/bswap.h
2006-01-29 21:42:40 +00:00
christos 9c6e6ff8b2 Protect against uio_lwp being NULL from Pavel Cahyna 2006-01-14 23:49:59 +00:00
yamt 03f80508d6 - unify ffs_blkatoff and lfs_blkatoff.
- remove ufs_ops::uo_blkatoff.
- add directory read-ahead code.  (disabled for now.)
2006-01-14 17:41:16 +00:00
yamt 77e5f3531a make ufsdirhash_pool static. 2006-01-14 09:09:39 +00:00
yamt 3a6eed1f58 pull freebsd's ufs_lookup.c rev.1.53 and 1.54. PR/31873.
> ----------------------------
> revision 1.54
> date: 2001/08/26 01:25:12;  author: iedowse;  state: Exp;  lines: +30 -12
> When compacting directories, ufs_direnter() always trusted DIRSIZ()
> to supply the number of bytes to be bcopy()'d to move an entry. If
> d_ino == 0 however, DIRSIZ() is not guaranteed to return a sensible
> length, so ufs_direnter could end up corrupting a directory during
> compaction. In practice I believe this can only happen after fsck_ffs
> has fixed a previously-corrupted directory.
>
> We now deal with any mid-block unused entries specially to avoid
> using DIRSIZ() or bcopy() on such entries. We also ensure that the
> variables 'dsize' and 'spacefree' contain meaningful values at all
> times. Add a few comments to describe better this intricate piece
> of code.
>
> The special handling of mid-block unused entries makes the dirhash-
> specific bugfix in the previous revision (1.53) now uncecessary,
> so this change removes it.
>
> Reviewed by:  mckusick
> ----------------------------
> revision 1.53
> date: 2001/08/22 01:35:17;  author: iedowse;  state: Exp;  lines: +2 -2
> When compressing directory blocks, the dirhash code didn't check
> that the directory entry was in use before attempting to find it
> in the hash structures to change its offset. Normally, unused
> entries do not need to be moved, but fsck can leave behind some
> unused entries that do. A dirhash sanity panic resulted when the
> entry to be moved was not found. Add a check that stops entries
> with d_ino == 0 from being passed to ufsdirhash_move().
2006-01-14 09:09:02 +00:00
yamt 6af60103dc FSFMT: whitespace. 2006-01-13 00:50:58 +00:00
yamt eaebcf6b5b ufsdirhash_build: yield cpu when looping on directory entries. 2006-01-13 00:50:25 +00:00
yamt 2fc5e44a62 remove an obsolete prototype. 2006-01-06 09:27:55 +00:00
yamt 7b826aac85 initialize necessary members of struct buf. PR/32462 from Reinoud Zandijk. 2006-01-06 09:21:44 +00:00
yamt 690d424f28 - add simple functions to allocate/free a buffer for i/o.
- make bufpool static.
2006-01-04 10:13:05 +00:00
chs 0545b6e0cb changes for making DIAGNOSTIC not change the kernel ABI:
- for structure fields that are conditionally present,
   make those fields always present.
 - for functions which are conditionally inline, make them never inline.
 - remove some other functions which are conditionally defined but
   don't actually do anything anymore.
 - make a lock-debugging function conditional on only LOCKDEBUG.

as discussed on tech-kern some time back.
2005-12-27 04:06:45 +00:00
perry 3d4ed1fbc7 __inline__ -> inline 2005-12-24 23:41:33 +00:00
perry 0f0296d88a Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:45:08 +00:00
rpaulo fc2fb45bf0 Convert UFS_EXTATTR to struct lwp. 2005-12-23 23:20:00 +00:00
yamt 523e856cba prevent in-core vnode being freed from getting new references.
otherwise, once the corresponding bit in the inode bitmap is cleared,
an unrelated inode with the same inode number can be allocated and
ufs_ihashget() picks a stale in-core vnode for it.

PR/32301 by Matthias Scheler.
2005-12-23 15:31:40 +00:00