dragonfly.git
14 years agodma: don't block when trying to aquire a queue file
Simon Schubert [Tue, 21 Jul 2009 23:21:44 +0000 (01:21 +0200)]
dma: don't block when trying to aquire a queue file

We might race with some other process, so it is imperative to treat a
locked file as a soft error instead of blocking on the file until the
other process unlocks it.

14 years agodma: don't block on lock/opening the mbox file, backoff instead
Simon Schubert [Tue, 21 Jul 2009 23:20:54 +0000 (01:20 +0200)]
dma: don't block on lock/opening the mbox file, backoff instead

14 years agodma: accept -q without argument. report argument errors.
Simon Schubert [Tue, 21 Jul 2009 23:20:08 +0000 (01:20 +0200)]
dma: accept -q without argument.  report argument errors.

14 years agodma: add comments for ESMTP support
Simon Schubert [Tue, 21 Jul 2009 00:29:02 +0000 (02:29 +0200)]
dma: add comments for ESMTP support

14 years agodma: treat seek errors as permanent errors
Simon Schubert [Tue, 21 Jul 2009 00:28:46 +0000 (02:28 +0200)]
dma: treat seek errors as permanent errors

14 years agodma: more loudly note that we should query for MX records
Simon Schubert [Mon, 20 Jul 2009 23:51:45 +0000 (01:51 +0200)]
dma: more loudly note that we should query for MX records

14 years agodma: fix various bugs in local mbox delivery
Simon Schubert [Mon, 20 Jul 2009 21:27:50 +0000 (23:27 +0200)]
dma: fix various bugs in local mbox delivery

14 years agodma: fix mail bouncing
Simon Schubert [Mon, 20 Jul 2009 21:27:37 +0000 (23:27 +0200)]
dma: fix mail bouncing

14 years agodma: always log error exits
Simon Schubert [Mon, 20 Jul 2009 20:48:00 +0000 (22:48 +0200)]
dma: always log error exits

14 years agodma: drop CVS ids
Simon Schubert [Mon, 20 Jul 2009 19:58:39 +0000 (21:58 +0200)]
dma: drop CVS ids

14 years agodma: rewrite file management
Simon Schubert [Mon, 20 Jul 2009 19:53:32 +0000 (21:53 +0200)]
dma: rewrite file management

Close files as early as possible, possibly re-open them later.  This is
so that we avoid filedesc sharing problems completely and that we won't
run out of fdesc in case of a large queue.

14 years agodma: correct logic for setting the locked flag
Simon Schubert [Mon, 20 Jul 2009 11:33:09 +0000 (13:33 +0200)]
dma: correct logic for setting the locked flag

14 years agodma: restructure logging
Simon Schubert [Sun, 19 Jul 2009 23:20:27 +0000 (01:20 +0200)]
dma: restructure logging

Don't carry the ident manually.  Instead set a global tag once the
ident is fixed.

14 years agodma: note that the data file provides the id
Simon Schubert [Sun, 19 Jul 2009 14:01:58 +0000 (16:01 +0200)]
dma: note that the data file provides the id

14 years agodma: rework queue handling
Simon 'corecode' Schubert [Sun, 2 Nov 2008 00:10:10 +0000 (01:10 +0100)]
dma: rework queue handling

14 years agodma: Move comment.
Simon 'corecode' Schubert [Mon, 27 Oct 2008 05:45:12 +0000 (06:45 +0100)]
dma: Move comment.

14 years agodma: Re-arrange argument consistency checks.
Simon 'corecode' Schubert [Fri, 17 Oct 2008 07:32:26 +0000 (09:32 +0200)]
dma: Re-arrange argument consistency checks.

14 years agodma: better tag handling
Simon 'corecode' Schubert [Thu, 16 Oct 2008 15:45:10 +0000 (17:45 +0200)]
dma: better tag handling

14 years agoEXT2FS: support variable inode size.
Matthew Dillon [Tue, 21 Jul 2009 19:39:03 +0000 (12:39 -0700)]
EXT2FS: support variable inode size.

Obtained-from: FreeBSD
Cherry-picked-from: http://github.com/polachok/dragonflybsd/commit/d8b7a4caaa2724148e95939207977a0730c349b2
Submitted-by: Alexander Polakov
14 years agoSync zoneinfo database with tz{code,data}2009k from elsie.
Sascha Wildner [Mon, 20 Jul 2009 23:19:53 +0000 (01:19 +0200)]
Sync zoneinfo database with tz{code,data}2009k from elsie.

