Commit Graph

2232 Commits

Author SHA1 Message Date
maxv
9aa6c10155 Small fixes.
ok hannken@
2015-06-28 10:04:32 +00:00
hannken
1c70c47140 ufs_inactive: stop overwriting error status and return the last error seen.
Should resolve CID 1306276 (UNUSED_VALUE)
2015-06-13 14:56:45 +00:00
hannken
180a9009d6 ufs_inactive: take UFS_WAPBL_BEGIN() before calling chkiq().
Should fix PR kern/49948 (quota panic)
2015-06-10 15:28:27 +00:00
hannken
fc48ac80f9 Fix copy and paste errors from last commits.
- Kernel i386/ALL and amd64/ALL compile again.
- Resolves CID 1304138 (DEADCODE) and 1304139 (IDENTICAL_BRANCHES).
2015-06-07 13:39:48 +00:00
hannken
d8868b1ee7 Change lfs from hash table to vcache.
- Change lfs_valloc() to return an inode number and version instead of
  a vnode and move lfs_ialloc() and lfs_vcreate() to new lfs_init_vnode().

- Add lfs_valloc_fixed() to allocate a known inode, used by kernel
  roll forward.

- Remove lfs_*ref(), these functions cannot coexist with vcache and
  their commented behaviour is far away from their implementation.

- Add the cleaner lwp and blockinfo to struct ulfsmount so lfs_loadvnode()
  may use hints from the cleaner.

- Remove vnode locks from ulfs_lookup() like we did with ufs_lookup().
2015-05-31 15:48:02 +00:00
hannken
cf850531be Make lfs_fastvget() private to lfs_syscalls.c, change it to take the
BLOCK_INFO and vnode lock type instead of the inode disk address and
return the vnode locked.

Change lfs_markv() and lfs_bmapv() to work on locked vnodes.
2015-05-31 15:45:18 +00:00
hannken
c063d4ccd5 Use VFS_PROTOS() for lfs.
Rename conflicting struct lfs field "lfs_start" to "lfs_s0addr".

No functional change.
2015-05-31 15:44:30 +00:00
maxv
9b2abda5c6 Add a missing goto.
(was here before my changes)

ok christos@
2015-05-23 16:59:13 +00:00
riastradh
6d6f14f9de memcpy di_extb/db/ib separately. Noted by Coverity, CID 974636. 2015-05-20 18:21:17 +00:00
riastradh
9a70a528ec Don't (harmlessly) overrun di_db array; copy di_ib separately.
Noted by Coverity, CID 974635.

While here, simplify size calculation for memcpy.
2015-05-20 18:19:09 +00:00
martin
445ccb6af2 Cosmetics: fix netbsd.org spelling 2015-05-19 06:44:42 +00:00
martin
7ae75c3e08 Print all sizes as size_t 2015-05-18 08:33:29 +00:00
martin
fa64e6ed3d Make the recently added fs_cgsize test less strict, as it prevents existing
installs from booting.
Catch the common case and warn about it, pointing to a web page describing
the issue - but allow mounting. In all other cases, print more details about
the inconsistency and fail the mount.
2015-05-18 08:07:29 +00:00
maxv
0b096b3626 ffs_superblock_validate(): check the size of cylinder groups. 2015-04-26 06:19:36 +00:00
maxv
459997491f Instead of duplicating code, create ffs_is_appleufs(): returns 1 if the
device is an AppleUFS FS, 0 otherwise.

This changes the behavior a bit: if the kernel cannot determine whether the
disk is an AppleUFS one or not, it now considers it as a normal UFS rather
than returning an error and not mounting/reloading it.

No particular comment on tech-kern@
2015-04-22 07:27:09 +00:00
riastradh
46e71c7d57 Make VOP_LINK return directory still locked and referenced.
Ride 7.99.10 bump.
2015-04-20 22:59:19 +00:00
riastradh
9368a7f9c7 Fix more dvp->v_mount after vput(dvp). 2015-04-20 21:02:49 +00:00
riastradh
f6139440c5 Make vget always return vnode unlocked.
Convert callers who want locks to use vn_lock afterward.

Add extra argument so the compiler will report stragglers.
2015-04-20 13:44:16 +00:00
riastradh
8f010f576c Release the glock on VOP_GETPAGES failure.
Tripped over by nick@'s failing disk, missing unlock in error branch
discovered by jmcneill@.
2015-04-15 14:39:24 +00:00
riastradh
adada8d6d4 Strip IO_JOURNALLOCKED, PGO_JOURNALLOCKED out of ulfs_readwrite.c.
These are vestigial from ufs_readwrite.c with wapbl -- lfs does not
have a journal but only the explicit wapbl calls, not these flags,
got ripped out in the transition to ulfs_readwrite.c.
2015-04-12 22:51:23 +00:00
riastradh
edcd087bc1 Same putpages->kassert in ulfs_readwrite.c 2015-04-12 22:49:55 +00:00
riastradh
0e4f519ef4 Omit now-unused variable. rump build didn't catch this... 2015-04-12 22:48:38 +00:00
riastradh
3124f8f989 Don't putpages in ufs buffercached writes: kassert there are none. 2015-04-12 22:41:28 +00:00
maxv
795334fc6b ffs_superblock_validate(): ensure fs_ncg!=0 and fs_maxbpg!=0 to prevent
several divisions by zero.
2015-04-04 06:00:12 +00:00
riastradh
7153b8dc81 Don't use dvp after vput(dvp).
Still don't understand why the fstrans_done must happen after the
vput, and that will cause trouble once we move responsibility for the
vrele and unlock outside the vop as it seems obvious we ought to do
-- it's the caller's reference, not the vop's.
2015-04-01 20:03:11 +00:00
riastradh
24895d95c1 Amplify that even if we fixed it now the tentacles are still stuck. 2015-03-31 11:43:05 +00:00
riastradh
e9f7453834 Write an essay explaining why ffs_write is one huge WAPBL transaction. 2015-03-31 00:22:50 +00:00
riastradh
cec9a597e4 WAPBL tx is always locked by ufs_bufrd caller, so never unlock it. 2015-03-29 14:39:41 +00:00
maxv
6e39240181 Remove the 'cred' argument from bread(). Remove a now unused var in
ffs_snapshot.c. Update the man page accordingly.

