Commit Graph

142 Commits

Author SHA1 Message Date
joerg b25f8d4458 Use the same loop order for freeing as for allocation. Simpler code and
easier to process for analyzers.
2012-04-12 10:30:17 +00:00
perseant ccf39d2d9b Shut down the cleaner earlier if the filesystem is unmounted. 2012-02-02 03:47:11 +00:00
perseant 72d61f7290 In lfs_cleanerd, check errno earlier, to avoid premature exit when the
real errno was EAGAIN.

When coalescing, check against NULL to avoid seg fault.
2012-01-02 21:35:17 +00:00
joerg 017dd250ef Fix memset usage. 2011-07-01 02:46:24 +00:00
mlelstv e5275d16e0 Deduce raw device correctly by prepending "r" to basename. 2010-12-23 18:08:41 +00:00
pooka 0fb1ef7452 Don't exit when running as a lib after FS is unmounted, just return
from the mainloop.
2010-08-16 22:11:55 +00:00
pooka d9a3123e84 Do the semaphore trick only if the cleaner is run as a lib -- the
standard installation doesn't get linked against librt or libpthread.
2010-07-29 14:09:45 +00:00
pooka 4f52188eb0 Add a method for posting a semaphore when cleaner init has reached
the main loop.  This is useful for very quickly executed lfs runs
such as those in tests, as an initialization phase cleaner may
prevent file system unmount.
2010-07-29 14:07:39 +00:00
pooka fc729209b1 always add to SRCS 2010-07-28 22:35:52 +00:00
mlelstv b076c4eba1 Read the padded superblocks to avoid problems with disks that have
larger sectors than 512 Bytes.
2010-02-16 23:13:13 +00:00
pooka 977fb405f8 LDADD+= instead of LDADD= 2009-10-09 20:19:44 +00:00
pooka 494379efaf Attempt to recover slightly more gracefully if the kernel socket is shutdown. 2009-10-09 16:35:17 +00:00
wiz 175898c4a2 Describe -D. Bump date. 2009-08-06 21:18:54 +00:00
pooka 709a4d5bb6 Define syscalls of lfs userspace tools (cleaner, mainly) through
a struct called kernelops, which contains standard system calls
for the normal case and rump system calls for the rump case.

Make it possible to run the lfs cleaner in a library fashion (taking
the quick route with the implementation).
2009-08-06 00:51:55 +00:00
pooka 0013bbb8eb add D to getopt so that previous actually works 2009-08-06 00:23:08 +00:00
pooka b5cf475347 add -D, which prompts to stay on foreground without debug spewage 2009-08-06 00:20:45 +00:00
pooka e2863984f7 Check main loop fcntl return value and error out if it fails.
Prevents e.g. from 5.0 cleaner looping forever against -current
lfs driver (fcntl data structure sizes are different).
2009-08-06 00:05:01 +00:00
christos 1b829b2a68 PR/40965: NAKAJIMA Yoshihiro: lfs_cleanerd isn't adapted to !MKDYNAMICROOT 2009-06-21 20:20:50 +00:00
lukem 500db00274 Default to WARNS=4
Exceptions that need a lower level are:
	getty ld.elf_so lfs_cleanerd makewhatis telnetd tftpd
	hpropd ipropd-master ipropd-slave kadmind kpasswdd
2009-03-16 02:24:55 +00:00
lukem bb15c5ac36 fix WARNS=3 issues;
* sprinkle const
* avoid tests < 0 on unsigned types
* test fwrite() returns nmemb not <0
2009-03-16 00:08:10 +00:00
lukem f3479fb8e4 avoid a shadowed variable 2009-03-15 23:56:24 +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
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
ad 2b5d04688e Make it build with src/sys from the vmlocking2 branch. 2007-12-28 21:44:32 +00:00
ad 9c5739f1c6 brelse() now takes two arguments. 2007-10-08 21:41:12 +00:00
wiz fc86b06120 Bump date for previous. 2006-12-23 07:21:34 +00:00
tls 86c7b9ff84 Temporarily disable -c (file coalescing) until data corruption issues can
be resolved.
2006-11-18 18:43:25 +00:00
jmmv 2947e73b43 Move lfs_cleanerd from /usr/libexec to /libexec. This is to allow putting
the root file system on a LFS volume.

