dragonfly.git
5 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.

5 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.

5 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.

5 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>
5 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.

5 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.

5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 years agohammer expand: add manpage
Michael Neumann [Thu, 16 Jul 2009 12:56:47 +0000 (14:56 +0200)]
hammer expand: add manpage

5 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

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

5 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.

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

5 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.

5 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.

5 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

5 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.

5 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.

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

5 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.

5 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.

5 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

5 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)

5 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.

5 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).

5 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

5 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.

5 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.

5 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)

5 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

5 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.

5 years agoWhitespace cleanup
Matthew Dillon [Wed, 15 Jul 2009 06:09:25 +0000 (23:09 -0700)]
Whitespace cleanup

5 years agoNFS - Make the NFS read-ahead defaults & limits more generous.
Matthew Dillon [Wed, 15 Jul 2009 06:00:52 +0000 (23:00 -0700)]
NFS - Make the NFS read-ahead defaults & limits more generous.

5 years agoundo - Add <sys/param.h> to get MAXPATHLEN
Matthew Dillon [Wed, 15 Jul 2009 03:19:13 +0000 (20:19 -0700)]
undo - Add <sys/param.h> to get MAXPATHLEN

Reported-by: corecode
5 years agoLWKT - Make sure an exiting thread is not sitting on a tsleep queue.
Matthew Dillon [Wed, 15 Jul 2009 03:09:41 +0000 (20:09 -0700)]
LWKT - Make sure an exiting thread is not sitting on a tsleep queue.

5 years agoLWKT - Rename lwkt_yield_quick() to a more appropriate splz_check().
Matthew Dillon [Wed, 15 Jul 2009 03:05:51 +0000 (20:05 -0700)]
LWKT - Rename lwkt_yield_quick() to a more appropriate splz_check().

5 years agoMPSAFE - tsleep_interlock, BUF/BIO, cluster, swap_pager.
Matthew Dillon [Wed, 15 Jul 2009 02:31:18 +0000 (19:31 -0700)]
MPSAFE - tsleep_interlock, BUF/BIO, cluster, swap_pager.

* tsleep_interlock()/tsleep() could miss wakeups during periods of
  heavy cpu activity.  What would happen is code inbetween the two
  calls would try to send an IPI (say, issue a wakeup()), but while
  sending the IPI the kernel would be forced to process incoming IPIs
  synchronous to avoid a deadlock.

  The new tsleep_interlock()/tsleep() code adds another TAILQ_ENTRY to
  the thread structure allowing tsleep_interlock() to formally place
  the thread on the appropriate sleep queue without having to deschedule
  the thread.  Any wakeup which occurs between the interlock and the
  real tsleep() call will remove the thread from the queue and the
  later tsleep() call will recognize this and simply return without sleeping.

  The new tsleep() call requires PINTERLOCKED to be passed to tsleep
  so tsleep() knows that the thread has already been placed on a sleep
  queue.

* Continue making BUF/BIO MPSAFE.  Remove B_ASYNC and B_WANT from buf->b_flag
  and add a new bio->bio_flags field to the bio.  Add BIO_SYNC, BIO_WANT,
  and BIO_DONE.  Use atomic_cmpset_int() (aka cmpxchg) to interlock
  biodone() against biowait().

  vn_strategy() and dev_dstrategy() call semantics now require that
  synchronous BIO's install a bio_done function and set BIO_SYNC in
  the bio.

* Clean up the cluster code a bit.

* Redo the swap_pager code.  Instead of issuing I/O during the collection,
  which depended on critical sections to avoid races in the cluster append,
  we now build the entire collection first and then dispatch the I/O.
  This allows us to use only async completion for the BIOs, instead of
  a hybrid sync-or-async completion.

