A bug in sys_open() set NLC_FOLLOW bit for the nlookup() call unconditionally. Removing the setting allows vn_open() to properly set NLC_FOLLOW conditionally when both O_EXCL and O_NOFOLLOW are not set.
…ctime A long chain of directory dependencies can blow out the kernel stack. Limit the recursion to 20 levels. If the depth is exceeded the flushing of the deep inodes is delayed until the higher dependencies are taken care of. Update mtime/ctime accordingly based on the fstest stress test from FreeBSD. Note however that we cannot update the ctime on directories for file creates, renames, and deletes within the directory without rolling a new inode, which is too expensive to do for that situation. We can, and do, update the mtime.
Deal with most of the issues found by FreeBSD's fstest regression test: * Limit path components to 255 characters. Return ENAMETOOLONG if the limit is exceeded. * Return EEXIST, EINVAL, and ENOTEMPTY as appropriate when the user attempts to create, delete, or rename "." or "..", instead of EINVAL. * Return EISDIR if an attempt is made to open a directory for writing, instead of EINVAL. * Return EACCES if an attempt is made to open a file O_TRUNC without O_RDWR or O_WRONLY, instead of silently dropping the O_TRUNC. * Implement O_NOFOLLOW semantics generally instead of just with O_EXCL. Not dealt with: * DragonFly clears SGID AND SUID on uid or gid change, if not root. If root is doing the operation SGID/SUID is not cleared. * HAMMER cannot modify the ctime without rolling a new inode, which is very expensive, and does not do so when entries are added or removed from a directory. mtime is modified.
Ncal would only fill lines up to the last day in a month and use a printf padding later to align all output nicely (when using year view). This breaks when using a hilight, because the ANSI sequences consume additional characters which are of zero print width. Instead of letting printf do the padding, generate padded lines ourselves. Also avoid code duplication in the hilight code and switch on hilighting for the year view.
…ntries Refactor the merged B-Tree + In-Memory search function to try to avoid races where an in-memory record is flushed to the media during a search, causing the search to miss the record. Add another flag to hammer_record_t to indicate that the record was deleted because it was committed to the media (verses simply being deleted). Better-separate HAMMER_RECF_DELETED_FE and HAMMER_RECF_DELETED_BE. These flags indicate whether the frontend or backend deleted an in-memory record. The backend ignores frontend deletions that occur after the record has been associated with a flush group. Remove some console Warnings that are no longer applicable.
…FS layer. Give nlookup() and nlookup_va() the tools to do nearly all chflags related activities. Here are the rules: Immutable (uchg, schg) If set on a directory no files associated with the directory may be created, deleted, linked, or renamed. In addition, any files open()ed via the directory will be immutable whether they are flagged that way or not. If set on a file or directory the file or directory may not be written to, chmodded, chowned, chgrped, or renamed. The file can still be hardlinked and the file/directory can still be chflagged. If you do not wish the file to be linkable then set the immutable bit on all directories containing a link of the file. Once you form this closure no further links will be possible. NOTE ON REASONING: Security scripts should check link counts anyway, depending on a file flag which can be changed as a replacement for checking the link count is stupid. If you are secure then your closures will hold. If you aren't then nothing will save you. This feature is not recursive. If the directory contains subdirectories they must be flagged immutable as well. Undeletable (uunlnk, sunlnk) If set on a file or directory that file or directory cannot be removed or renamed. The file can still otherwise be manipulated, linked, and so forth. However, it should be noted that any hardlinks you create will also not be deletable :-) If set on a directory this flag has no effect on the contents of the directory (yet). See APPEND-ONLY on directories for what you want. Append-only (uappnd/sappnd) If set on a directory no file within the directory may be deleted or renamed. However, new files may be created in the directory and the files in the directory can be modified or hardlinked without restriction. If set on a file the file cannot be truncated, random-written, or deleted. It CAN be chmoded, chowned, renamed, and appended to with O_APPEND etc. If you do not wish the file to be renameable then you must also set the Undeletable flag. Setting the append-only flag will ensure that the file doesn't disappear from the filesystem, but does not prevent it from being moved about the filesystem. Security fix - futimes() futimes() could be called on any open descriptor. Restrict it to just those files you own or have write permission on. Security fix - Hardlinks Users can no longer hardlink foreign-owned files which they do not have write access to. The user must now have write permission on the file being hardlinked or the user must own the file, or be root. Security fix - fcntl() fcntl() can no longer be used to turn of O_APPEND mode if the file was flagged append-only. NOTE - DIFFERENCES WITH FREEBSD * Append-only on directories * Immutable on directories to control set-in-stone & hardlinking * Immutable files can be hardlinked on DragonFly, not on FreeBSD. * User must be the owner of the file or have write access to the file being hardlinked.
Avoid comparing negative signed to positive unsignad values. It was leading to a bug, when C-state does not decrease on sleep shorter then declared transition latency. Fixing this deprecates workaround for broken C-states on some hardware. By the way, change state selecting logic a bit. Instead of last sleep time use short-time average of it. Global interrupts rate in system is a quite random value, to corellate subsequent sleeps so directly. Obtained-from: FreeBSD
Put it into acpi_cpu_startup() which is where all the other code to update this global variable lives. This fixes a bug where cpu_cx_count was not updated correctly if acpi_cpu_generic_cx_probe() returned early. Obtained-from: FreeBSD
If you have seen cpu0: too many short sleeps, backing off to C1 with this chipset before you may want to try cx_lowest of C2 again. Obtained-from: FreeBSD
the rename source or the directory sticky bit for rename targets which existed. This only effected HAMMER which assumes the kernel is responsible for permissions checks. Reported-by: YONETANI Tomokazu <email@example.com>
When nanosleep gets interrupted, it returns EINTR. In the case of a non-zero error status, sys_nanosleep will copyout() the remaining sleep time. However it would overwrite the nanosleep error status with the error status of copyout() -- which is 0 (success) most of the time. This means the important error status of nanosleep (EINTR) would be overwritten by 0. Follow FreeBSD and NetBSD and only return the copyout status if it failed. Reported-by: walt
Fix trailing whitespace while I'm doing it.
… and lapic timer: - Always register "clk" interrupt. - Add cputimer_intr_switch(), which could switch one shot timer between i8254 and lapic timer on a running system. It could be used to select a proper one shot timer duing ACPI C3 transition: e.g. ->C3 use i8254, C3-> use lapic timer - Add sysctl node hw.cputimer_intr_type to test cputimer_intr_switch().
hpet is not required to function under S1-S5. Add comment about the reference to the related hpet standard items.
- Check for a non-zero td->td_nest_count before allowing the processing to occur. Mainly to allow interrupt thread preemption to work for slow interrupts - Increment V_INTR statistic, so vm.stats.sys.v_intr shows correct value, i.e. 'Int' field in systat -vm Submitted-by: dillon@
Our installation unconditionally cpdups the CD/DVD's /usr/pkg to the disk so this option doesn't make sense and only confused people in the past. Leave "Remove software packages" in, though, since it actually seems to work.
* The size of the MFS should be what the user specified, and not be based on slice size. * On the fstab line, specify block and fragment size too. Softupdates is ignored as it doesn't seem to play nice with MFS. * MFS backed partitions don't need to be mounted at installation time but the mount points have to be created anyway. * While here, perform some minor cleanup.
…ons. A bit late, but it was hard to spot. :) Reported-by: Alec Berryman <firstname.lastname@example.org> Dragonfly-bug: <http://bugs.dragonflybsd.org/issue34>