ok hannken@
2015-03-28 19:24:04 +00:00
riastradh
a9b674d150 Let I/O errors override inode update errors in UFS.
Fixes tests/fs/vfs/t_io:read_fault for UFS.
2015-03-28 17:45:47 +00:00
maxv
bb338d5f26 Remove the 'cred' argument from breadn(), and update the man page
accordingly.

ok hannken@
2015-03-28 17:23:42 +00:00
riastradh
ec4019718c Make some comments match better in ulfs_readwrite. 2015-03-28 17:08:53 +00:00
riastradh
dd74d7b4d4 Factor out post-read/write inode updates in UFS. 2015-03-28 17:06:15 +00:00
riastradh
2cd2eda401 VOP_WRITE never has IO_JOURNALLOCKED. 2015-03-28 04:13:25 +00:00
riastradh
bc2fbd02f8 Turn some `#if DIAGNOSTIC' into KASSERT. 2015-03-28 03:53:36 +00:00
riastradh
3b1b197e15 Missed another spot, in ext2fs_write. 2015-03-28 03:49:41 +00:00
riastradh
7acf502e35 Missed a spot in ext2fs_read 2015-03-28 03:46:51 +00:00
riastradh
8e1eba1ebe Tighten some kasserts in ufs_bufio code paths. 2015-03-27 19:47:14 +00:00
riastradh
5a2d83e099 Disentangle buffer-cached I/O from page-cached I/O in UFS.
Page-cached I/O is used for regular files, and is initiated by VFS
users such as userland and NFS.

Buffer-cached I/O is used for directories and symlinks, and is issued
only internally by UFS.

New UFS routine ufs_bufio replaces vn_rdwr for internal use.
ufs_bufio is implemented by new UFS operations uo_bufrd/uo_bufwr,
which sit in ufs_readwrite.c alongside the VOP_READ/VOP_WRITE
implementations.

I preserved the code as much as possible and will leave further
simplification for future commits.  I kept the ulfs_readwrite.c
copypasta close to ufs_readwrite.c in case we ever want to merge them
back; likewise ext2fs_readwrite.c.

No externally visible semantic change.  All atf fs tests still pass.
2015-03-27 17:27:55 +00:00
hannken
54fa474e3e Change ffs to use vcache_new:
- Change ffs_valloc to return an inode number.
- Remove now obsolete UFS operations UFS_VALLOC and UFS_VFREE.
- Make ufs_makeinode private to ufs_vnops.c and pass vattr instead of mode.
2015-03-17 09:39:29 +00:00
maxv
9eec611462 ffs_reload(): fix a bug that prevents Big Endian FSes from being reloaded.
'newfs' should be tagged as FS_SWAPPED, not 'fs'.

Was here before my changes.

While here, also KNF a bit.
2015-03-15 09:21:01 +00:00
maxv
a578b5382f ffs_superblock_validate(): ensure fs_ipg and fs_fpg are != 0. Otherwise
division by zero in several places.
2015-03-14 19:52:54 +00:00
maxv
18abcb4757 ffs_superblock_validate(): check the number of inodes per block. Otherwise
a malformed value could panic the system.
2015-03-10 12:59:32 +00:00
maxv
c84267386a ffs_reload(): release 'bp' earlier 2015-03-03 17:56:51 +00:00
maxv
e6e56ce208 ffs_reload(): the current implementation blindly guesses critical fields
of the superblock didn't change. Add checks to ensure they didn't change
for real. This prevents several memory corruptions.
2015-03-03 17:46:39 +00:00
maxv
5c7e714fca Hum. Perhaps I missed a bit of the specification. Let's not be that
severe when checking the superblock.

Should fix ATF.
2015-02-23 17:05:58 +00:00
maxv
5f9c472c31 Small changes:
- instead of always calling DPRINTF with __func__, put __func__ directly
   in the macro
 - ffs_mountfs(): rename fsblockloc -> fs_sblockloc, initialize fs_sbsize
   to zero
No real functional change
2015-02-23 13:38:54 +00:00
maxv
3e35936473 Merge _sbcompute() and _sbcheck() into _sbfill().
In ext2fs_sbfill(), check more fields of the superblock, to prevent
several kernel panics when mounting/unmounting a disk.
2015-02-22 14:55:23 +00:00
maxv
81c691b934 ffs_superblock_validate(): sanitize fs_fragshift, fs_bmask and fs_fmask. 2015-02-22 14:22:34 +00:00
maxv
8cadf998b5 KNF, and simplify a bit.
No functional change
2015-02-22 14:12:48 +00:00