Commit Graph

1342 Commits

Author SHA1 Message Date
hannken
7c028d0f99 VOP_ABORTOP() has no specific lock requirements so there is no need
to force locked vnodes here.  It should be impossible to come here
with a nil upper node.

Relock the directory vnode after copyup.  A locked union node with an
unlocked upper vnode can no longer exist so make FIXUP() an assertion.
2011-11-14 18:42:57 +00:00
hannken
3e29235de5 Remove a needless vnode lock/unlock dance. This is a leftover from the
removal of VOP_LEASE().

Function union_removed_upper() always works on unlocked upper vnodes so
remove the test-and-unlock and add an assertion.
2011-11-14 18:38:13 +00:00
hannken
d84a65dd80 VOP_OPEN() needs a locked vnode. All these copy-and-pasted xxxfs_mount()
implementations need more review.
2011-11-14 18:35:12 +00:00
christos
1058c21f81 use getdisksize() 2011-11-13 23:08:47 +00:00
christos
3cc8e640ed remove unused call to DIOCGPART that was only used for debugging.
malloc M_WAITOK, does not fail.
2011-11-13 23:07:11 +00:00
christos
05bbfb83a3 use getdisksize() 2011-11-13 23:03:55 +00:00
christos
3aa8e3d303 use getdisksize, M_ZERO, and malloc M_WAITOK doesn't fai. 2011-11-13 18:29:08 +00:00
dholland
0b69cddad2 Avoid panic on error path, from PR 45607. The error path is exercised
because this is using DIOCGPART to get the volume size, which doesn't
work on wedges. It should be calling getdisksize() instead.
2011-11-13 17:22:51 +00:00
hannken
405b01b248 Add a comment that pn_sizemtx should be useless as VOP_GETATTR now
needs a shared lock at least.
2011-10-30 13:24:13 +00:00
hannken
113be15313 VOP_GETATTR() needs a shared lock at least. 2011-10-23 08:42:06 +00:00
manu
399ad65db5 Remove #ifdef DIAGNOSTIC guards around KASSERT, as the macro contains them 2011-10-19 01:39:29 +00:00
hannken
7e4dd4325b VOP_GETATTR() needs a shared lock at least.
While here fix a typo (fvp -> tvp).
2011-10-18 20:20:29 +00:00
manu
bd77be0ce7 Make sure pagedaemon does not sleep for memory in puffs_vnop_sleep.
Add KASSERT on any sleeping memory allocation to check it cannot happen again.
2011-10-18 15:39:09 +00:00
hannken
749d77682d VOP_GETATTR() needs a shared lock at least. 2011-10-18 09:22:53 +00:00
manu
7f182e39c1 Roll back the change that forced kernel threads to not sleep in PUFFS.
The change does not make consensus, since only pagedaemon should need it.
Other threads will tolerate sleeping, and problems here are only symptoms
that something is going wrong in memory management. The cause, not the
symptoms, need to be fixed.
2011-10-17 23:54:01 +00:00
hannken
2083e28d1f VOP_GETATTR() needs a shared lock at least.
While here fix a typo (fvp -> tvp).
2011-10-16 12:41:45 +00:00
hannken
34f54c83be As vnalloc() always allocates with PR_WAITOK there is no longer the need
to test its result for NULL.
2011-10-07 09:35:04 +00:00
christos
8b0d7f915b rename SMBFS_MAXFNAMELEN to SMBFS_MAXNAMLEN for consistency 2011-09-27 02:05:10 +00:00
christos
d4bb8ac2b1 don't get affected by the NAME_MAX bump. Use the same constant as the
rest of the extrattr code.
2011-09-27 01:48:57 +00:00
christos
1e439c8185 define NILFS_MAXNAMLEN and use it. 2011-09-27 01:34:41 +00:00
christos
2fcd0204c6 return UDF_MAXNAMLEN instead of NAME_MAX 2011-09-27 01:33:30 +00:00
christos
367fc9326f return TMPFS_MAXNAMLEN instead of NAME_MAX 2011-09-27 01:32:21 +00:00
christos
5377c21fee use ISO_MAXNAMLEN instead of NAME_MAX 2011-09-27 01:27:44 +00:00
christos
d30021427a use NAME_MAX instead of MAXNAMLEN 2011-09-27 01:14:47 +00:00
christos
3a8df9f090 - rename UDF_MAX_NAMELEN -> UDF_MAXNAMLEN
- use NAME_MAX instead of MAXNAMLEN
2011-09-27 01:13:16 +00:00
christos
a00d98eb66 define and use TMPFS_MAXNAMLEN instead of MAXNAMLEN 2011-09-27 01:10:43 +00:00
christos
4fa49ab869 define and use ISO_MAXNAMLEN instead of MAXNAMLEN 2011-09-27 01:01:43 +00:00
manu
38de55a5dd Fix the build that was broken by struct lwp *updateproc reference in
RUMP-visible code. Instead of checking that updateproc (aka ioflush,
aka syncer) will not sleep in PUFFS code, I check for any kernel thread:
after all none of them are designed to hang awaiting for a remote filesystem
operation to complete.
2011-09-23 01:57:32 +00:00
manu
da3795c23e Make sure ioflush does not sleep in PUFFS code path, waiting for a mutex,
a memory allocation, or a response from the filesystem.

