Commit Graph

104 Commits

Author SHA1 Message Date
pgoyette 9d1eb4704f Add "bufq_fcfs" requirement to all those driver modules that explicitly
request it in their calls to bufq_alloc().
2018-01-23 22:42:29 +00:00
hannken a59aeb0cc1 Pass residual back to b_resid for persistent snapshots. 2017-12-21 15:51:39 +00:00
hannken daec163d65 Bounds check against media size for non-persistent snapshots. 2017-12-21 15:51:07 +00:00
hannken 2449af78f2 Treat partial read from backing store as I/O error. 2017-12-21 15:50:33 +00:00
pgoyette a9ea0b5369 If config_cfattach_detach() returns an error, handle it instead of
ignoring.  Otherwise the mutex will get destroyed and we'll unload
the module, and any active users will eventually cause a panic.

Noted by code inspection.

XXX pullup to netbsd-8
2017-12-17 22:09:47 +00:00
riastradh 1f73c3c78a Kill some more extern cfdriver xyz_cd in favour of #include "ioconf.h". 2017-10-28 03:47:24 +00:00
chs fd34ea77eb remove checks for failure after memory allocation calls that cannot fail:
kmem_alloc() with KM_SLEEP
  kmem_zalloc() with KM_SLEEP
  percpu_alloc()
  pserialize_create()
  psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
2017-06-01 02:45:05 +00:00
hannken 7599fb1f37 Bring back vrele_flush() to flush deferred vrele() o an suspended file system. 2017-02-17 08:30:00 +00:00
hannken 64a4d4bd11 Untangle VFS_SYNC() from VFS_SUSPENDCTL(). 2017-02-17 08:29:11 +00:00
hannken b9214c1c83 Disestablish COW handler on error. No need to do further copies after
the snapshot device failed.

Should fix PR kern/51377: fss(4) panic if snapshot mounted read/write
2016-07-31 12:17:36 +00:00
pgoyette 763a6486bb More adaptation of the rump component init, to avoid EEXIST during
regular module initialization.
2016-07-30 22:36:14 +00:00
christos e7ae23fd9e include "ioconf.h" to get the 'void <driver>attach(int count);' prototype. 2015-08-20 14:40:16 +00:00
justin 0cf8ba0039 Use devmajor_t not int 2014-10-02 22:05:38 +00:00
dholland f9228f4225 Add d_discard to all struct cdevsw instances I could find.
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25 08:10:31 +00:00
dholland 8c70ef39af Add d_discard to all struct bdevsw instances I could find.
I've set them all to nodiscard. Some of them (wd, dk, vnd, ld,
raidframe, maybe cgd) should be implemented for real.
2014-07-25 08:02:18 +00:00
hannken 20e9f60dc1 Use broadcast after freeing a cache entry. A waiter may not
use a cache entry after wakeup leading to possible deadlock.
2014-05-25 13:52:12 +00:00
dholland a68f9396b6 Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
2014-03-16 05:20:22 +00:00
skrll dd7bb1e0a8 G/C sys/simplelock.h includes 2014-02-28 10:16:51 +00:00
hannken 9f9ac3cb83 Make the spec_node table implementation private to spec_vnops.c.
To retrieve a spec_node, two new lookup functions (by device or by mount)
are implemented.  Both return a referenced vnode, for an opened block device
the opened vnode is returned so further diagnostic checks "vp == ... sd_bdevvp"
will not fire.  Otherwise any vnode matching the criteria gets returned.

No objections on tech-kern.

Welcome to 6.99.17
2013-02-13 14:03:48 +00:00
hannken c79f581459 Lookup the block device mounted on from the specfs_hash table.
This doesn't belong here but makes it possible to pullup.

