Commit Graph

1643 Commits

Author SHA1 Message Date
christos 48e6aff258 Fix bug introduced in revision 1.174 where a NULL fspec with an MNT_UPDATE
command would always return EINVAL. This broke fsck on root, where fsck'ing
a dirty root would always return an error causing rc to resort in a reboot.
2009-07-06 16:07:18 +00:00
elad 009f5d2f88 Where possible, extract the file-system's access() routine to two internal
functions: the first checking if the operation is possible (regardless of
permissions), the second checking file-system permissions, ACLs, etc.

Mailing list reference:

	http://mail-index.netbsd.org/tech-kern/2009/06/21/msg005311.html
2009-07-03 21:17:40 +00:00
dholland effcf1af5c Convert 67 namei call sites to use namei_simple, in these functions:
check_console, veriexecclose, veriexec_delete, veriexec_file_add,
emul_find_root, coff_load_shlib (sh3 version), coff_load_shlib,
compat_20_sys_statfs, compat_20_netbsd32_statfs,
ELFNAME2(netbsd32,probe_noteless), darwin_sys_statfs,
ibcs2_sys_statfs, ibcs2_sys_statvfs, linux_sys_uselib,
osf1_sys_statfs, sunos_sys_statfs, sunos32_sys_statfs,
ultrix_sys_statfs, do_sys_mount, fss_create_files (3 of 4),
adosfs_mount, cd9660_mount, coda_ioctl, coda_mount, ext2fs_mount,
ffs_mount, filecore_mount, hfs_mount, lfs_mount, msdosfs_mount,
ntfs_mount, sysvbfs_mount, udf_mount, union_mount, sys_chflags,
sys_lchflags, sys_chmod, sys_lchmod, sys_chown, sys_lchown,
sys___posix_chown, sys___posix_lchown, sys_link, do_sys_pstatvfs,
sys_quotactl, sys_revoke, sys_truncate, do_sys_utimes, sys_extattrctl,
sys_extattr_set_file, sys_extattr_set_link, sys_extattr_get_file,
sys_extattr_get_link, sys_extattr_delete_file,
sys_extattr_delete_link, sys_extattr_list_file, sys_extattr_list_link,
sys_setxattr, sys_lsetxattr, sys_getxattr, sys_lgetxattr,
sys_listxattr, sys_llistxattr, sys_removexattr, sys_lremovexattr

All have been scrutinized (several times, in fact) and compile-tested,
but not all have been explicitly tested in action.

XXX: While I haven't (intentionally) changed the use or nonuse of
XXX: TRYEMULROOT in any of these places, I'm not convinced all the
XXX: uses are correct; an audit might be desirable.
2009-06-29 05:08:15 +00:00
ad fe924bec61 +/*
+ * NOTE: COORDINATE ON-DISK FORMAT CHANGES WITH THE FREEBSD PROJECT.
+ */
2009-06-28 09:26:18 +00:00
elad 870920260d Move the implementation of vaccess() to genfs_can_access(), in line with
the other routines of the same spirit.

Adjust file-system code to use it.

Keep vaccess() for KPI compatibility and to keep element of least
surprise. A "diagnostic" message warning that vaccess() is deprecated will
be printed when it's used (obviously, only in DIAGNOSTIC kernels).

No objections on tech-kern@:

	http://mail-index.netbsd.org/tech-kern/2009/06/21/msg005310.html
2009-06-23 19:36:38 +00:00
hannken d68670a54c ufsdirhash_lookup(): call ufs_blkatoff() with "modify == false".
This buffer is used read-only here and from caller.
2009-05-30 13:54:36 +00:00
ad 1d2d012fbe Add di_modrev to the inode, for NFSv4. From FreeBSD. 2009-05-12 21:08:23 +00:00
ad a94f2ab36f Reserve a bit for FS_GJOURNAL (from FreeBSD). 2009-05-12 21:01:02 +00:00
dholland 8382834fe2 The lwp member of struct componentname was removed a long time ago.
Fix broken build with UFS_EXTATTR_AUTOSTART by removing it here as well.
2009-05-10 20:27:21 +00:00
rmind 76fc93c832 ufs_setattr: fix previous - return in error path does not finish the
transaction (hi elad).
2009-05-08 10:52:00 +00:00
elad 13385da3e6 Replace KAUTH_GENERIC_ISSUSER with a better alternative. 2009-05-07 20:32:51 +00:00
elad 88003af1dc Use genfs_can_mount(). 2009-05-07 20:32:23 +00:00
elad 863a01b5c1 Extract the open-coded authorization logic for chtimes() from various
file-systems and put it in a single function, genfs_can_chtimes().

This also makes UDF follow the same policy as all other file-systems.

Mailing list reference:

	http://mail-index.netbsd.org/tech-kern/2009/04/27/msg004951.html
