DragonFly commits List (threaded) for 2010-02
git: kernel - TMPFS - Bug fixing pass
Author: Matthew Dillon <firstname.lastname@example.org>
Date: Fri Feb 12 19:15:21 2010 -0800
kernel - TMPFS - Bug fixing pass
* TMPFS_ASSERT_ELOCKED() is called in numerous places where
tn_vnode is not necessarily assigned, for example during
tmpfs_nremove() after the directory entry has been cleaned out.
Remove the assertion that tn_vnode != NULL.
* Add tmpfs_mount->tm_flags and TMPFS_FLAG_UNMOUNTING, used during
unmounting to tell tmpfs_fsync() to throw away the contents of
the file (normally it ignores it). This fixes a panic on umount
when the main kernel checks that all dirty buffers have been
* Fix two places where the wrong length for a string is
being kmalloc()'d. The softlink and the directory entry
string allocations were wrong and resulted in a string
terminator being stuffed beyond the end of the malloced
* Do a safety-NULL-out of a few fields after kfree()ing them.
* Refactor tmpfs_dir_lookup() a little.
* Enhance tmpfs_reg_resize() to also resize the SWAP VM object.
Failing to do so can leave extranious swap assignments for
deleted areas of the file which become visible again (instead
of becoming zero-fill) if the file is then later ftruncate()d
Also fix the block size parameters to nvtruncbuf() and nvextendbuf().
It must match the block size used for the buffer cache.
* Temporarily turn off all the MPSAFE flags. Run under the BGL.
* The buffer offset (offset) in tmpfs_read() and tmpfs_write()
can be a size_t. It does not have to be off_t.
* tmpfs_write() was using getblk(). It actually has to use bread()
in order to ensure that the buffer contents is valid when potentially
doing a piecemeal write which does not cover the whole buffer.
* Refactor tmpfs_write() to leave the underlying VM pages dirty,
except in cases the system page daemon wants to flush pages to
clear space in ram (IO_SYNC, IO_ASYNC). Use buwrite() to do this.
* Fix an error path in tmpfs_strategy() which was not biodone()ing
* tmpfs_remove() was making assumptions with regards to v->a_nch.ncp->nc_vp
which were not correct. The vp is not referenced and can get ripped
out from under the caller unless properly handled.
* Fix sequencing in tmpfs_inactive(). If tn_links is 0 and the node
is not in the middle of being allocated we can destroy it.
* Remove unnecessary vnode locks from tmpfs_reclaim(). There are also other
vnode locks scattered around that aren't needed (for another time).
* Implement vop_bmap(), it is basically a dummy.
Summary of changes:
sys/vfs/tmpfs/tmpfs.h | 6 ++-
sys/vfs/tmpfs/tmpfs_subr.c | 49 +++++++++++----
sys/vfs/tmpfs/tmpfs_vfsops.c | 8 ++-
sys/vfs/tmpfs/tmpfs_vnops.c | 137 +++++++++++++++++++++++++++++-------------
4 files changed, 140 insertions(+), 60 deletions(-)
DragonFly BSD source repository