Commit Graph

1636 Commits

Author SHA1 Message Date
reinoud
a2b485ee86 Relax the KASSERT since an equal size is no issue 2014-12-03 21:34:55 +00:00
nakayama
687aa18d14 Avoid use after pool_put. 2014-11-25 12:33:13 +00:00
christos
53bfb03cf5 make this compile again. 2014-11-17 02:23:33 +00:00
christos
a95736d447 PR/49207: Kamil Rytarowski: Add sys/clock.h with generic time macros
(derived from clock_subr.h). Keep clock_subr.h with the kernel structures
and functions to reduce diffs, and have clock.h only include standalone
constants and macros.
2014-11-17 02:15:48 +00:00
nakayama
8c1c14022f Adjust smbfs/netsmb for filenames byte length changes that come as
a result of iconv conversion.  Most codes are taken from FreeBSD.
2014-11-15 18:52:44 +00:00
hannken
0bac62655e Change ntfs to vcache.
- Use (inumber, attrtype, attrname) as key.
- Inline ntfs_fget() and ntfs_frele() as they only get called once.
2014-11-13 16:51:53 +00:00
hannken
a26eea283a - Change ntfs_vgetex() to always load the ntnode and fnode.
- Take the vnode attributes from the NAME attribute.
- Remove now unused ntfs_times() and ntfs_filesize().
- Treat nodes without an unnamed DATA attribute as zero-sized regular files.
2014-11-13 16:51:10 +00:00
hannken
6f8e2ffe40 - Fix ntfs_ntlookupattr() to make the examples from the man page work.
- Fix ntfs_loadntnode() to always read full cluster to prevent buffer
  cache inconsistency.
- Change ntfs_vgetex() and ntfs_fget() to take a const attrname and
  always pass a possibly empty string.
- Change printf to dprintf.
- Get rid of dead fields i_next, i_prev of struct ntnode.
2014-11-13 16:49:56 +00:00
riz
28fe942ff2 Revert previous, it is actually needed. (builds are failing) 2014-11-10 19:44:08 +00:00
maxv
fcc99ce60e Do not uselessly include <sys/malloc.h>. 2014-11-10 18:46:33 +00:00
nakayama
bf71b4294d Fix vnode locking changes in rev.1.89:
- lock vnode by the end of cache_purge and vput.
2014-11-07 12:05:58 +00:00
manu
0c81f4b006 PUFFS direct I/O cache fix
There are a few situations where we must take care of the cache if direct
I/O was enabled:
- if we do direct I/O for write but not for read, then any write must
  invalidate the cache so that a reader gets the written data and not
  the not-updated cache.
- if we used a vnode without direct I/O and it is enabled for writing,
  we must flush the cache before compeling the open operation, so that
  the cachec write are not lost.

And at inactive time, we wipe direct I/O flags so that a new open without
direct I/O does not inherit direct I/O.
2014-11-04 09:14:42 +00:00
manu
17036f29cb Fix PUFFS node use-after-reclaim
When puffs_cookie2vnode() misses an entry, vcache_get()
creates a new node (puffs_vfsop_loadvnode being called to
initialize the PUFFS part), then it discovers it is VNON,
and tries to vrele() it. vrele() calls VOP_INACTIVE(),
which led us in puffs_vnop_inactive() where we sent a
request to the filesystem for a node that already had been
reclaimed.

The fix is to check for VNON nodes in puffs_vnop_inactive()
and to return without doing anyting. This is suboptimal, but
a better workaround would probably need to modify vcache API,
with an impact on other filesystems. Let us keep it simple.
2014-11-04 09:10:37 +00:00
manu
962cb9b884 Add PUFFS_HAVE_FALLOCATE in puffs_msgif.h so that filesystem can decide
at build time wether fallocate is usable
2014-10-31 14:20:54 +00:00
manu
78fa995d09 Add PUFFS support for fallocate and fdiscard operations 2014-10-31 13:52:41 +00:00
manu
ef586c84dd According to pooka@'s comment, a long time ago, VOP_STRATEGY could not
fail without taking down the kernel. It seems this is not the case anymore,
hence we can stop dropping errors in puffs_vnop_strategy()

