Commit Graph

1324 Commits

Author SHA1 Message Date
reinoud dc5b5420b9 Revisit mnt_vnodelist TAILQ patch. Remove all suspicious TAILQ_FOREACH()
loops where vnodes can get removed or added during the loops. This could
lead to panic's on unmount since nodes are skipped or otherwise
TAILQ_NEXT(0xdeadbeef, ...) was dereferenced.
2006-10-25 22:01:54 +00:00
drochner bffbce1754 import a fix from FreeBSD (rev.1.185):
After a rmdir()ed directory has been truncated, force an update of
the directory's inode after queuing the dirrem that will decrement
the parent directory's link count.  This will force the update of
the parent directory's actual link to actually be scheduled.  Without
this change the parent directory's actual link count would not be
updated until ufs_inactive() cleared the inode of the newly removed
directory, which might be deferred indefinitely.  ufs_inactive()
will not be called as long as any process holds a reference to the
removed directory, and ufs_inactive() will not clear the inode if
the link count is non-zero, which could be the result of an earlier
system crash.
[plus description about problems woth background fsck solved
by this; irrelevant to NetBSD]

For me, the good effect is at least that I'm getting less filesystem
inconsistencies after a crash.

Approved by christos quite a while ago.
2006-10-24 19:36:26 +00:00
reinoud 0ce809091d Replace the LIST structure mp->mnt_vnodelist to a TAILQ structure since all
vnodes were synced and processed backwards. This meant that the last
accessed node was processed first and the earlierst last.

An extra benefit is the removal of the ugly hack from the Berkly days on
LFS.

In the proces, i've also replaced the various variations hand written loops
by the TAILQ_FOREACH() macro's.
2006-10-20 18:58:12 +00:00
yamt 65a8f1c211 ffs_truncate: don't forget to zero the past eof in the case of
blocksize < pagesize.  PR/33777 from Simon Burge.
XXX check other filesystems, esp. lfs.
2006-10-17 11:39:18 +00:00
yamt 72fc92b729 ffs_alloc: remove an assertion which is no longer true. 2006-10-15 12:23:56 +00:00
yamt 560c0c565c don't use g_glock directly. 2006-10-14 09:17:26 +00:00
yamt b7cedb8e34 handle_workitem_freefrag/handle_workitem_freeblocks:
don't fake up inode/vnode pair.
2006-10-14 07:26:29 +00:00
hannken 3e0dbf3bc5 Add __unused to unused function arguments. 2006-10-13 10:21:21 +00:00
thorpej 25433eb1b5 ufs_quotactl(): consume the arguments even if QUOTAS is not defined. 2006-10-12 04:24:40 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
chs 33c1fd1917 add support for O_DIRECT (I/O directly to application memory,
bypassing any kernel caching for file data).
2006-10-05 14:48:32 +00:00
christos b64edcaded fix empty if 2006-10-04 15:53:24 +00:00
christos 45234b0cee Coverity CID 3690: Add KASSERT to check for reverse INULL. 2006-10-03 19:04:25 +00:00
christos df9ed85b34 redo previous: It is better to add a KASSERT, since this is code is same
with ufs.
2006-10-03 19:01:29 +00:00
christos b6bf786e1c Coverity CID 3690: Reverse INULL: Add KASSERT. 2006-10-03 18:59:22 +00:00
christos e11b3365c9 Coverity CID 3689: dp cannot be NULL at this point, so don't check for it. 2006-10-03 18:54:08 +00:00
christos 2b372f902d Coverity CID 3156: async = TRUE when LFS_READWRITE is defined, leading to
dead code. Ifdef the dead code appropriately (from Arnaud Lacombe)
2006-10-03 18:24:48 +00:00
christos f1a4e9cae0 Coverity CID 2949: comment out dead code (from Arnaud Lacombe) 2006-09-29 19:37:11 +00:00
perseant 2ac2813b6e Use lockstatus instead of a homebrewed locking system to control
LFCNWRAPSTOP and LFCNWRAPGO.

