Commit Graph

1804 Commits

Author SHA1 Message Date
hannken
e8c9988bef Make whiteouts work on journaling ffs file system by adding the missing
UFS_WAPBL_BEGIN() / UFS_WAPBL_END() around CREATE and DELETE ops.

Fixes PR #44377 (union whiteouts don't work on ffs -o log)
2011-08-03 10:03:51 +00:00
riastradh
a09628eca6 In ufs_rename, declare oldparent and newparent ino_t, not int.
XXX There should be an automatic test for this somewhere.

ok dholland
2011-07-29 22:18:56 +00:00
dholland
36c3688f7b Remove some unneeded rename-related static const data.
(Why didn't gcc warn that this was unused?)
2011-07-18 06:46:05 +00:00
dholland
8b45aa4ea4 Eliminate the old ufs_rename. The only reason the WAPBL one was
different is that in order to avoid issues with the WAPBL journal lock
the wrong locking had to be changed to different wrong locking. This
is now moot.

I have not hand-validated that the current two copies of rename are
equivalent, or that the locking fixes merged with the old rename
produce code that is textually identical (modulo WAPBL calls that do
nothing when WAPBL is turned off) to the WAPBL rename... but I did
this check when preparing my previous round of rename patches last
year and all updates since have been applied to both.
2011-07-18 06:45:47 +00:00
dholland
ffbed3d146 Move ufs_wapbl_rename to ufs_vnops.c next to the old ufs_rename. 2011-07-18 06:45:27 +00:00
dholland
091c1fe61a ok, it is clear that at least vput(vp) needs to go before fstrans_done().
I hoping vput(dvp) doesn't, because if it does that will vastly complicate
future vfs locking cleanup.
2011-07-18 02:35:11 +00:00
dholland
c751831386 Add the long essay on rename locking from my earlier patch set as a
big comment, and expand it some for clarity.
2011-07-18 01:52:55 +00:00
dholland
5c6ce29c40 More rename tidying. 2011-07-18 01:14:27 +00:00
dholland
fe126fdad8 In ufs_wapbl_rename, remove #if 0 blocks and remove code for
now-impossible cases.
2011-07-18 01:14:04 +00:00
dholland
964d208c77 Fix error path for UFS_WAPBL_BEGIN failure to avoid leaking an vnode
(in memory) and inode (on disk). Caution: untested; I have no idea how
to provoke such a failure.
2011-07-18 01:13:33 +00:00
dholland
84a8bd42ce minor amendment to previous 2011-07-17 22:14:47 +00:00
dholland
d1917ffca2 Provide correct locking for ufs_wapbl_rename. Note that this does not
fix the non-wapbl rename; that will be coming soon. This patch also
leaves a lot of the older locking-related code around in #if 0 blocks,
and there's a lot of leftover redundant logic. All that will be going
away later.

Relates to at least these PRs:

  PR kern/24887
  PR kern/41417
  PR kern/42093
  PR kern/43626

and possibly others.
2011-07-17 22:07:59 +00:00
dholland
9ae442b9dd At the end of ufs_rmdir, don't use a dangling vnode pointer to call
fstrans_done. Ok hannken@
2011-07-17 22:02:26 +00:00
dholland
3d3932fe1c Fix typo in ufs_rmdir that causes locking botches. This code should be
unreachable because the FS-independent code contains the same test... but
I'm not sure if that applies if nfsd is involved.
2011-07-17 22:00:38 +00:00
joerg
3eb244d801 Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
2011-07-17 20:54:30 +00:00
dholland
1e67a4f4c7 Clean up handling of ufs_lookup_results in rename. 2011-07-14 16:27:43 +00:00
dholland
6e7d5c61d5 Update comments on functions that take ufs_lookup_results. 2011-07-14 16:27:11 +00:00
dholland
b21c832176 Pass the ufs_lookup_results pointer around instead of fetching it from
the inode in the guts of ufs. Now, in VOPs where i_crap is used it is
used (directly) only immediately on entry to the VOP call and then
passed around by reference.

Except for rename, which needs explicit sorting out. The code in
ufs_wapbl_rename is unchanged in behavior but I'm increasingly
inclined to think it's wrong.
2011-07-12 16:59:48 +00:00
dholland
26cd068e1f Currently, ufs_lookup produces five auxiliary results that are left in
the vnode when lookup returns and fished out again later.

1. Create struct ufs_lookup_results to hold these.

2. Call the ufs_lookup_results instance in struct inode "i_crap" to be
clear about exactly what's going on, and to distinguish the lookup
results from respectable members of struct inode.

3. Update references to these members in the directory access
subroutines.

4. Include preliminary infrastructure for checking that the i_crap
being used is still valid when it's used. This doesn't actually do
anything yet.

5. Update the way ufs_wapbl_rename manipulates these elements to use
the new data structures. I have not changed the manipulation; it may
or may not be correct but I continue to suspect that it is not.

The word of the day is "stigmergy".
2011-07-12 02:22:13 +00:00
hannken
49511bba25 Change VOP_BWRITE() to take a vnode as its first argument like all other
VOPs do.  Layered file systems no longer have to modify bp->b_vp and run
into trouble when an async VOP_BWRITE() uses the wrong vnode.

- change all occurences of VOP_BWRITE(bp) to VOP_BWRITE(bp->b_vp, bp).
- remove layer_bwrite().
- welcome to 5.99.55

Adresses PR kern/38762 panic: vwakeup: neg numoutput

No objections from tech-kern@.
2011-07-11 08:27:37 +00:00
manu
9f214ee2a6 Fix locking protocol to avoid a panic on extattrctl stop and on umount. 2011-07-07 14:56:45 +00:00
manu
be95d60797 Add a flag to VOP_LISTEXTATTR(9) so that the vnode interface can tell the
filesystem in which format extended attribute shall be listed.

There are currently two formats:
- NUL-terminated strings, used for listxattr(2), this is the default.
- one byte length-pprefixed, non NUL-terminated strings, used for
  extattr_list_file(2), which is obtanined by setting the
  EXTATTR_LIST_PREFIXLEN flag to VOP_LISTEXTATTR(9)

This approach avoid the need for converting the list back and forth, except
in libperfuse, since FUSE uses NUL-terminated strings, and the kernel may
have requested EXTATTR_LIST_PREFIXLEN.
2011-07-04 08:07:29 +00:00
hannken
661fcc7b37 ffs_copyonwrite(): If the write is to the in-file-system journal
there is no need to lock and check the snapshots.
2011-07-01 14:28:21 +00:00
manu
d8abff28ef Implement extended attribute listing for UFS1.
Modify lsextattr(8) so that it does not expect each attribute name to be
prefixed by its length. This enable extattr_list_(file|link|fd) to
return a buffer matching its documentation. This also makes the interface
similar to what Linux and FUSE do, which is nice for interoperability.

Note that since we had no EA implementation supporting listing, we do
not break anything.
2011-06-27 16:34:47 +00:00
mrg
ff721708ed fix an off by one array overflow found by GCC 4.5.3. 2011-06-22 04:01:33 +00:00
rmind
7083a919fc - Fix a silly bug: remove umap from uobj in ubc_release() UBC_UNMAP case.
- Use UBC_WANT_UNMAP() consistently.

ARM (PMAP_CACHE_VIVT case) works again.
2011-06-19 02:42:53 +00:00
manu
448e1c49b2 Add mount -o extattr option to enable extended attributs (corrently only
for UFS1).
Remove kernel option for EA backing store autocreation and do it by
default. Add a sysctl so that autocreated attriutr size can be modified.
2011-06-17 14:23:50 +00:00
hannken
d296304e60 Rename uvm_vnp_zerorange(struct vnode *, off_t, size_t) to
ubc_zerorange(struct uvm_object *, off_t, size_t, int) changing
the first argument to an uvm_object and adding a flags argument.

Modify tmpfs_reg_resize() to zero the backing store (aobj) instead
of the vnode.  Ubc_purge() no longer panics when unmounting tmpfs.

Keep uvm_vnp_zerorange() until the next kernel version bump.
2011-06-16 09:21:02 +00:00
manu
71d41cd3c4 Improve UFS1 extended attributes usability
- autocreate attribute backing file for new attributes
- autoload attributes when issuing extattrctl start
- when autoloading attributes, do not display garbage warning when looking
up entries that got ENOENT
2011-06-15 12:54:32 +00:00
rmind
e225b7bd09 Welcome to 5.99.53! Merge rmind-uvmplock branch:
- Reorganize locking in UVM and provide extra serialisation for pmap(9).
  New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
  the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
  Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
  kernel-lock on some ports).  Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