Approved by pooka@
2014-10-31 13:51:33 +00:00
christos
2d22a4aaac Revert previous; it does not work with COMPAT_BSDPTY, screen(1) fails because
it does a TIOCPTSNAME immediately after opening ptmx and finds an old style pty.
2014-10-21 16:05:01 +00:00
snj
f0a7346d21 src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
2014-10-18 08:33:23 +00:00
christos
14b4a4b149 From Ilia Zykov:
- correct some incorrect comments
- add XXX warning
- increase security by activating when get the slave
- make pty_vn_open() private to tty_ptm.c
2014-10-15 15:00:03 +00:00
hannken
668c7daae4 Change nilfs to vcache. 2014-10-15 09:05:46 +00:00
hannken
52473f33d5 Prepare nilfs for vcache:
- Calling getnewvnode() with "mp == NULL" is wrong.  Stop attaching a
  vnode to system file nodes and change nilfs_bread() to translate
  the block address and then uyse the device for the read.
- Move the vnode initialisation to nilfs_get_node() and use
  nilfs_get_node_raw() to initialise the nilfs node only.
- Same for nilfs_reclaim() versus nilfs_dispose_node().
- Change nilfs_get_node() to return an unlocked vnode instead of
  a nilfs node with locked vnode.  Adapt nilfs_lookup() and nilfs_root().
- Don't treat unsupported node types (blk, chr ...) as regular,
  return ENXIO instead.
- Fix nilfs_getattr() to mask the mode with ALLPERMS.
- Destroy sync_cv before free.
2014-10-15 09:03:53 +00:00
uebayasi
fe9a32c84e Define filesystem attributes with vfs dependency. 2014-10-11 06:42:18 +00:00
he
89a215e851 Do the previous correctly... 2014-10-07 12:58:09 +00:00
he
d01de6e07a As is evidenced by several of our 32-bit MIPS ports, it's wrong to
print vsize_t with PRIx64 -- instead use our own PRIxVSIZE macro.
2014-10-07 11:37:06 +00:00
he
60c92b53ed Make this build again without debugging enabled; DPRINTF() can end up
as empty, and in an if conditional, you then need braces if that's the
only potential body.
2014-10-06 14:26:44 +00:00
manu
4cb6f55f7a Retore LP64 fix that was removed by mistake 2014-10-06 09:05:55 +00:00
manu
0671358a48 Improve zero-fill of last page after shrink fix:
1) do it only if the file is open for writing, otherwise we send write
requests to the FS on a file that has never been open.
2) do it inside existing if (vap->va_size != VNOVAL) block
2014-10-06 04:41:59 +00:00
apb
15239241e8 Add close brace, accidentally omitted from previous change. 2014-10-05 20:40:46 +00:00
apb
f1dbec9add Safer definitions of DPRINTF and DPRINTF_VERBOSE.
In the PUFFSDEBUG case, wrap do { ... } while (/*CONSTCOND*/0)
around the definitions.  In the non-PUFFSDEBUG case, define them
as ((void)0) instead of as empty.
2014-10-05 14:13:14 +00:00
justin
bc648e4794 Use PRIx64 for printing offsets 2014-10-05 09:28:24 +00:00
manu
2a5ce25ed0 If we truncate the file, make sure we zero-fill the end of the last
page, otherwise if the file is later truncated to a larger size
(creating a hole), that area will not return zeroes as it should.
2014-10-05 07:53:22 +00:00
hannken
e716e7d8d6 Change filecore to vcache.
Compile-tested only, was not able to get my hands on a readable fs image.
2014-10-04 13:27:24 +00:00
hannken
f401fa494c Fix the puffs_sop_thread -> puffs_cookie2vnode path:
- pass the cookie by reference
- add missing mutex_exit()
- update assertion for VNON typed vnodes
2014-09-30 10:15:03 +00:00
reinoud
ef40ac265a Fix bug introduced in last patch 2014-09-17 21:18:43 +00:00
reinoud
79652a00ee As pointed out by wiz@ prevent a possible attack or corruption that results in
an endless loop of indirect descriptors being processed.