africa:         8.21 -> 8.22
asia:           8.35 -> 8.36
europe:         8.21 -> 8.22
leapseconds:    8.8  -> 8.9

zic.c:          8.19 -> 8.20

From Arthur David Olson's comments:

* africa: Change Mauritius to reflect that the 2008-2009 DST experiment
      is not repeated (and to change end of DST in 2009 from 2:00
      standard time to 2:00 local time) (thanks to Steffen Thorsen).

* asia: Arbitrarily cut off Dhaka DST at end of 2009 (so that a POSIX-
      style time zone string can appear in the Dhaka binary file, and
      for the benefit of systems with old glibc reimplementations of
      the time zone library that don't handle permanent DST correctly).
      Note that another change will be needed once the real end date
      for DST in Dhaka is known.

* europe: Update URL for Directive 2000/84/EC on summer-time
      arrangements (thanks to Colin Watson and Ian Jackson).

* leapseconds: Change "no leap second" comment (no leap second at end
      of 2009).

* zic.c: Do not end a binary file with a POSIX-style time zone string
      for locations that end up in permanent DST (thanks to Andreas Schwab).

14 years agoUpdate gzip.
Peter Avalos [Sat, 18 Jul 2009 23:35:46 +0000 (13:35 -1000)]
Update gzip.

- gzexe: Ensure we do not compress files we need for decompressing by
also checking hard links. From Andrew Dalgleish. (from OpenBSD)
- note that -n also stops the timestamp from being output.
- Don't abort decompression if there are no bytes in the output buffer
when the end of compressed block (ie the crc) is reached.
(ie when decompressing concatenated zipped files).
- If stdin is the input stream, fstat it and check if it's
file. If so, use it's mtime for the mtime in the header. Otherwise use
time(2)'s result instead. Lines up with GNU gzip and RFC 1952 now as
well.
- Fix parsing of $GZIP so that not to overrun the end of string.
- handle partial reads.
- avoid an infinite loop while decompressing invalid gzip files.
- in file_compress() always stat() the input file.  this patch avoids
reading from uninitialised space.
- Fix a few issues:
 gzip -vt just prints the contents of a .Z file
 gzip -vt will print OK even if the .gz file is corrupt
 gzip -vt prints nothing with a .bz2 file
 gzip can loop endlessly with a corrupt .bz2 file
- Don't warn about >4GB files not having their size correctly stored.
- Remove unhandled H option from getopt() argument. Describe -l in usage.
- properly check the return value of read() & pread().
- Delete impossible code.
- Abort decompression with an error when EOF is reached on input. The
test output will then be 'NOT OK'.
- End a decompression when trailing garbage is found. It emits a warning
message and causes a non-zero exit status (similar to GNU gzip).
- properly detect when the output fails (eg, full filesystem) and do not
delete the input file.

Dragonfly-bug: http://bugs.dragonflybsd.org/issue1026

14 years agoNFS - Increase default read-ahead from 4 to 6
Matthew Dillon [Sat, 18 Jul 2009 22:09:40 +0000 (15:09 -0700)]
NFS - Increase default read-ahead from 4 to 6

But continue to play nice with the server.

14 years agoNFS - Implement async write BIO, greatly increase sockbuf limits, better rexmit
Matthew Dillon [Sat, 18 Jul 2009 22:03:49 +0000 (15:03 -0700)]
NFS - Implement async write BIO, greatly increase sockbuf limits, better rexmit

* Write BIOs are now executed asynchronously.

* Commit BIOs are now executed asynchronously.

* Increase the sockbuf limit to around 2MBytes, which is what is needed
  to handle the burst writing a DragonFly client can do now when the
  kernel flushes its buffers (at least for a UDP socket).

* Adjust the rexmit code.  Also detect duplicate packets received and
  adjust the SRTT up a little since no RTT is calculated when a timeout
  occurs.

* NEW SYSCTLS:

  vfs.nfs.soreserve - This parameter now overrides all other kernel and
  user parameters to set the NFS sockets limit.

  vfs.nfs.maxasyncbio - This is set to the hard-coded maximum by default
  and may be reduced to accomodate insufficiently
  endowed remote servers.

* NOTE ON UDP MOUNTS TO REMOTE SERVERS.  If the remote server does not have
  sufficient sockbuf space to receive a large burst of UDP packets performance
  will suffer greatly.  To allieviate this issue you can decrease
  vfs.nfs.maxasyncbio on the DragonFly client, or you can simply use a
  TCP mount.

14 years agoThe limit specified in kern.ipc.maxsockbuf only applies to userland.
Matthew Dillon [Sat, 18 Jul 2009 22:01:07 +0000 (15:01 -0700)]
The limit specified in kern.ipc.maxsockbuf only applies to userland.

This sysctl parameter no longer effects kernel-created or kernel-controlled
sockets whos maximum sizes are specified by other sysctls.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sat, 18 Jul 2009 15:19:50 +0000 (08:19 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoNFS - Fix panic on umount/reboot
Matthew Dillon [Sat, 18 Jul 2009 15:18:49 +0000 (08:18 -0700)]
NFS - Fix panic on umount/reboot

* The rx thread sometimes gets no-error and 0-bytes returned from
  its soreceive call, but the caller expects a mbuf in that case.
  Check for the case and convert to EPIPE.

14 years agonfsclient: nfsiod isn't used anymore
Thomas Nikolajsen [Sat, 18 Jul 2009 10:39:39 +0000 (12:39 +0200)]
nfsclient: nfsiod isn't used anymore

 * Remove nfsclient rc.conf variable; it was just passed to nfsiod

 * Remove nfsiod execution from rc.d/nfsclient

14 years agorc.d/nfsclient: Put newline after last action
Thomas Nikolajsen [Sat, 18 Jul 2009 10:23:10 +0000 (12:23 +0200)]
rc.d/nfsclient: Put newline after last action

14 years agorc.d/random: Fix typos
Thomas Nikolajsen [Sat, 18 Jul 2009 11:35:33 +0000 (13:35 +0200)]
rc.d/random: Fix typos

rc.d/random feed_dev_random() would leave seedenable=1;
no effect in default config:
feed_dev_random not called as entropy_file and entropy_dir both unset.

14 years agoImport complex arithmetic functions from {Net,Free}BSD.
Stathis Kamperis [Sat, 18 Jul 2009 06:49:51 +0000 (09:49 +0300)]
Import complex arithmetic functions from {Net,Free}BSD.

swildner@ helped test it with llvm/clang.
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue1424>

14 years agoNFS - Stability pass / recent work.
Matthew Dillon [Sat, 18 Jul 2009 05:31:28 +0000 (22:31 -0700)]
NFS - Stability pass / recent work.

* Fix numerous bugs introduced in the conversion, on both the server side
  and the client side.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sat, 18 Jul 2009 01:35:13 +0000 (18:35 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoNFS - Rewrite the RTT code and the request flags & low level state machine
Matthew Dillon [Sat, 18 Jul 2009 01:25:05 +0000 (18:25 -0700)]
NFS - Rewrite the RTT code and the request flags & low level state machine

* The RTT code basically did not work with UDP, and never has very well.
  Use a somewhat different algorithm and make more of an assumption that
  the network is either reliable, or if it isn't reliable that the sysad
  is using a reliable protocol (such as TCP).

  The new RTT code should do a better job, though there will still
  be significant stalling on a lossy network if using UDP (too bad!).

* Replace the congestion control code.  Instead of trying to defer
  packet transmission to the nfs_timer, which we no longer run at
  insane rates, we instead limit the number of async BIOs we allow
  to be queued at any given moment.

* Redo the req->r_flags flags and the low level RPC interlocks between
  the various consumers and producers.  Add additional flags that
  can be tested in assertions to validate expectations.

  Use R_LOCKED for more then just the nfs_timer code.

* Close a memory hole.

* Hold critical sections to close races that could result in a
  thread deadlocking in soreceive waiting for a reply that another
  thread already processed.

* Add two sysctls to aid in testing.

    vfs.nfs.showrexmit - Causes "X" to be printed on the console whenever
  NFS feels that it must retransmit a RPC.  Only
  occurs with UDP mounts.

    vfs.nfs.showrtt - Causes NFS to print out the SRTT, SDRTT, and
  converted timeout calculation once a second
  while NFS requests are active.

* Increase the asynchronous BIO limits.  Because we only need two helper
  threads and no longer depend on dozens of synchronous-rpc threads
  (the old nfsiod's), there is no practical limit to the number of
  requests we can have active.

  Reformulate how asynchronous BIOs are accounted for.  They are now
  accounted for from the moment they are queued to the very end where
  they are biodone()'d.

14 years agotsleep_interlock() - Fix bug in cpu_lwp_exit().
Matthew Dillon [Sat, 18 Jul 2009 00:55:52 +0000 (17:55 -0700)]
tsleep_interlock() - Fix bug in cpu_lwp_exit().

* Fix a bug in cpu_lwp_exit() which could cause a TAILQ assertion due to
  a thread not being properly removed from the tsleep queue.

14 years agoAPIC ABI: Support 32 IDT vectors
Sepherosa Ziehau [Fri, 17 Jul 2009 11:14:17 +0000 (19:14 +0800)]
APIC ABI: Support 32 IDT vectors

For two IO APIC hardware configuration, it is now common that number
of needed IDT vectors goes beyond 24, since we pre-allocate the PCI
irq number (irq number and IDT vector is 1:1 mapping) during MP table
parsing.

Reported-by: y0netan1@
14 years agoRemove unused macro
Sepherosa Ziehau [Fri, 17 Jul 2009 10:56:26 +0000 (18:56 +0800)]
Remove unused macro

14 years agoNFS - Fix unmounting blockages, fix tick interval, hack cpu assignments.
Matthew Dillon [Fri, 17 Jul 2009 11:38:35 +0000 (04:38 -0700)]
NFS - Fix unmounting blockages, fix tick interval, hack cpu assignments.

* Umount was having problems due to the way the helper threads were
  being shutdown.  Should be fixed.

* The NFS timer, which is responsible for handling retransmits and
  timeouts, did not need to be set to one tick (10ms).  200ms is
  just fine.

* Hack cpu assignments for the tx and rx helper threads.

14 years agoNFS - implement async state machine for nfs_readrpc_bio()
Matthew Dillon [Fri, 17 Jul 2009 10:02:13 +0000 (03:02 -0700)]
NFS - implement async state machine for nfs_readrpc_bio()

Implement the basic state machine mechanics to allow the two
helper threads to separate transmit and receive work for any
number of NFS RPCs.

14 years agoNFS - refactor nfs_request() and add state machine fields to nfsm_info
Matthew Dillon [Fri, 17 Jul 2009 02:37:21 +0000 (19:37 -0700)]
NFS - refactor nfs_request() and add state machine fields to nfsm_info

* nfs_request() now operates as a state machine and can be told to
  return when it reaches any state, allowing RPC sequences to be
  split up (to be used by the new iod).

14 years agoNFS - Cleanup pass -factor out strict temporaries from nfsm_info
Matthew Dillon [Fri, 17 Jul 2009 01:22:22 +0000 (18:22 -0700)]
NFS - Cleanup pass -factor out strict temporaries from nfsm_info

14 years agoNFS - Fix refactor bugs.
Matthew Dillon [Fri, 17 Jul 2009 00:03:55 +0000 (17:03 -0700)]
NFS - Fix refactor bugs.

* The new ERROROUT macro unconditionally overwrites error.  Don't use
  it for cases where we wish to retain a prior error.

14 years agoNFS - Marathon - completely refactor the nfsm_* macros.
Matthew Dillon [Thu, 16 Jul 2009 23:21:36 +0000 (16:21 -0700)]
NFS - Marathon - completely refactor the nfsm_* macros.

Completely refactor the nfsm_*() macros in nfsm_subs.h, converting
all of them to procedures in nfsm_subs.c.

Add a nfsm_info structure to track the persistent state that the code
depends on, and remove all related local variables from the other bits
of the NFS code.

14 years agorelease engineering: record 2.3.2 in subvers
Simon Schubert [Thu, 16 Jul 2009 22:10:18 +0000 (00:10 +0200)]
release engineering: record 2.3.2 in subvers

14 years agostdio.h: declare snprintf also for XSI 5
Simon Schubert [Thu, 16 Jul 2009 08:43:12 +0000 (10:43 +0200)]
stdio.h: declare snprintf also for XSI 5

We restricted declaration of snprintf and vsnprintf to C99, but it is
also part of XSI 5.

Noticed-by: hasso@
14 years agoNFS - create nfsm_subs.c, clean up externs
Matthew Dillon [Thu, 16 Jul 2009 15:19:14 +0000 (08:19 -0700)]
NFS - create nfsm_subs.c, clean up externs

* Move nfsm_*() procedures from nfs_subs.c to nfsm_subs.c

* Clean up externs improperly embedded in .c files.

14 years agodma: add required headers if they are not present
Simon Schubert [Thu, 16 Jul 2009 14:04:25 +0000 (16:04 +0200)]
dma: add required headers if they are not present

RFC2822 states that we must or should include the Date, Message-Id, and
From headers, so add them if they are not present in the message.

14 years agodma: use ANSI string continuations
Simon Schubert [Thu, 16 Jul 2009 13:23:44 +0000 (15:23 +0200)]
dma: use ANSI string continuations

14 years agodma: pass over the code and improve error handling
Simon Schubert [Thu, 16 Jul 2009 13:18:29 +0000 (15:18 +0200)]
dma: pass over the code and improve error handling

14 years agodma: clean up network code
Simon Schubert [Thu, 16 Jul 2009 12:08:22 +0000 (14:08 +0200)]
dma: clean up network code

- free memory where necessary
- don't just abort without error message
- don't bounce if we want to defer the message

14 years agodma: treat encrypted connections as secure
Simon Schubert [Thu, 16 Jul 2009 11:43:28 +0000 (13:43 +0200)]
dma: treat encrypted connections as secure

Users have to set the INSECURE config option to allow dma to send
plaintext passwords on login.  This commit allows dma to send plaintext
passwords through TLS connections even if the INSECURE config option is
not set.

The downside is that this allows a man-in-the-middle attack on the
password exchange.  The only solution to this is checking the server
certificate, but we don't do that (yet).

14 years agodma: properly close and free SSL connection state
Simon Schubert [Thu, 16 Jul 2009 11:40:12 +0000 (13:40 +0200)]
dma: properly close and free SSL connection state

14 years agodma: log mail queueing more thoroughly
Simon Schubert [Thu, 16 Jul 2009 11:31:11 +0000 (13:31 +0200)]
dma: log mail queueing more thoroughly

Directly log when a mail is accepted and not only when a delivery attempt
is made.

14 years agodma: note that we will have to clean up SSL state
Simon Schubert [Thu, 16 Jul 2009 10:52:00 +0000 (12:52 +0200)]
dma: note that we will have to clean up SSL state

14 years agodma: unconditionally use openssl
Simon Schubert [Thu, 16 Jul 2009 10:24:44 +0000 (12:24 +0200)]
dma: unconditionally use openssl

Drop HAVE_CRYPTO and unconditionally use openssl.  Dma is supposed to be
small and secure, so there is no way around openssl anyways.

14 years agodma: implement alternate identity for mailq
Simon Schubert [Thu, 16 Jul 2009 10:10:51 +0000 (12:10 +0200)]
dma: implement alternate identity for mailq

mailq does not take the standard sendmail options, but behaves like -bp.

14 years agodma: correctly initialize error before delivering mail
Simon Schubert [Thu, 16 Jul 2009 09:54:44 +0000 (11:54 +0200)]
dma: correctly initialize error before delivering mail

error is used to return failure or success from deliver_remote().  However
error is also used before, so we have to make sure that it is initialized
to 0, else a previous (non-fatal) error could pull through, even if the
delivery was successful.

14 years agodma: adjust syslog logging levels
Simon Schubert [Thu, 16 Jul 2009 09:40:39 +0000 (11:40 +0200)]
dma: adjust syslog logging levels

Most invocations of syslog used LOG_ERR.  Clearly this is not good
practise.  Adjust the levels to be reasonable.

14 years agodma: always send EHLO after tls setup
Simon Schubert [Thu, 16 Jul 2009 09:30:10 +0000 (11:30 +0200)]
dma: always send EHLO after tls setup

We have to send EHLO even after a STARTTLS, so unconditionally send it
after connection/tls setup.

14 years agodma: prevent races from sharing fd between children
Simon Schubert [Thu, 9 Jul 2009 21:24:35 +0000 (23:24 +0200)]
dma: prevent races from sharing fd between children

On fork, fds are shared between children.  If two processes work on
different recipients, but on the same queue file, they might get
confused when the fd (and thus the offset) is shared.  Prevent this by
re-opening the queue file after fork.

Reported-by: Daniel Roethlisberger <daniel@roe.ch>
14 years agodma: restructure set_username
Simon Schubert [Thu, 9 Jul 2009 20:30:40 +0000 (22:30 +0200)]
dma: restructure set_username

Restructure to perform early exit and check for strdup() error.

14 years agodma: constify bounce reason and avoid strdup
Simon Schubert [Thu, 9 Jul 2009 20:21:26 +0000 (22:21 +0200)]
dma: constify bounce reason and avoid strdup

We don't need to care about freeing the bounce reason string, because
bounce is only called once.  Convert all bounce reason strings to
const char * and avoid calling strdup() on them.  Dynamic strings from
asprintf() need some de-const massaging.

14 years agodma: ignore a whole slew of sendmail options
Simon Schubert [Thu, 9 Jul 2009 12:37:17 +0000 (14:37 +0200)]
dma: ignore a whole slew of sendmail options

Probably some more left.

Submitted-by: Peter Pentchev <roam@ringlet.net>
14 years agodma: better logic for guessing username
Simon Schubert [Thu, 9 Jul 2009 12:37:16 +0000 (14:37 +0200)]
dma: better logic for guessing username

Apply better logic to guess the username when getlogin(3) is not
available for some reason, e.g. no login session at all, no access
to utmp/wtmp, etc.

Submitted-by: Peter Pentchev <roam@ringlet.net>
14 years agodma: add the MAILNAME and MAILNAMEFILE config options
Simon Schubert [Thu, 9 Jul 2009 12:37:16 +0000 (14:37 +0200)]
dma: add the MAILNAME and MAILNAMEFILE config options

Submitted-by: Peter Pentchev <roam@ringlet.net>
14 years agodma: add FULLBOUNCE config option
Simon Schubert [Thu, 9 Jul 2009 19:19:40 +0000 (21:19 +0200)]
dma: add FULLBOUNCE config option

FULLBOUNCE will include the full message in the bounce

Submitted-by: Peter Pentchev <roam@ringlet.net>
14 years agodma: provide proper bounce error message
Simon Schubert [Thu, 9 Jul 2009 19:15:54 +0000 (21:15 +0200)]
dma: provide proper bounce error message

This may not be the best solution - the error message buffer has now
turned dynamic, but the only alternative I see is to make it a static
array in net.c... and I'm not quite sure if I want to do that just now.

Submitted-by: Peter Pentchev <roam@ringlet.net>
14 years agodma: lock temp files on creation
Simon Schubert [Thu, 9 Jul 2009 12:37:16 +0000 (14:37 +0200)]
dma: lock temp files on creation

Lock the temporary files after creating them to protect from a "dma -q"
run at just the wrong time causing a double delivery attempt for
the same message.

Submitted-by: Peter Pentchev <roam@ringlet.net>
14 years agodma: various code hardening
Simon Schubert [Thu, 9 Jul 2009 12:37:16 +0000 (14:37 +0200)]
dma: various code hardening

(as found by the Debian hardening wrapper)

- check the result of fgets()
- loop the network writes until the whole thing is sent
- check one more write() result

Submitted-by: Peter Pentchev <roam@ringlet.net>
14 years agodma: note that the -q option requires an unused argument
Simon Schubert [Thu, 9 Jul 2009 12:37:16 +0000 (14:37 +0200)]
dma: note that the -q option requires an unused argument

Submitted-by: Peter Pentchev <roam@ringlet.net>
14 years agodma: fix two typos and a word order problem
Simon Schubert [Thu, 9 Jul 2009 12:37:15 +0000 (14:37 +0200)]
dma: fix two typos and a word order problem

Submitted-by: Peter Pentchev <roam@ringlet.net>
14 years agodma: also list locked queue files
Simon Schubert [Thu, 9 Jul 2009 12:37:15 +0000 (14:37 +0200)]
dma: also list locked queue files

When listing the queue, show all messages, even those that are
currently locked for delivery.  Indicate the lock with a '*' after
the queue ID.

Submitted-by: Peter Pentchev <roam@ringlet.net>
14 years agodma: bounce message instantly on permanent remote delivery errors
Simon Schubert [Thu, 9 Jul 2009 12:37:15 +0000 (14:37 +0200)]
dma: bounce message instantly on permanent remote delivery errors

Submitted-by: Peter Pentchev <roam@ringlet.net>
14 years agodma: treat a QUIT error as merely a warning
Simon Schubert [Thu, 9 Jul 2009 12:37:15 +0000 (14:37 +0200)]
dma: treat a QUIT error as merely a warning

RFC 2821 only mandates that a QUIT error should abort an unfinished
transaction, and since we've reached this point, the DATA command has
succeeded and the message has been accepted for delivery by the remote
end.  Thus, just warn about it.

Submitted-by: Peter Pentchev <roam@ringlet.net>
14 years agodma: properly log last remote status message
Simon Schubert [Thu, 9 Jul 2009 12:37:15 +0000 (14:37 +0200)]
dma: properly log last remote status message

Store the last error or status message received from the remote server in
the neterr[] buffer and display it instead of the meaningless %m in
remote delivery syslog messages.

Submitted-by: Peter Pentchev <roam@ringlet.net>
14 years agodma: several fixes to make dma build on non-BSD OS's
Simon Schubert [Thu, 9 Jul 2009 12:37:14 +0000 (14:37 +0200)]
dma: several fixes to make dma build on non-BSD OS's

- replace open(..., O_EXLOCK) with a new open_locked() routine;
- define the __unused function attribute;
- do not redefine PATH_MAX.

Submitted-by: Peter Pentchev <roam@ringlet.net>
14 years agohammer expand: add manpage
Michael Neumann [Thu, 16 Jul 2009 12:56:47 +0000 (14:56 +0200)]
hammer expand: add manpage

14 years agohammer expand: Use default values for boot/mem area
Michael Neumann [Thu, 16 Jul 2009 12:26:00 +0000 (14:26 +0200)]
hammer expand: Use default values for boot/mem area

14 years agohammer expand: Refactor code
Michael Neumann [Thu, 16 Jul 2009 12:18:39 +0000 (14:18 +0200)]
hammer expand: Refactor code

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Thu, 16 Jul 2009 06:47:44 +0000 (23:47 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoNFS - install nfsmount on nfs_mountq, for timeout handling.
Matthew Dillon [Thu, 16 Jul 2009 06:46:07 +0000 (23:46 -0700)]
NFS - install nfsmount on nfs_mountq, for timeout handling.

* This way the timeout callout can find all the requests.

14 years agoNFS - Remove old nfsiod, start adding new kernel thread infrastructure
Matthew Dillon [Thu, 16 Jul 2009 06:21:34 +0000 (23:21 -0700)]
NFS - Remove old nfsiod, start adding new kernel thread infrastructure

* Remove all the nfsiod junk.

* Add two per-mount threads, one for reading from the socket, one for writing
  to the socket, in a new file nfs_iod.c

* Implement a quick and dirty synchronous, single threaded nfs_doio()
  loop in the writer thread to test basic mechanics.

14 years agoNFS - Minor compile fix
Matthew Dillon [Thu, 16 Jul 2009 05:37:37 +0000 (22:37 -0700)]
NFS - Minor compile fix

14 years agotsleep_interlock - Fix bug with TDF_TSLEEPQ
Matthew Dillon [Thu, 16 Jul 2009 05:25:40 +0000 (22:25 -0700)]
tsleep_interlock - Fix bug with TDF_TSLEEPQ

* LWKT previously disallowed the scheduling of a thread flagged
  TDF_TSLEEPQ because the tsleep queue was the same as the threadq.
  Now that they are different, it is possible for the thread to
  still be on a tsleepq when descheduled and later rescheduled.
  Remove the check, allowing the thread to be rescheduled by LWKT.

  This fixes issues with processes just locking up in "D"isk wait.

14 years agoNFS - move nfs_reqq from global to per-nfsmount.
Matthew Dillon [Thu, 16 Jul 2009 04:14:04 +0000 (21:14 -0700)]
NFS - move nfs_reqq from global to per-nfsmount.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Thu, 16 Jul 2009 02:48:23 +0000 (19:48 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoNFS - Use mutex API, begin refactoring the state machine.
Matthew Dillon [Thu, 16 Jul 2009 02:41:34 +0000 (19:41 -0700)]
NFS - Use mutex API, begin refactoring the state machine.

* Use the mtx_*() API instead of roll-your-own locks for the send and
  receive locks.

* Refactor nfs_request().  Break the procedure up into multiple pieces
  for upcoming nfsiod/nfsd work (as in: getting rid of them).

  The main thing here is to split off the 'setup', 'send', 'receive',
  and 'process reply' parts.  This will make it easier to construct
  a kernel thread to i.e. just do the 'setup/send' part, and another
  to do the 'receive/reply' part.

14 years agoMPSAFE - mutex - better exclusive lock sequencer, bug fixes, abort
Matthew Dillon [Thu, 16 Jul 2009 02:38:39 +0000 (19:38 -0700)]
MPSAFE - mutex - better exclusive lock sequencer, bug fixes, abort

* Redo the exclusive lock chaining algorithm.  Use an explicit
  link structure and directly pass ownership to the next thread
  waiting on an exclusive lock.

* Exclusive locks can be aborted via mtx_lock_ex_link() and
  mtx_abort_ex_link().

* Lots of misc bug fixes.

14 years agoFix LINT build.
Sascha Wildner [Wed, 15 Jul 2009 20:23:43 +0000 (22:23 +0200)]
Fix LINT build.

14 years agoMPSAFE - mutexes
Matthew Dillon [Wed, 15 Jul 2009 19:13:13 +0000 (12:13 -0700)]
MPSAFE - mutexes

* Add additional inline functions to test the lock state.

14 years agoMPSAFE - mutex enhancements.
Matthew Dillon [Wed, 15 Jul 2009 19:04:28 +0000 (12:04 -0700)]
MPSAFE - mutex enhancements.

* Add timeout to mtx_lock_{sh,ex}

* Add quick version, mtx_lock_{sh,ex}_quick() which does not take a
  flags or timeout parameter.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Wed, 15 Jul 2009 18:38:50 +0000 (11:38 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoMPSAFE - Add a set of general blocking/spinnable mutex functions.
Matthew Dillon [Wed, 15 Jul 2009 18:37:45 +0000 (11:37 -0700)]
MPSAFE - Add a set of general blocking/spinnable mutex functions.

* (serial wakeup code wasn't included in last commit)

14 years agoMPSAFE - Add a set of general blocking/spinnable mutex functions.
Matthew Dillon [Wed, 15 Jul 2009 18:29:43 +0000 (11:29 -0700)]
MPSAFE - Add a set of general blocking/spinnable mutex functions.

These locks are intended to eventually replace lockmgr locks for most
use cases.

* Optimized based on in-line atomic_cmpset_int() calls with fallback call.

* Recursive shared and exclusive locks.  Downgrading, and non-blocking
  upgrading.

* Interlocked wakeup flags.

* Serial wakeup for exclusive waiters (i.e. optimal in the face of a large
  number of waiting threads).  Mass-wakeup for shared waiters.

* Additional entry points for spinning.

* Ref-count support, separate from lock count.

14 years agoAdjust atomic_cmpset_int/long - Faster version, fix amd64 issue.
Matthew Dillon [Wed, 15 Jul 2009 16:44:22 +0000 (09:44 -0700)]
Adjust atomic_cmpset_int/long - Faster version, fix amd64 issue.

* Instead of using the condition code just compare %eax (or %rax)
  against the old value.  This is considerably faster then using
  sete/movzbl and GCC will also optimize the caller's test for
  both 0 or non-zero.

* AMD64.  long is 64 bits, use cmpxchgq (it was previously using cmpxchgl).

14 years agohammer expand: Also increase number of total bigblocks
Michael Neumann [Wed, 15 Jul 2009 16:34:58 +0000 (18:34 +0200)]
hammer expand: Also increase number of total bigblocks

14 years agohammer expand: Layer 1 formatting (step 2/2)
Michael Neumann [Wed, 15 Jul 2009 15:37:44 +0000 (17:37 +0200)]
hammer expand: Layer 1 formatting (step 2/2)

With this commit online HAMMER filesystem expansion is functional, but
highly experimental and might destroy your filesystem.

14 years agoMinor adjustment which does not change behaviour.
Michael Neumann [Wed, 15 Jul 2009 12:36:58 +0000 (14:36 +0200)]
Minor adjustment which does not change behaviour.

This has no effect because of the bzero(). Nevertheless it's
more logical to generate the crc after setting blocks_free to 0.

14 years agohammer expand: Layer 2 formatting (step 1.5/2)
Michael Neumann [Wed, 15 Jul 2009 11:58:39 +0000 (13:58 +0200)]
hammer expand: Layer 2 formatting (step 1.5/2)

14 years agoisdnd(8): Fix some NULL dereferences.
Sascha Wildner [Wed, 15 Jul 2009 10:56:15 +0000 (12:56 +0200)]
isdnd(8): Fix some NULL dereferences.

Taken-from: FreeBSD

14 years agopipes - set kern.pipe.mpsafe default to 1.
Matthew Dillon [Wed, 15 Jul 2009 06:23:55 +0000 (23:23 -0700)]
pipes - set kern.pipe.mpsafe default to 1.

Enable MPSAFE operation on pipes by default.