2009-05-07 19:30:29 +00:00
elad 9e9887cc59 Introduce several actions/requests for authorizing file-system related
operations, specifically quota and block allocation from reserved space.

Modify ufs_quotactl() to accomodate passing "mp" earlier by vfs_busy()ing
it a little bit higher.

Mailing list reference:

	http://mail-index.netbsd.org/tech-kern/2009/04/26/msg004936.html

Note that the umapfs request mentioned in this thread was NOT added as
there is still on-going discussion regarding the proper implementation.
2009-05-07 19:26:08 +00:00
rmind 4ef6600a51 Revert previous until problem will be understood. 2009-05-06 16:43:47 +00:00
rmind 3d7fe7769c ufsdirhash_recycle():
- Fix ufs_dirhashmem modification (do it atomically).
- Fix a memory leak.

OK by <ad>.
2009-05-04 20:54:25 +00:00
elad 54bf8cc67a Add genfs_can_mount() and use it to prevent some more code duplication of
the security checks when mounting a device (VOP_ACCESS() + kauth(9) call)).

Proposed with no objections on tech-kern@:

	http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004859.html

The vnode is always expected to be locked, so no locking is done outside
the file-system code.
2009-04-25 18:53:44 +00:00
sborrill 71d4bf3caa Fix random 'filesystem full' messages by trapping a couple of 32-bit
overflow areas missed in rev 1.110 and switching cgbase().

Kudos to rump_ffs!
2009-04-25 08:32:32 +00:00
elad f68b0219b0 Per discussion on tech-kern@:
- Replace use of label/goto with returns

  - Rename, change prototype of, and move functions from vfs_subr.c to
    genfs_vnops.c
2009-04-22 22:57:08 +00:00
elad 386808d4a0 Refactor some duplicated file-system code.
Proposed and received no objections on tech-kern@:

	http://mail-index.netbsd.org/tech-kern/2009/04/18/msg004843.html
2009-04-20 18:06:26 +00:00
tsutsui d779b85d3e Remove extra whitespace added by a stupid tool.
XXX: more in src/sys/arch
2009-04-18 14:58:02 +00:00
lukem f974617411 fix -Wsign-compare issue on bigendian platforms 2009-04-14 09:30:25 +00:00
pooka 556e6e2b6b Fix reference leak in fix for PR kern/40948.
Pointed out by David Holland.
2009-04-06 14:09:57 +00:00
ad 2f5f36b538 Turn up the volume on the warning message a bit. 2009-04-04 10:33:59 +00:00
pooka 095a7dd3b6 Release tdvp in an appropriate VOP_RENAME error branch to avoid
panic described in PR kern/40948.

As usual, all the error branches in rename live based on an unholy
amalgamation of prayer and the blood of cute, furry and tasty
quadrupeds, so I won't even attempt to audit the rest.

And this wapbl rename really really needs to be merged with the
standard rename.  That should be a fun PhD thesis topic ....
2009-04-02 11:33:04 +00:00
ad 393ca6e076 fsync:
- atime updates were not being synced.

ffs_sync:

- In some cases the sync vnode was acting like now dead /usr/sbin/update.
  It was examining vnodes that it should have ignored.

- It would find dirty inodes and try to flush them. Often ffs_fsync()
  cheerfully ignored the flush request due to the fsync bug. Such inodes
  remained dirty and were repeatedly re-examined by the syncer until
  vnode reclaim or system shutdown.

- We were marking our place in the per-mount vnode list even though in
  most cases there was not flush to perform. While not a bug, this wasted
  CPU cycles because a TAILQ_NEXT would have sufficed.
2009-03-29 10:29:00 +00:00
ad 2600da8765 ffs_sync: ensure that we *do* flush atime updates periodically.
ffs_update() was eating the flag.
2009-03-21 14:35:48 +00:00
cegger e2cb85904d bcopy -> memcpy 2009-03-18 17:06:41 +00:00
cegger c363a9cb62 bzero -> memset 2009-03-18 16:00:08 +00:00
cegger 35fb64746b bcmp -> memcmp 2009-03-18 15:14:29 +00:00
cegger df7f595ecd Ansify function definitions w/o arguments. Generated with sed. 2009-03-18 10:22:21 +00:00
cegger dc56dbbd97 ansify function definitions 2009-03-15 21:23:31 +00:00
tsutsui d0939ef481 Don't use e2fs_inode_size in superblock on E2FS_REV0 file system. 2009-03-02 09:54:49 +00:00
christos 00e037ba4e PR/40936: Frederik Sausmikat: ext2fs: add support for inodes > 128 bytes 2009-03-01 15:59:57 +00:00
dholland 2fe837fcf9 typo in comment 2009-02-23 03:01:13 +00:00
ad 59fcf21389 PR kern/26878 FFSv2 + softdep = livelock (no free ram)
PR kern/16942 panic with softdep and quotas
PR kern/19565 panic: softdep_write_inodeblock: indirect pointer #1 mismatch
PR kern/26274 softdep panic: allocdirect_merge: ...
PR kern/26374 Long delay before non-root users can write to softdep partitions
PR kern/28621 1.6.x "vp != NULL" panic in ffs_softdep.c:4653 while unmounting a softdep (+quota) filesystem
PR kern/29513 FFS+Softdep panic with unfsck-able file-corruption
PR kern/31544 The ffs softdep code appears to fail to write dirty bits to disk
PR kern/31981 stopping scsi disk can cause panic (softdep)
PR kern/32116 kernel panic in softdep (assertion failure)
PR kern/32532 softdep_trackbufs deadlock
PR kern/37191 softdep: locking against myself
PR kern/40474 Kernel panic after remounting raid root with softdep