Be less verbose about the various looping checks: use log() rather than
printf(), and only log anything if we are really looping ("count = 2" is
not an error condition).

Allow dirops sleeping on available space to be interruptible.
2006-09-28 23:08:23 +00:00
jld 1b78265f0e Change ffs_mount, in MNT_UPDATE case, to check dev_t's for equality
instead of just vnode pointers.  Fixes erroneous "does not match mounted
device" errors from mount(8) in the presence of MFS /dev, init.root, &c.

No objections on tech-kern.
2006-09-21 00:11:30 +00:00
perseant 8c43e08b21 Don't remark a locked inode with IN_MODIFIED after writing it to disk,
if we ourselves hold the lock.  This prevents e.g. mknod from hanging
indefinitely.

Also, always use the return value from VOP_ISLOCKED to determine whether
we hold the lock or someone else does, rather than looking into the lock
structure ourselves.
2006-09-15 18:50:49 +00:00
yamt 9d3e3eab23 merge yamt-pdpolicy branch.
- separate page replacement policy from the rest of kernel
	- implement an alternative replacement policy
2006-09-15 15:51:12 +00:00
christos 7465b73617 add missing initializers 2006-09-02 07:04:01 +00:00
christos d74781a938 - add missing initializers
- comment out impossible code
2006-09-02 06:48:00 +00:00
christos 0dc26f6dcb remove impossible test 2006-09-02 06:46:04 +00:00
perseant 437e855235 Changes to help the roll-forward agent, to wit:
* Mark being-deleted files in the Ifile so we can finish deleting them
  at fs mount time.
* Flag the Ifile with "cleaner must clean" when writers are waiting for
  the cleaner, rather than relying solely on the cleaner's estimation of
  whether it should clean or not.
* Note partial segments written by a user agent (in particular,
  fsck_lfs) so that repeated rolls forward don't interfere with one
  another.
* Add a new fcntl, LFCNPASS, that allows the log to wrap exactly once,
  for better testing of the validity of checkpoints.
* Keep track of the on-disk nlink count when cleaning, so that we don't
  partially complete directory operations while cleaning.
* Ensure that every single Ifile inode write represents a consistent
  view of the filesystem.  In particular, the accounting for the segment
  we are writing the inode into must be correct, and the accounting for
  the segment that inode used to reside in must be correct.  Rather than
  just rewriting the inode if we wrote it wrong, rewrite the necessary
  ifile blocks before writing the inode so we never write it wrong.
* Don't unmark any VDIROP vnodes if we haven't written them to disk,
  avoiding yet another problem with the "wait for the cleaner" error
  return from lfs_putpages().

Also, move the last callback to an aiodone call, so we no longer do any
memory management from interrupt context.
2006-09-01 19:41:28 +00:00
christos 676e77765a fix missing initializers 2006-08-30 01:28:53 +00:00
christos 57b45699b2 fix incomplete initializer. 2006-08-30 01:26:47 +00:00
martin 12cf319c62 Fix size confusion with lfs_fhandle - and as it now turns out to be the same
as the lfs compat_30_fhandle, g/c the latter.
Add an alias for the LFCNIFILEFH fcntl, so that binaries compiled in the
meantime (with too large lfs_fhandle) continue to work.

