freebsd-dev/sbin
Kirk McKusick 7a1c1f6a03 Avoid unaligned writes by fsck_ffs(8).
Normally fsck_ffs never does reads or writes that are not aligned
to the size of one of the checked filesystems fragments. The one
exception is when it finds that it needs to write the superblock
recovery information. Here it will write with the alignment reported
by the underlying disk as its sector size as reported by an
ioctl(diskfd, DIOCGSECTORSIZE, &secsize).

Modern disks have a sector size of 4096, but for backward compatibility
with older disks will report that they have a sector size of 512.
When presented with a 512 byte write, they have to read the associated
4096 byte sector, replace the 512 bytes to be written, and write
the updated 4096 byte sector back to the disk. Unfortunately, some
disks report that they have 512 sectors, but fail writes that are not
aligned to 4096 boundaries and are a multiple of 4096 bytes in size.

This commit updates fsck_ffs(8) so that it uses the filesystem fragment
size as the smallest size and alignment for doing writes rather than
the disk's reported sector size.

Reported by:  Andriy Gapon
MFC after:    1 week
2022-02-20 13:21:12 -08:00
..
adjkerntz
bectl bectl(8): don't allow creation of boot environments with spaces 2021-06-03 08:36:11 -08:00
bsdlabel
camcontrol update external URL 2022-02-05 17:09:48 +00:00
ccdconfig
clri
comcontrol
conscontrol
ddb
decryptcore decryptcore: do not include sys/sysctl.h 2021-03-07 17:29:03 -06:00
devd devd: correct wifi regexp 2022-01-09 10:16:31 -07:00
devfs devfs.rules: Correctly unhide pf in vnet jails 2021-11-03 12:50:13 +01:00
devmatch devmatch: Allow devmatch_blocklist to be set in kenv too 2021-11-21 08:54:45 -07:00
dhclient dhclient: support VID 0 (no vlan) decapsulation 2022-02-14 10:06:47 -05:00
dmesg dmesg: detect wrapped msgbuf on the kernel side and if so, skip first line 2022-02-05 13:35:31 -08:00
dump ufs: Rework shortlink handling to avoid subobject overflows 2022-01-02 20:55:36 +00:00
dumpfs dumpfs(8): add option to only print superblock information 2021-07-02 14:18:17 -08:00
dumpon dumpon: fix build on some architectures 2021-08-11 21:27:24 -05:00
etherswitchcfg etherswitch: Add a new striptagingress port flag 2021-08-03 12:07:48 +02:00
fdisk
ffsinfo ffsinfo: Update example to avoid to-be-deprecated vinum 2021-04-03 16:29:14 -04:00
fsck fsck(8): Fix typo 2022-01-12 13:52:23 +08:00
fsck_ffs Avoid unaligned writes by fsck_ffs(8). 2022-02-20 13:21:12 -08:00
fsck_msdosfs fsck_msdosfs: truncate directory entry when the head pointer is invalid. 2021-11-03 22:09:32 -07:00
fsdb ufs: Rework shortlink handling to avoid subobject overflows 2022-01-02 20:55:36 +00:00
fsirand Filesystem utilities that modify the filesystem (growfs(8), tunefs(8), 2020-10-25 01:36:33 +00:00
gbde
geom Fix regression to verbose behavior introduced in 68bff4a07e. 2021-11-11 12:11:25 -08:00
ggate ggatec: Use ANSI C definition for init_initial_buffer_size. 2022-01-31 17:12:04 -08:00
growfs growfs: do not error if filesystem is already requested size 2021-11-15 15:40:57 -05:00
gvinum gvinum: add deprecation notice 2021-03-28 14:45:05 -04:00
hastctl
hastd hastd(8) assumes it has no extra file descriptors opened 2020-11-29 13:45:53 +00:00
ifconfig ifconfig: remove debug printf introduced in 779fd05344 2022-01-29 11:19:01 +00:00
init init: execute /etc/rc.final after all user processes have terminated 2021-07-22 23:26:11 -05:00
ipf ipfilter: Restore ipfsync 2022-01-07 21:46:53 -08:00
ipfw dnctl: Support reading config from file like ipfw(8) 2022-01-03 09:50:18 +01:00
kldconfig kldconfig(8): Add EXAMPLES to the man page 2020-09-29 17:52:15 +00:00
kldload kldload(8): Improve phrasing 2021-02-11 06:03:53 +01:00
kldstat kldstat(8): style(9) fixes. 2021-12-07 11:40:22 +01:00
kldunload
ldconfig ldconfig: remove two symbols 2022-01-08 12:45:46 +02:00
md5 update external URLs 2022-02-05 08:19:56 +00:00
mdconfig md: Add MD_MUSTDEALLOC support 2021-09-11 20:04:52 +08:00
mdmfs mdmfs(8): Fix an issue reported by mandoc 2020-10-03 18:47:50 +00:00
mknod
mksnap_ffs Remove #define _KERNEL hacks from libprocstat 2021-02-21 11:38:21 +02:00
mount vfslist.c: initialize skipvfs variable 2022-01-05 23:00:36 +01:00
mount_cd9660
mount_fusefs sbin/mount_fusefs/mount_fusefs.8: Fix typos 2021-10-09 09:02:39 -06:00
mount_msdosfs Fix a few mandoc issues 2020-10-09 14:03:45 +00:00
mount_nfs mount_nfs: Add a "bgnow" NFS mount option 2022-01-11 08:21:35 -08:00
mount_nullfs mount_nullfs: rename a local variable 2021-02-12 11:30:52 -07:00
mount_udf
mount_unionfs
natd natd: Remove uneeded in_cksum.h includes 2021-11-24 13:31:16 -05:00
newfs Explain the newfs naming convention 2021-04-17 23:16:17 +02:00
newfs_msdos newfs_msdos: connect the ATF test from NetBSD 2022-02-16 09:56:16 -06:00
nfsiod pkgbase: Add nfsiod to the FreeBSD-nfs package 2021-08-06 14:37:35 +02:00
nos-tun
nvmecontrol nvmecontrol: Display Metadata and Sanitize capabilities of the device 2021-09-21 21:15:55 +00:00
pfctl libpfctl: fix creatorid endianness 2022-01-27 09:07:27 +01:00
pfilctl pfilctl: improve formatting of "hooks" and "heads" command output. 2021-03-19 11:18:05 -07:00
pflogd
ping update external URL 2022-02-05 17:11:18 +00:00
ping6 Merge ping6 to ping 2020-11-26 04:29:30 +00:00
quotacheck
rcorder [rcorder] [crunch] Fix C function declarations to include void 2020-09-21 17:59:45 +00:00
reboot nextboot: Improve the shell code used to figure out the zpool name 2021-06-05 14:32:18 +00:00
recoverdisk Register the bad read before bailing on terminal errors. 2021-02-02 12:01:38 +00:00
resolvconf
restore
route route: remove write-only struct hostent from getaddr() 2022-01-06 10:45:44 -05:00
routed sbin/routed: Remove unused code for sgi and NetBSD. 2020-12-25 17:42:47 -08:00
rtsol
savecore savecore: emit information about saved cores under verbose 2021-12-07 18:39:34 -06:00
sconfig pkgbase: Put sconfig in FreeBSD-utilities 2021-12-21 10:16:08 +01:00
setkey update external URL 2022-02-05 17:14:27 +00:00
shutdown shutdown.8: Fix typo 2020-07-05 13:08:17 +00:00
swapon swapon(8): adapt to the new swapoff(2) interface 2021-12-09 02:48:59 +02:00
sysctl sysctl: Small style fix 2021-12-05 21:40:47 -07:00
tests
tunefs Remove #define _KERNEL hacks from libprocstat 2021-02-21 11:38:21 +02:00
umount Document that umount -A does not unmount /dev 2020-06-18 23:12:55 +00:00
veriexec veriexec(8): explain that only a unique prefix is required 2022-02-14 13:54:22 -08:00
zfsbootcfg loader: zfs should support bootonce an nextboot 2020-09-21 09:01:10 +00:00
Makefile sbin: build ping if at least one of INET & INET6 is enabled 2021-11-28 13:05:39 -05:00
Makefile.amd64 Revert "amd64: Do not build sconfig" 2021-12-21 10:14:45 +01:00
Makefile.arm
Makefile.i386
Makefile.inc build: provide a default WARNS for all in-tree builds 2020-09-18 17:17:46 +00:00
Makefile.mips
Makefile.powerpc64