Retire softdep, pass 2. As discussed and later formally announced on the
mailing lists.
2009-02-22 20:28:05 +00:00
ad 430f67aa17 PR kern/39564 wapbl performance issues with disk cache flushing
PR kern/40361 WAPBL locking panic in -current
PR kern/40361 WAPBL locking panic in -current
PR kern/40470 WAPBL corrupts ext2fs
PR kern/40562 busy loop in ffs_sync when unmounting a file system
PR kern/40525 panic: ffs_valloc: dup alloc

- A fix for an issue that can lead to "ffs_valloc: dup" due to dirty cg
  buffers being invalidated. Problem discovered and patch by dholland@.

- If the syncer fails to lazily sync a vnode due to lock contention,
  retry 1 second later instead of 30 seconds later.

- Flush inode atime updates every ~10 seconds (this makes most sense with
  logging). Presently they didn't hit the disk for read-only files or
  devices until the file system was unmounted. It would be better to trickle
  the updates out but that would require more extensive changes.

- Fix issues with file system corruption, busy looping and other nasty
  problems when logging and non-logging file systems are intermixed,
  with one being the root file system.

- For logging, do not flush metadata on an inode-at-a-time basis if the sync
  has been requested by ioflush. Previously, we could try hundreds of log
  sync operations a second due to inode update activity, causing the syncer
  to fall behind and metadata updates to be serialized across the entire
  file system. Instead, burst out metadata and log flushes at a minimum
  interval of every 10 seconds on an active file system (happens more often
  if the log becomes full). Note this does not change the operation of
  fsync() etc.

- With the flush issue fixed, re-enable concurrent metadata updates in
  vfs_wapbl.c.
2009-02-22 20:10:25 +00:00
pooka bbaefad73d Break hold-and-wait which happens in ufs_balloc_range() when we
have pages busied and are trying to get the genfs node lock.
This causes a lock order reversal described in PR kern/40389.
This is not a proper fix and only a workaround for NetBSD 5.0.

problem first reported by simonb, patch tested by rmind
2009-02-04 21:07:19 +00:00
ad 74d10dbea4 PR kern/40469 5.0_BETA/amd64 INSTALL kernel panics when installing on log-enabled filesystems
PR kern/40470 WAPBL corrupts ext2fs

Don't touch inodes at all unless VOP_FSYNC(). Might fix the ext2fs problem,
I am not sure.
2009-02-01 17:36:43 +00:00
yamt 18be80bfbe 0 -> NULL 2009-01-31 09:22:08 +00:00
yamt e52a72295f wapbl_log_position: 1 -> MNT_WAIT 2009-01-31 09:14:15 +00:00
lukem c5eb4ab601 fix -Wsign-compare issues 2009-01-18 11:56:51 +00:00
yamt 4f322c072e one more change which i forgot to commit with
UVM_PAGE_HASH_PENALTY -> UVM_PAGE_TREE_PENALTY rename.
noticed by Andreas Wrede.
2009-01-16 05:15:29 +00:00
pooka a5ae82a57e Revert 1.101, author did not provide a justification. 2009-01-15 21:26:03 +00:00
yamt 70de973662 g/c BUFQ_FOO() macros and use bufq_foo() directly. 2009-01-13 13:33:58 +00:00
christos 461a86f9bd merge christos-time_t 2009-01-11 02:45:45 +00:00
hannken fc6d5c7578 Remove superfluous "vp->v_vnlock = &vp->v_lock".
Observed by: YAMAMOTO Takashi <yamt@netbsd.org>
2009-01-03 15:29:08 +00:00
christos 437cf02e63 Don't try to ffs_update VT_NON vnodes 2008-12-28 16:27:00 +00:00
cegger f1b926ed8b ffs_update: sprinkle KASSERTs 2008-12-23 11:32:08 +00:00
ad f1ec31c6b1 Add a comment. 2008-12-22 12:18:48 +00:00