Fixes PR kern/47020 (fss(4) panic)
2013-02-06 09:33:16 +00:00
hannken e48a44a0d4 Take fss_device_lock first when closing a fss device.
Fixes PR kern/47514 (Multiple dump -X triggers kernel panic in fss_ioctl)
2013-02-06 09:29:46 +00:00
hannken b202e26bfe Minor fix to previous -- release vnode after last use, not before. 2012-07-28 16:14:17 +00:00
hannken 8f23e66316 Use `getdisksize()' to get the size of the mounted-on block device.
Should work for disks without partition table (wedges) now.
2012-07-28 15:12:42 +00:00
bouyer 63eaa7629c On LP64 host, fss_get and fss_get50 have the same size; so FSSIOCGET50
and FSSIOCGET are identical and the compiler complains about
"duplicate case value". Guard FSSIOCGET50 with #ifndef _LP64/#endif to
fix this.
2011-11-30 09:51:18 +00:00
bouyer 7433040a2f Complete backward compat with NetBSd 5.x: time_t changed size, so did
struct timeval, and so did struct fss_get. So we need a compat FSSIOCGET50
ioctl.
2011-11-29 20:56:12 +00:00
bouyer fc062079c1 Fix FSSIOCSET50: needs to use the 5.0 struct fss_set, not the current one. 2011-11-29 19:17:03 +00:00
rmind a0ffc02ab8 Rename slightly misleading KTHREAD_JOINABLE to KTHREAD_MUSTJOIN. 2011-08-07 14:03:15 +00:00
hannken 58698054d5 Use kthread_join() to wait for the termination of the helper thread. 2011-06-21 13:59:41 +00:00
hannken f33030999c When reading or writing the backing store us POSIX_FADV_NOREUSE access hint
to prevent read ahead.
2011-06-21 12:41:24 +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
joerg 8c8d4b56e2 Don't use string literal as format string. 2011-05-23 21:18:55 +00:00
hannken 05e91bfee8 fss(4): Allow FSSIOCSET to set the initial flags. Add a new flag
"FSS_UNLINK_ON_CREATE" to unlink the backing store before
        the snapshot gets created.

With this change dump(8) no longer dumps the zero-sized, but named
snapshot it is working on.  Same applies to fsck_ffs(8).
2011-02-24 09:38:57 +00:00
hannken 8f78757b95 Remove an always true if-clause. 2010-12-27 18:41:07 +00:00
dholland 8f6ed30d57 Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
2010-11-19 06:44:33 +00:00
hannken 1423e65b26 Clean up vnode lock operations pass 2:
VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
2010-06-24 12:58:48 +00:00
pooka 0971e4900c release lock in error branch 2010-04-16 11:22:43 +00:00
hannken d4436d742d fss_softc_free: don't detach a disk that is not attached. Disk is
attached only if the backing store thread is running.

Resolves PR #43153: fss error branch error
2010-04-13 07:58:54 +00:00
pooka 536aa3a306 Ignore EEXIST from devsw_attach. This is not the optimal solution,
but it makes it possible to dynamically create device nodes for
fss before the fss module init runs by allowing to run devsw_attach
earlier.
2010-04-12 22:29:11 +00:00
hannken 374700a3d9 Remove unused fss_softc member sc_bs_size. 2010-04-05 09:30:46 +00:00
hannken 58cd15b068 Remove unneeded vinvalbuf() on backing store as we don't use
VOP_BMAP()/VOP_STRATEGY() here.
2009-10-17 10:29:29 +00:00
hannken 64747bca1d Fix a race where the backing store thread runs (and exits immediately)
before kthread_create() returns.
2009-10-13 12:37:19 +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
yamt 70de973662 g/c BUFQ_FOO() macros and use bufq_foo() directly. 2009-01-13 13:33:58 +00:00
hannken a797621996 fss_bs_thread: initialize b_error and b_resid.
Before it was possible for fss reads to return bogus b_resid values
leading to "delta > 0" panics from physio().
2008-11-05 19:30:57 +00:00
hannken 597afdd860 Make fss(4) D_MPSAFE.
- Use the device lock to protect fss_open(), fss_close() and fss_unmount_hook().
- Make sure fss_bs_thread() does not call biodone() with locks held.

Reviewd by: Andrew Doran <ad@netbsd.org>
2008-10-01 10:45:11 +00:00
hannken 95da771bbd Build modular fss driver.
Reviewed by: Quentin Garnier <cube@netbsd.org>
2008-09-23 07:56:59 +00:00
hannken 2b3efeeac5 Persistent snapshots do not need to allocate the variable softc elements. 2008-09-18 10:52:14 +00:00
hannken 8de1a273e1 Replace the fss unmount hook with a vfs_hook.
fssvar.h:       struct device * -> device_t.
fss.c:          establish unmount hook on first attach, remove on last detach.
vfs_syscalls.c: remove the call of fss_umount_hook().
vfs_trans.c:    destroy cow handlers on unmount as fstrans_unmount() will be
                called before vfs_hooks.
2008-09-17 14:49:25 +00:00
hannken fce2c1d412 Create fss(4) devices on first open and destroy on last close of an
unconfigured device.  That removes the compile-time constant number
of useable devices.
While here, add disk_busy()/disk_unbusy() instrumentation.

Reviewed by: Quentin Garnier <cube@netbsd.org>
2008-09-14 16:10:19 +00:00
hannken d5a365311b Remove FSS_STATISTICS. It was never documented and has no real value.
While here, modify fss_error() to no longer use variable arguments.

No functional changes.
2008-09-14 10:12:14 +00:00