Addresses PR bin/30407.  No objections in tech-userlevel@.
2006-11-11 14:47:27 +00:00
perseant a2ecf39b35 Pay attention to the new LFS_CLEANER_MUST_CLEAN flag in the Ifile. 2006-09-01 19:43:51 +00:00
martin b4cb63a646 Make filehandles opaque to userland 2006-07-31 16:34:42 +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 21393db687 Place an upper bound on the number of segments to clean at one time, no
matter how empty they are.

Note that if two blocks have the same inode and block number, they sort
the same (this should never happen, but if it does there's no reason to
have qsort scramble the list).

Add some diagnostic syslog messages for unusual cases.
2006-07-07 18:19:30 +00:00
christos df73c1693c Coverity CID 3766: Avoid null pointer deref 2006-05-19 14:46:17 +00:00
perseant 45dc123d6e Be more careful about checking return value of {m,re}alloc().
In determining when to stop reading segments when counting bytes (-b flag),
total the sizes of the blocks we're actually writing instead of assuming
they are all full blocks: many could be fragments or inode blocks.  This
increases the number of segments per Ifile write, markedly improving the
efficiency of the cleaner in the small file case.
2006-05-12 19:33:02 +00:00
mrg bb50bce731 avoid some char * vs. u_char * issues. 2006-05-11 12:26:38 +00:00
perseant 0cdeebe9fa When checking hidden cleaning costs, don't erroneously add the first
indirect block when considering the cleaning of block numbers less
than NDADDR (which do not use indirect blocks).

Also, note the loss of only half a block per segment to fragmentation
when considering the benefit function, rather than a whole block.
2006-04-14 00:58:32 +00:00
perseant 1b08b7c6a1 Look for the inode pointers in the right place if lfs_bsize != lfs_fsize. 2006-04-05 21:42:49 +00:00
perseant 2c3f7b46ba Handle the case of inode blocks misidentified by the segment headers
correctly, a problem reported by Kurt Schreiner; as well as similar
error cases (realloc returning NULL or no cleanable segments found).
2006-04-05 20:29:40 +00:00
christos bfe8a650d3 Coverity CID 2792: Fix memory leaks 2006-04-01 23:53:11 +00:00
christos 2b955dc8fb Coverity CID 2846: Don't use LIST_FOREACH if you are going to free the cursor 2006-04-01 23:50:50 +00:00
christos f1e970a046 Coverity CID 2847: Don't use LIST_FOREACH if you are going to free the
current pointer!
2006-04-01 23:48:56 +00:00
perseant 260a2c76af Document -i option, update date; at the request of wiz@. 2006-04-01 08:44:57 +00:00
perseant 9c75397609 A new version of the cleaner. In general, works about as well as the old
cleaner, but with more legible code.

Includes code for reading and writing to the raw disk device (so that an
unmounted fs could be cleaned), for the use of a single daemon to clean
multiple filesystems to save on resources, and for recording the old
contents of cleaned segments to offline storage for regression testing of
the LFS system as a whole; though these new features are not properly
tested at this point.
2006-03-30 19:10:13 +00:00
christos fdd5a2fbdd Change PRiu64 with a cast and %llu. I am not using PRIu32 and no cast for
now. I will do so in a separate pass that will fix all the inode printing.
2005-08-23 05:55:29 +00:00
kent 8dbae00531 fix compilation problem on LP64 2005-08-20 14:58:34 +00:00
christos d05efd58f3 64 bit inode changes. 2005-08-19 02:06:29 +00:00
christos 467d3a1e76 remove bogus frees on uninitialized variable. 2005-05-03 00:20:17 +00:00
perseant 2f695b5476 Provide a resize_lfs(8), including kernel and cleaner support. The current
implementation requires the fs to be mounted while resizing.  Tested in both
directions, and everything appears to work happily, but ymmv.
2005-04-23 19:47:51 +00:00
xtraeme dc7d7d7780 Add missing flags to usage() 2005-03-30 21:28:30 +00:00
perseant 6e52bfc264 Various minor LFS improvements:
* Adapt lfs_cleanerd to use the fcntl call to get the Ifile filehandle,
  so it need not be in the namespace.
* Make lfs_cleanerd be more careful when there are very few available
  segments.
* Remove the Ifile from the filesystem namespace.  The cleaner now uses
  a fcntl call on the root inode to find the Ifile filehandle.
* Make lfs_cleanerd less verbose when the filesystem is unmounted.
2005-02-26 05:43:04 +00:00