Commit Graph

1670 Commits

Author SHA1 Message Date
hannken
df5d842a2c ufs_rmdir(): move fstrans_done() after vput(). No more unlinked and
zero-sized directory inodes in snapshots.
2009-10-14 09:40:27 +00:00
hannken
8deb3262b5 Fix a deadlock where fscow_disestablish() blocks because outstanding
copy-on-write operations wait for si_snaplock.
2009-10-13 12:38:14 +00:00
rmind
ae2795775d ufsdirhash_recycle(): modify ufs_dirhashmem atomically. 2009-10-05 23:48:08 +00:00
dholland
6f7fa47c46 Avoid nasal demons. Code of the form
vput(vp);
   error = VFS_VGET(vp->v_mount, ...);

just isn't right. Because of vnode caching this *probably* never bit
anyone, except maybe under very heavy load, but still.
2009-09-28 00:39:03 +00:00
bouyer
7de71fb523 PR kern/41147: race between nfsd and local rm
Note that the race also exists between 2 nfs client, one of them doing the rm.
In ufs_ihashget(), vget() can return a vnode that has been vclean'ed because
vget() can sleep. After vget returns, check that vp is still connected with
ip, and that ip still points to the inode we want. This fix the NULL
pointer dereference in ufs_fhtovp() I've been seeing on a NFS server.

XXX I have no idea why using vput() instead of
vlockmgr(vp->v_vnlock, LK_RELEASE); vrele(vp); does not work.
2009-09-20 14:00:24 +00:00
bouyer
b9440228c5 If the WAPBL journal can't be read (ffs_wapbl_replay_start() fails),
mount the filesystem anyway if MNT_FORCE is present.
This allows to still boot single-user a system with a corrupted
WAPBL on /, and so get a chance to run fsck to fix it.
http://mail-index.netbsd.org/tech-kern/2009/08/17/msg005896.html
and followups.
2009-09-13 14:30:21 +00:00
bouyer
32992733fa Allow tunefs to clear any type of WAPBL log, not only in-filesystem
ones. Discussed in
http://mail-index.netbsd.org/tech-kern/2009/08/17/msg005896.html
and followups.
2009-09-13 14:13:23 +00:00
tsutsui
e7713433d4 Move declaration of ufs_hashlock into <ufs/ufs_extern.h> from each c source. 2009-09-13 05:17:36 +00:00
tsutsui
80d52b1bc6 Use proper macro, some KNF, fix typo. 2009-09-12 14:59:59 +00:00
tsutsui
58c74e6160 Whitespace nits. 2009-09-12 11:35:46 +00:00
tsutsui
a811b3a680 Migrate from u_intNN_t to uintNN_t. 2009-09-12 11:27:39 +00:00
tsutsui
d592174fdd Reduce diffs a bit between ext2fs_reload() and ffs_reload(). 2009-09-12 02:50:38 +00:00
tsutsui
2620184bc7 Add a missed brelse(9) call after bread(9) in ext2fs_reload().
This may close PR kern/28712 (ext2fs hang on mount after fsck).
2009-09-12 02:32:14 +00:00
tsutsui
91f14b108d Pull a fix from ffs_vfsops.c rev 1.248:
> 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.
(*) This is "Apply the NFS exports list rototill patch" change
    in ext2fs_vfsops.c rev 1.91.
2009-09-12 02:25:39 +00:00
tsutsui
f551f24480 Pull a fix for mount function from ffs_vfsops.c rev1.186:
> Change ffs_mount, in MNT_UPDATE case, to check dev_t's for equality
> instead of just vnode pointers.  Fixes erroneous "does not match mounted
> device" errors from mount(8) in the presence of MFS /dev, init.root, &c.
2009-09-12 01:43:52 +00:00
tsutsui
f2831b63aa Fix botch around argument check in ext2fs_mount(). Taken from ffs_vfsops.c.
Fixes LOCKDEBUG panic which is the same one mentioned in PR kern/41078
on trying to mount_ext2fs against a raw device, while that panic
seems to have another route cause around module_autoload() in
sys/miscfs/specfs/spec_vnops.c:spec_open().
2009-09-11 15:59:07 +00:00
wiz
8b28c44203 Add missing parenthesis in #ifdef LFS_USE_B_INVAL.
From Henning Petersen in PR 41841.
2009-08-07 13:58:38 +00:00
pooka
b828513eea Compensate v_numoutput & nestbuf for lfs's rather peculiar I/O habits. 2009-08-05 15:39:57 +00:00
pooka
e7780eca66 remember to nestiobuf_done() too 2009-08-05 14:37:01 +00:00
pooka
307631b2c8 Use nestiobuf instead of homerolled equivalent. 2009-08-05 14:09:26 +00:00
bouyer
94fb626feb Fix previous: mutex_destroy() the right mutex 2009-08-02 20:50:33 +00:00
bouyer
9bbfba8140 Add missing mutex_destroy() before pool_cache_put(). Prevents a
"Mutex error: lockdebug_alloc: already initialized" panic.
2009-08-01 09:08:53 +00:00
pooka
7ec7a51957 Don't free extattr resources until it is certain that unmount
succeeds.  Also, "unmount system call" -> "unmount vfs operation"
in comment just so that our comments aren't 15+ years outdated.
2009-07-31 20:58:50 +00:00
pooka
7982dc729e Restore error behaviour bulldozed in rev 1.246.
might fix PR kern/41769
2009-07-23 01:10:02 +00:00
dholland
b58d0cd33a typo in comment 2009-07-22 04:49:19 +00:00
dholland
22ba08b022 minor knf 2009-07-19 04:16:23 +00:00
dholland
0b98e26158 typo in comment 2009-07-19 03:39:14 +00:00
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