2011-06-12 03:35:36 +00:00
bouyer
a3a7248ce7 Fix bad cut'n'paste in copyright. Pointed out by dyoung@ 2011-06-07 14:56:12 +00:00
rmind
662361ae07 ufs_wapbl_verify_inodes: update to reality (if somebody decides to use this). 2011-05-23 22:02:26 +00:00
manu
110816765a Call ufs_extattr_vnode_inactive before UFS_WAPBL_BEGIN, as the latter will
leave the vnode locked, and ufs_extattr_vnode_inactive does lock/unlock
2011-05-19 03:25:11 +00:00
rmind
4a4e52516e Remove cache_purge(9) calls from reclamation routines in the file systems,
as vclean(9) performs it for us since Lite2 merge.
2011-05-19 03:11:55 +00:00
manu
25ff744367 Fix filesystem root leaked lock when using UFS_EXTATTR_AUTOSTART.
This way, statvfs(2) calls obtained by df(1) or umount(8) will no
longer sleep forever in the kernel to acquire the lock.
2011-05-10 08:29:32 +00:00
hannken
f7e12f18b3 Revert previous commit. Locking the snapshot vnode while the file system
is suspended extends the suspension until the vnode gets unlocked by
the caller of ffs_snapshot().

Resuming the file system before expunging all snapshots and syncing the
snapshot creates races and deadlocks with journaling file systems at least.
2011-05-08 18:37:15 +00:00
hannken
316e4e1a25 ufs_mknod: change vnode type to VNON before it gets unlocked. Closes a small
window where the vnode could have type VCHR but op vector ffs_vnodeop_p.
2011-04-30 14:24:27 +00:00
hannken
b28fa91685 Before expunging all snapshots take the snapshot lock and resume the file
system as this is sufficient for the remaining operations.