5 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Wed, 15 Jul 2009 02:24:43 +0000 (19:24 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

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

5 years agoMinor adjustments of recent commits to fix UP kernel build.
Matthew Dillon [Wed, 15 Jul 2009 02:23:01 +0000 (19:23 -0700)]
Minor adjustments of recent commits to fix UP kernel build.

5 years agoFix some typos in manpages.
Sascha Wildner [Wed, 15 Jul 2009 02:09:19 +0000 (04:09 +0200)]
Fix some typos in manpages.

5 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Michael Neumann [Tue, 14 Jul 2009 17:30:15 +0000 (19:30 +0200)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

5 years agohammer expand: Do not assume sequential vol_no's
Michael Neumann [Tue, 14 Jul 2009 17:29:13 +0000 (19:29 +0200)]
hammer expand: Do not assume sequential vol_no's

5 years agoFix randomly seen problems with linking C++ programs.
Hasso Tepper [Tue, 14 Jul 2009 16:14:15 +0000 (19:14 +0300)]
Fix randomly seen problems with linking C++ programs.

Binutils 2.17 supports COMDAT groups and .nsubspa comdat option. It should
fix randomly seen linking errors like:

`.gnu.linkonce.t.something' referenced in section `.gnu.linkonce.r.something'
of some_object: defined in discarded section `.gnu.linkonce.t.something'
of some_object.

Digged-out-by: corecode@
5 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Michael Neumann [Tue, 14 Jul 2009 14:01:40 +0000 (16:01 +0200)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

5 years agoExpand HAMMER filesystem step 1/2
Michael Neumann [Tue, 14 Jul 2009 13:55:02 +0000 (15:55 +0200)]
Expand HAMMER filesystem step 1/2

Format the volume and increase other volumes' vol_count field.
The space of the new volume is not yet given to the filesystem (that's step 2).

Example:

newfs_hammer -L TEST /dev/da0
mount_hammer /dev/da0 /hammer
hammer expand /hammer /dev/da1
umount /hammer
mount_hammer /dev/da0:/dev/da1 /hammer

# the following fails (wrong number of volumes)
mount_hammer /dev/da0 /hammer

5 years agoFix typos in mse(4) and ppp(8) manpages: compliment -> complement.
Sascha Wildner [Tue, 14 Jul 2009 12:54:36 +0000 (14:54 +0200)]
Fix typos in mse(4) and ppp(8) manpages: compliment -> complement.

5 years agoShuffle IPI handlers to the last two blocks of the IDT.
Sepherosa Ziehau [Mon, 13 Jul 2009 13:44:11 +0000 (21:44 +0800)]
Shuffle IPI handlers to the last two blocks of the IDT.

Relative position of the IPI handlers is kept.  This gives us
more contiguous free IDT vectors.

5 years agoAdd age(4) to GENERIC and LINT
Sepherosa Ziehau [Mon, 13 Jul 2009 06:10:30 +0000 (14:10 +0800)]
Add age(4) to GENERIC and LINT

5 years agoAdd ae(4) manpage
Sepherosa Ziehau [Mon, 13 Jul 2009 06:06:44 +0000 (14:06 +0800)]
Add ae(4) manpage

Submitted-by: Alexander Polakov <polachok@gmail.com>
Obtained-from: FreeBSD

5 years agoAdd ae(4) to LINT and GENERIC
Sepherosa Ziehau [Mon, 13 Jul 2009 06:03:24 +0000 (14:03 +0800)]
Add ae(4) to LINT and GENERIC

5 years agoAdd ae(4) into module building
Sepherosa Ziehau [Mon, 13 Jul 2009 05:51:23 +0000 (13:51 +0800)]
Add ae(4) into module building

5 years agoAdd driver for Attansic/Atheros L2 FastEthernet
Sepherosa Ziehau [Mon, 13 Jul 2009 05:45:25 +0000 (13:45 +0800)]
Add driver for Attansic/Atheros L2 FastEthernet

Submitted-by: Alexander Polakov <polachok@gmail.com> w/ modification
Obtained-from: FreeBSD

5 years agolapic_init() -> lapic_map()
Sepherosa Ziehau [Sun, 12 Jul 2009 08:05:49 +0000 (16:05 +0800)]
lapic_init() -> lapic_map()

5 years agoRemove the distribute, redistribute and distributeworld targets.
Sascha Wildner [Tue, 14 Jul 2009 12:01:34 +0000 (14:01 +0200)]
Remove the distribute, redistribute and distributeworld targets.

We don't split things into different distributions and none of this
was ever used.

Pointed-out-by: pavalos
5 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Tue, 14 Jul 2009 10:36:06 +0000 (03:36 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

5 years agotsleep() - Use PINTERLOCKED in msleep() and serialized_sleep().
Matthew Dillon [Tue, 14 Jul 2009 10:34:56 +0000 (03:34 -0700)]
tsleep() - Use PINTERLOCKED in msleep() and serialized_sleep().

5 years agotermios.h: Expose tcgetsid(3) function.
Stathis Kamperis [Wed, 1 Jul 2009 20:49:43 +0000 (23:49 +0300)]
termios.h: Expose tcgetsid(3) function.

Dragonfly-bug: <http://bugs.dragonflybsd.org/issue1419>
Reviewed-by: hasso@, corecode@
5 years agotsleep() - Add PINTERLOCKED flag to catch edge case.
Matthew Dillon [Tue, 14 Jul 2009 10:14:33 +0000 (03:14 -0700)]
tsleep() - Add PINTERLOCKED flag to catch edge case.

When the tsleep_interlock() + UNLOCK + tsleep() combination is used it is
possible for an incoming wakeup IPI to be processed even if the combination
is used within a critical section, because operations inbetween the two
may send an IPI.  Under heavy loads sending an IPI can force incoming IPIs
to be processed synchronously to avoid deadlocks.

It is also possible for tsleep itself to create this condition when it
releases the user process schedule prior to descheduling itself.

PINTERLOCKED causes tsleep to check whether the bit set by tsleep_interlock()
is still set.  If it is not set we simply return without sleeping.

5 years agoHAMMER - new hammer_lock code, fix mplock bug in last commit, mpsafe getattr.
Matthew Dillon [Tue, 14 Jul 2009 07:14:12 +0000 (00:14 -0700)]
HAMMER - new hammer_lock code, fix mplock bug in last commit, mpsafe getattr.

* Fix a mplock bug in the last commit that can cause a panic in hammer_read.
  The mplock check code wasn't setting up the hammer transaction properly.

* VMP_GETATTR is now set on all HAMMER vnodes.  If sysctl vfs.getattr_mpsafe=1
  all fstat() operations will run without the MP lock.

* Rewrite HAMMER's lock code, making it MPSAFE.  The new lock code uses
  atomic_cmpset_int().

5 years agoMPSAFE - Regenerate system calls for MPSAFE changes.
Matthew Dillon [Tue, 14 Jul 2009 07:08:11 +0000 (00:08 -0700)]
MPSAFE - Regenerate system calls for MPSAFE changes.

5 years agoMPSAFE - Implement sysctl vfs.getattr_mpsafe, make fstat() MPSAFE
Matthew Dillon [Tue, 14 Jul 2009 06:02:21 +0000 (23:02 -0700)]
MPSAFE - Implement sysctl vfs.getattr_mpsafe, make fstat() MPSAFE

Make fstat() MPSAFE.  Adjust fileops->fo_stat functions to be MPSAFE as
necessary (uipc socket stat mainly).

5 years agoMPSAFE - Document a few procedures as MPSAFE (non-operational)
Matthew Dillon [Tue, 14 Jul 2009 05:58:59 +0000 (22:58 -0700)]
MPSAFE - Document a few procedures as MPSAFE (non-operational)

5 years agoMPSAFE - system calls set_tls_area() and get_tls_area() are MPSAFE
Matthew Dillon [Tue, 14 Jul 2009 05:26:53 +0000 (22:26 -0700)]
MPSAFE - system calls set_tls_area() and get_tls_area() are MPSAFE

5 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Tue, 14 Jul 2009 03:49:10 +0000 (20:49 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

5 years agoHAMMER - Add MPSAFE suppor for hammer_vop_read().
Matthew Dillon [Tue, 14 Jul 2009 03:46:45 +0000 (20:46 -0700)]
HAMMER - Add MPSAFE suppor for hammer_vop_read().

This is still a bit of a hack.  If vfs.read_mpsafe is set HAMMER will
run MPSAFE for reads from regular files which are cached in the buffer
cache.  Data which is not cached will fall-back to getting the MP lock.

At the moment enabling this operation will cause atime to not get updated
on fully cached files, because the rest of HAMMER is not MPSAFE yet so I
cannot modify the internal hammer_inode state.

5 years agoMPSAFE - Add read() and write() path MPSAFE support, and more.
Matthew Dillon [Tue, 14 Jul 2009 03:41:30 +0000 (20:41 -0700)]
MPSAFE - Add read() and write() path MPSAFE support, and more.

* Add sysctl vfs.read_mpsafe, vfs.write_mpsafe, and vfs.getattr_mpsafe.
  Only vfs.read_mpsafe is currently implemented, and only for HAMMER
  filesystems.

* read() and write() will now call VOP_READ()/VOP_WRITE() without the
  MP lock if the vnode->v_flag says it is ok to do so.

* read() and write() now serialize reads and writes which depend on the
  file offset stored in the fp, when the concurrent operations share the
  same fp.

* Add vnode flags VMP_READ, VMP_WRITE, VMP_GETATTR.

* Add vnode flag VNOTSEEKABLE indicating that fp->f_offset will never be
  used and no serialization is needed (which e.g. can mess up read()'s
  blocking devices such as ttys).

* Correct bug in FIONREAD related to the data field being too small.

5 years agomxge: Clean up Makefile a little more. v2.3.2
Sascha Wildner [Tue, 14 Jul 2009 02:04:49 +0000 (04:04 +0200)]
mxge: Clean up Makefile a little more.

5 years agomxge: Add opt_inet.h to the Makefile.
Sascha Wildner [Tue, 14 Jul 2009 01:42:10 +0000 (03:42 +0200)]
mxge: Add opt_inet.h to the Makefile.

5 years agoCCMS - Correct bug, add #include <sys/spinlock2.h> to kern_ccms.c
Matthew Dillon [Tue, 14 Jul 2009 00:19:09 +0000 (17:19 -0700)]
CCMS - Correct bug, add #include <sys/spinlock2.h> to kern_ccms.c

5 years agoCCMS - bug in last commit, remove #include <sys/spinlock2.h> from ccms.h
Matthew Dillon [Tue, 14 Jul 2009 00:17:21 +0000 (17:17 -0700)]
CCMS - bug in last commit, remove #include <sys/spinlock2.h> from ccms.h

5 years agoNormalize the defines for the vnode flags (non-operational change).
Matthew Dillon [Mon, 13 Jul 2009 23:48:45 +0000 (16:48 -0700)]
Normalize the defines for the vnode flags (non-operational change).

5 years agoCCMS - Make the cache coherency locks MPSAFE.
Matthew Dillon [Mon, 13 Jul 2009 23:44:51 +0000 (16:44 -0700)]
CCMS - Make the cache coherency locks MPSAFE.

5 years agoBUF/BIO - MPSAFE work on core buffer cache routines.
Matthew Dillon [Mon, 13 Jul 2009 22:57:53 +0000 (15:57 -0700)]
BUF/BIO - MPSAFE work on core buffer cache routines.

Do initial MPSAFE work on getblk(), bread(), brelse(), bqrelse(),
biowait(), and friends.  Use get_mplock()/rel_mplock() in areas not
yet converted.

Add a flags argument to findblk() and have it return a locked buffer
cache buffer by default.  Callers may request that the buffer be
locked non-blocking, or that it not be locked at all.

Adjust all callers of findblk() for those cases where an unlocked
buffer is desired to lock and re-check the returned buffer's parameters,
since otherwise it can change out from under the caller whether a critical
section is used or not (for SMP).

5 years agotelnet: Fix a bug (really use the return value of tty_istrapsig()).
Sascha Wildner [Mon, 13 Jul 2009 22:03:33 +0000 (00:03 +0200)]
telnet: Fix a bug (really use the return value of tty_istrapsig()).

5 years agoExpand HAMMER filesystem stubs
Michael Neumann [Mon, 13 Jul 2009 21:40:38 +0000 (23:40 +0200)]
Expand HAMMER filesystem stubs

5 years agopipe - add required critical section around tsleep_interlock() call.
Matthew Dillon [Mon, 13 Jul 2009 21:11:11 +0000 (14:11 -0700)]
pipe - add required critical section around tsleep_interlock() call.

5 years agobuffer cache - protect bufqueues[] with the bufspin spinlock.
Matthew Dillon [Mon, 13 Jul 2009 20:41:12 +0000 (13:41 -0700)]
buffer cache - protect bufqueues[] with the bufspin spinlock.

5 years agomxge.4: Some small changes.
Sascha Wildner [Mon, 13 Jul 2009 19:16:16 +0000 (21:16 +0200)]
mxge.4: Some small changes.

* We use local time line, not FreeBSD's.

* Kick unneeded .Pp.

* First appeared in 2.3.

5 years agoMerge branch 'mxge'
Aggelos Economopoulos [Mon, 13 Jul 2009 18:47:37 +0000 (21:47 +0300)]
Merge branch 'mxge'

5 years agomxge.4: sync with the status of the driver in DragonFly
Aggelos Economopoulos [Mon, 13 Jul 2009 18:46:35 +0000 (21:46 +0300)]
mxge.4: sync with the status of the driver in DragonFly

5 years agomxge: import mxge.4 from FreeBSD
Aggelos Economopoulos [Mon, 13 Jul 2009 18:45:09 +0000 (21:45 +0300)]
mxge: import mxge.4 from FreeBSD

5 years agoDocument pmap_qremove() as being MPSAFE.
Matthew Dillon [Mon, 13 Jul 2009 18:39:03 +0000 (11:39 -0700)]
Document pmap_qremove() as being MPSAFE.

5 years agoMake getpbuf(), trypbuf(), and relpbuf() MPSAFE.
Matthew Dillon [Mon, 13 Jul 2009 18:38:09 +0000 (11:38 -0700)]
Make getpbuf(), trypbuf(), and relpbuf() MPSAFE.

5 years agoMake biowait() MPSAFE.
Matthew Dillon [Mon, 13 Jul 2009 18:37:35 +0000 (11:37 -0700)]
Make biowait() MPSAFE.

5 years agotelnet.1: Remove unnecessary .Pp
Sascha Wildner [Mon, 13 Jul 2009 18:07:54 +0000 (20:07 +0200)]
telnet.1: Remove unnecessary .Pp

5 years agopriv.9: Update for recent changes.
Sascha Wildner [Mon, 13 Jul 2009 17:58:58 +0000 (19:58 +0200)]
priv.9: Update for recent changes.

Approved-by: mneumann
5 years agobuffer cache - Control all access to the buf red-black trees with vp->v_token
Matthew Dillon [Mon, 13 Jul 2009 17:55:24 +0000 (10:55 -0700)]
buffer cache - Control all access to the buf red-black trees with vp->v_token

Access to the buffer cache's RB trees is now controlled via vp->v_token
instead of a critical section.  We still hold the BGL but this is not
quite as simple as it seems because an interrupt calling biodone() on a
B_INVAL buffer may now potentially block, where as it would not have before.
The buffer is locked.