The number of indirect descriptors followed is now maximized.
While here, also fix a use-after-free bug!
2014-09-17 19:47:05 +00:00
manu
209370b3d8 PUFFS fixes for size update ater write plus read/write sanity checks
- Always update kernel metadata cache for size when writing
  This fixes situation where size update after appending to a file lagged
- Make read/write nilpotent when called with null size, as FFS does
- Return EFBIG instead of EINVAL for negative offsets, as FFS does
2014-09-11 07:59:14 +00:00
gson
1b265e6701 Store symlinks without a NUL terminator so that lstat(2) returns the
correct length.  Fixes the tmpfs part of PR kern/48864.
2014-09-08 14:49:46 +00:00
manu
08a33828ae When changing a directory content, update the ctime/mtime in kernel cache,
otherwise the updated ctime/mtime appears after the cached entry expire.
2014-09-05 15:39:18 +00:00
matt
82ef6ef7b8 Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
2014-09-05 09:26:16 +00:00
matt
2b8e56db05 Don't use C++ class and this keywords as variables. 2014-09-05 05:39:52 +00:00
martin
3c93e210ff Make msdosfs time conversion use the y/m/d/h/m/s conversion functions
from clock_subr.c and compile that into the userland (and tools)
makefs as well.
2014-09-01 09:09:47 +00:00
hannken
accb62aedc Change puffs from hashlist to vcache.
- field "pa_nhashbuckets" of struct "puffs_kargs" becomes a no-op.
  and should be removed on the next protocol version bump.
2014-08-28 08:29:50 +00:00
maxv
5f2f7d8e15 Remove dead returns:
return VAR/func(XX);
	return VAR;

The latter is never reached. Sent on tech-kern@, no disagreement.
2014-08-21 06:40:35 +00:00
manu
7642144c05 Add a oflags input field to open requests so that the filesystem can pass
back information about the file. Implement PUFFS_OPEN_IO_DIRECT, which
will force direct IO (bypassing page cache) for the file.
2014-08-16 16:19:41 +00:00
hannken
b041904f72 Needs HASH_SLIST, not HASH_LIST. 2014-08-16 07:22:30 +00:00
hannken
912cfee7bf Change ptyfs to vcache.
- Use (type, minor) as key.
- Change ptyfs_allocvp to return a referenced vnode and lock where needed.
- Remove unneeded vnode backpointer ptyfs_vnode.
- Keep a single hashlist for pty nodes to make their attributes persistent.

OK: Christos Zoulas
2014-08-15 13:40:39 +00:00
maxv
b0e4602c25 Overflow if *data_len == OSIZE and args->version >= PTYFS_ARGSVERSION.
Sent on tech-kern@, ok christos@
2014-08-14 14:06:53 +00:00
hannken
2607f151da - Add a map of active controlling ptys per mount and no longer abuse
the vnode lifecycle.
- No longer set "recycle" on VOP_INACTIVE().
- Make ptyfs_used_get() private to ptyfs_subr.c
- Stop copying device attributes from traditional ptys on first allocation.
- Remove unneeded argument "lwp" from ptyfs_allocvp() and ptyfs_free_get().

OK: Christos Zoulas
2014-08-13 14:10:00 +00:00
maxv
10b6c96ec4 http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html#Report-2
#04-0x01: Uninitialized var 'rqp' (does not compile anyway)
2014-08-12 06:57:20 +00:00
hannken
265f1d8cdb Change hfs from hashlist to vcache.
- use (cnid, fork) as key.
- use pool for hfs nodes.
2014-08-10 08:53:22 +00:00