This makes vfs_cleanerd work again after the kernel checks filehandle size
more strictly (problem reported by Kurt Schreiner on current-users).
2006-08-06 12:34:12 +00:00
martin b4cb63a646 Make filehandles opaque to userland 2006-07-31 16:34:42 +00:00
ad f474dceb13 Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
perseant 1e9b73d972 Oops, commit the correct version of lfs_rfw.c. The roll-forward functionality
is known not to work in this version (as it did not previously) but it should
at least compile.
2006-07-20 23:56:27 +00:00
perseant 83771be892 Separate the (non-working) LFS kernel roll-forward code into its own file,
lfs_rfw.c.
2006-07-20 23:49:07 +00:00
perseant 20227e112e Note partial segments that are written by the cleaner, to help out the
roll-forward agent.
2006-07-20 23:16:50 +00:00
perseant 186ffd50ab Loop on the check for lfs_nowrap, so we don't allow a process to squeeze by. 2006-07-20 23:15:39 +00:00
perseant 5fdcd70349 Move the kauth checks up front, so that all new LFS fcntl calls are subject
to the check for superuser privilege.
2006-07-20 23:14:09 +00:00
perseant 8c161d1081 Don't try to write all the vnodes, when the cleaner needs a vnode to be
recycled.
2006-07-20 23:12:26 +00:00
martin 74709a8860 Apply _KERNEL_OPT 2006-07-13 22:08:00 +00:00
martin 3fb505e6b2 Version the lfs_cleanerd internal fcntl() for filehandles too,
so old cleaners should work with newer kernels.
2006-07-13 22:05:52 +00:00
martin a3b5baed42 Fix alignement problems for fhandle_t, exposed by gcc4.1.
While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
2006-07-13 12:00:24 +00:00
perseant a2aa7212a8 Protect lfs_order_freelist() with the segment lock. 2006-07-06 22:27:19 +00:00
perseant b8ec630ade Fix a typo that caused a "multiple free" panic on unmounting a resized lfs. 2006-07-06 22:14:18 +00:00
perseant b99e4c8268 Don't wake up the cleaner if the filesystem is unwrappable, and fix the
compatibility fcntls.

Also includes one-line fixes for an MP locking bug and a zero-length FINFO
problem that manifested during testing.
2006-06-29 19:28:21 +00:00
perseant 1c57171fe3 Change LFCNWRAP{STOP,GO} to make them more suitable for snapshotting; in
particular, the caller can now choose whether to wait for the condition
to be met, and if the caller of LFCNWRAPSTOP dies or otherwise closes
the descriptor, the filesystem is started again.  Updated the ckckp
regression test to use the new semantics.

dump_lfs(8) now uses the fcntls to implement LFS-style snapshotting through
the -X flag, addressing PR#33457 albeit not using fss(4).  Fixed a couple
other problems with dump_lfs that manifested themselves during testing.
2006-06-24 05:28:54 +00:00
yamt e408053d1b fix a simonb-timecounters regression.
the precision of getnanotime() is not suitable for file timestamps.
esp. when it's nfs-exported.

- introduce vfs_timestamp().
  (the name is from freebsd.  currently merely a wrapper of nanotime())
- for ufs-like filesystems, use it rather than getnanotime().

XXX check other filesystems.
2006-06-23 14:13:02 +00:00
hannken 442bf57d1c softdep_sync_metadata: If vp is a block device it may have new I/O requests
posted for it even if the vnode is locked. This will deadlock with wmesg
"softgetdbuf" if it gets a BMSAFEMAP dependency as here we have "bp == nbp"
and try to get a buffer we already own.

Approved by: Frank van der Linden <fvdl@netbsd.org>
2006-06-12 16:37:00 +00:00
kardel 1276c3051e PR 33697: complete timecounter conversion 2006-06-11 09:26:04 +00:00
kardel de4337ab21 merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
  time.tv_sec -> time_second
- struct timeval mono_time is gone
  mono_time.tv_sec -> time_uptime
- access to time via
	{get,}{micro,nano,bin}time()
	get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
  Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
  NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
2006-06-07 22:33:33 +00:00
perseant 402f3abc7a Read the inode version number fro a more reliable source, quelling a
diagnostic assertion panic.
2006-05-24 21:08:00 +00:00
cube d897e3cfdb Include <sys/kauth.h> because it's needed. 2006-05-21 22:51:27 +00:00