This avoids deadlocks in the following situations:
1) when memory is low: ioflush waits the fileystem, the fielsystem waits
   for memory
2) when the filesystem does not respond (e.g.: network outage ona
   distributed filesystem)
2011-09-21 15:36:33 +00:00
christos
025e844498 don't update access/change times on open. 2011-09-16 18:43:44 +00:00
plunky
7f3d4048d7 NULL does not need a cast 2011-08-31 18:31:02 +00:00
manu
96c935e33b Add a mutex for operations that touch size (setattr, getattr, write, fsync).
This is required to avoid data corruption bugs, where a getattr slices
itself within a setattr operation, and sets the size to the stall value
it got from the filesystem. That value is smaller than the one set by
setattr, and the call to uvm_vnp_setsize() trigged a spurious truncate.
The result is a chunk of zeroed data in the file.

Such a situation can easily happen when the ioflush thread issue a
VOP_FSYNC/puffs_vnop_sync/flushvncache/dosetattrn while andother process
do a sys_stat/VOP_GETATTR/puffs_vnop_getattr.

This mutex on size operation can be removed the day we decide VOP_GETATTR
has to operated on a locked vnode, since the other operations that touch
size already require that.
2011-08-29 04:12:45 +00:00
hannken
8dc51ab7d8 Print the warning message on mount once.
Should fix PR #42795 (patch to make mounting union filesystems less obnoxious)
2011-08-28 08:27:57 +00:00
hannken
f68873a343 Finish and enable whiteout support for tmpfs:
- Enable VOP tmpfs_whiteout().
- Support ISWHITEOUT in tmpfs_alloc_file().
- Support DOWHITEOUT in tmpfs_remove() and tmpfs_rmdir().
- Make rmdir on a directory containing whiteouts working.

Should fix PR #35112 (tmpfs doesn't play well with unionfs).
2011-08-27 15:32:28 +00:00
hannken
f937bd97b7 Stop abusing relookup() to prepare the creation of new nodes
in the upper layer.
Replace union_relookup() with union_do_lookup() that prepares
a component, calls VOP_LOOKUP() and does the EEXIST test.
2011-08-23 07:39:37 +00:00
riastradh
b4d52ac6e6 Fix tmpfs_rename locking.
Fixes PR kern/36681.  tmpfs now survives dirconc, all our vfs/tmpfs
tests and rename races in atf, and a bunch of hand-written tests
that I'd commit if atf didn't find them highly indigestible.

ok dholland
2011-08-18 21:42:18 +00:00
mbalmer
0813ba11d0 Fix some typos. 2011-08-16 14:29:16 +00:00
apb
464d645aeb Rename all static functions to have "v7fs_" prefix. Fixes a problem
in the tools build, where the static link() and unlink() functions
conflicted with those declared in <unistd.h>.
2011-08-14 09:02:07 +00:00
hannken
1147247693 Use mutexes to protect the hash lists instead of tsleep/wakeup. 2011-08-13 10:48:14 +00:00
hannken
94fc281af2 Change some #ifdef DIAGNOSTIC' to KASSERT'.
Instead of a `pid_t' use a `lwp_t *' for locking diagnostics.

No functional changes intended.
2011-08-12 17:41:17 +00:00
hannken
b8e5efdc84 Add missing parts to mount devices from a union file system:
- union_close()    has to lock/unlock the lower vnode.
- union_fsync()    has to call spec_fsync() for the union vnode.
- union_strategy() must allow writes to devices on the lower file system.
- union_bwrite()   was completely missing.
2011-08-12 14:36:29 +00:00
hannken
7b19d6d068 When creating a union node representing a device initialize
the spec_node to make vrele() happy.
2011-08-12 06:40:10 +00:00
hannken
3ec6312958 Update the (shared) v_interlock if the upper node changes. 2011-08-10 15:56:01 +00:00
hannken
b80057eeb2 For devices, sockets and fifos ignore setting the file size to zero to make
open(..., O_TRUNC) happy and allow them to write through the lower layer.

Fixes PR #43560 (writing to null device in unionfs fails)
2011-08-10 06:27:02 +00:00
hannken
9be6a4a9b4 Use LK_SHARED, it is sufficient for VOP_GETATTR() and VOP_READDIR(). 2011-08-10 06:19:54 +00:00
uch
f2404aeb3c Remove suspicious warning message. 2011-08-08 11:42:30 +00:00
hannken
342315ffad Change union rmdir semantics to fail directory removal for
non-empty directories like all other file systems do.

Change test accordingly.
2011-08-07 06:01:51 +00:00
hannken
efc3d2ec25 When union_lookup() creates a shadow directory and nameiop is not LOOKUP
it has to restart the lookup to get the componentname right.

Fixes PR #44383 (an endless stream of whiteout and opaque dir problems ...)
2011-08-05 08:17:47 +00:00
dholland
66d63879a2 Insert casts to off_t to avoid 32-bit multiplication overflow when
computing device offsets on 32-bit platforms. Should fix PR 45191.
2011-08-03 16:21:52 +00:00
uch
b53b51d13e v7fs_lookup() fix return value. Pass t_vnops rename_dir(3)
v7fs_setttr() check credential. Pass t_unpriv owner
v7fs_rename() reload inode(v7fs_vnode_reload). Pass t_vnops rename_reg_nodir
2011-07-30 03:53:18 +00:00