Reduces the time the file system is suspended and should make this time
independent of the number of snapshots already present.
2011-04-29 09:45:15 +00:00
hannken
bb3ca01e60 Cleanup ffs fsync and make devices on wapbl enabled file systems work here:
- Replace the ugly sync loop in ffs_full_fsync() and ffs_vfs_fsync() with
  vflushbuf().  This loop is a relic of softdeps and not needed anymore.

- Add ffs_spec_fsync() for device nodes on ffs file systems that calls
  spec_fsync() like all other file systems do and then updates the ctime.

Discussed on tech-kern.

Should fix PRs:
PR #41192 wapbl diagnostic panic during cgdconfig
PR #41977 kernel diagnostic assertion "rw_lock_held(&wl->wl_rwlock)" failed
PR #42149 wapbl locking panic if watching DVD
PR #42551 Lockdebug assert in wapbl when running zpool
2011-04-27 07:24:52 +00:00
hannken
87522af425 Change vflushbuf() to return an error if a synchronous write fails.
Welcome to 5.99.51.
2011-04-26 11:32:38 +00:00
rmind
800683e30d sys_link: prevent hard links on directories (cross-mount operations are
already prevented).  File systems are no longer responsible to check this.
Clean up and add asserts (note that dvp == vp cannot happen in vop_link).

OK dholland@
2011-04-24 21:35:29 +00:00
hannken
7c9d6febb5 ffs_snapshot(): return an error if the node is an invalid snapshot. 2011-04-23 08:23:52 +00:00
hannken
36046fc79f Try to keep snapshot indirect blocks contiguous.
This speeds up snapshot creation by a factor of ~3 and reduces
the file system suspension time by a factor of ~5.
2011-04-23 07:36:02 +00:00
hannken
21d54ad389 Preallocate all cylinder group blocks so we no longer redo ~50% of
the cylinder groups while the file system is suspended.
This was removed in error with Rev 1.16.

From Manuel Bouyer <bouyer@netbsd.org> via tech-kern.
2011-04-18 07:36:13 +00:00
hannken
186b31b4b7 ffs_fsync: no need for wapbl_vptomp() here -- vnode is always VREG. 2011-04-15 15:54:11 +00:00
ahoka
4271847c2e add "struct ufid;" so we can include it without ufs/inode.h 2011-04-04 21:46:15 +00:00
rmind
c71a09f0c6 - Use offsetof() in VOPARG_OFFSETOF() instead of re-implementing it.
- Remove VDESC_NOMAP_VPP and VDESC_VPP_WILLRELE.
- Remove VRELEL_NOINACTIVE and VRELEL_ONHEAD.
2011-04-03 01:19:35 +00:00
rmind
fbc8beae75 Split off parts of vfs_subr.c into vfs_vnode.c and vfs_mount.c modules.
No functional change.  Discussed on tech-kern@.
2011-04-02 04:28:56 +00:00
mlelstv
8e9bf29753 Don't abort when APPLE_UFS autodetection cannot read the apple ufs label
due to sector size or alignment problems. Autodetection is only a safety
measure, you should mark the filesystem type in the BSD disklabel.
2011-03-27 08:04:50 +00:00
bouyer
ae251adee8 Don't include quota/quotaprop.h for tools. 2011-03-25 10:25:17 +00:00