freebsd-dev/sys
Kirk McKusick 3193b25a5a This is an additional fix for bug report 230962. When using
extended attributes, the kernel can panic with either "ffs_truncate3"
or with "softdep_deallocate_dependencies: dangling deps".

The problem arises because the flushbuflist() function which is
called to clear out buffers is passed either the V_NORMAL flag to
indicate that it should flush buffer associated with the contents
of the file or the V_ALT flag to indicate that it should flush the
buffers associated with the extended attribute data. The buffers
containing the extended attribute data are identified by having
their BX_ALTDATA flag set in the buffer's b_xflags field. The
BX_ALTDATA flag is set on the buffer when the extended attribute
block is first allocated or when its contents are read in from the
disk.

On a busy system, a buffer may be reused for another purpose, but
the contents of the block that it contained continues to be held
in the main page cache. Each physical page is identified as holding
the contents of a logical block within a specified file (identified
by a vnode). When a request is made to read a file, the kernel first
looks for the block in the existing buffers.  If it is not found
there, it checks the page cache to see if it is still there. If
it is found in the page cache, then it is remapped into a new
buffer thus avoiding the need to read it in from the disk.

The bug is that when a buffer request made for an extended attribute
is fulfilled by reconstituting a buffer from the page cache rather
than reading it in from disk, the BX_ALTDATA flag was not being
set. Thus the flushbuflist() function would never clear it out and
the "ffs_truncate3" panic would occur because the vnode being cleared
still had buffers on its clean-buffer list. If the extended attribute
was being updated, it is first read, then updated, and finally
written. If the read is fulfilled by reconstituting the buffer
from the page cache the BX_ALTDATA flag was not set and thus the
dirty buffer would never be flushed by flushbuflist(). Eventually
the buffer would be recycled. Since it was never written it would
have an unfinished dependency which would trigger the
"softdep_deallocate_dependencies: dangling deps" panic.

The fix is to ensure that the BX_ALTDATA flag is set when a buffer
has been reconstituted from the page cache.

PR:           230962
Reported by:  2t8mr7kx9f@protonmail.com
Reviewed by:  kib
Tested by:    Peter Holm
MFC after:    1 week
Sponsored by: Netflix
2019-03-12 19:08:41 +00:00
..
amd64 Kill tz_minuteswest and tz_dsttime. 2019-03-12 04:49:47 +00:00
arm Mark the imx_spi device busy while transfers are in progress, so that the 2019-03-11 03:07:05 +00:00
arm64 Remove sv_pagesize, originally introduced with r100384. 2019-03-01 16:16:38 +00:00
bsm Create new EINTEGRITY error with message "Integrity check failed". 2019-01-17 06:35:45 +00:00
cam Upgrade Chipfancier SLC quirk to all versions 2019-03-11 20:57:54 +00:00
cddl Add _PC_ACL_* to vop_stdpathconf 2019-03-11 20:40:56 +00:00
compat Kill tz_minuteswest and tz_dsttime. 2019-03-12 04:49:47 +00:00
conf arm64: allwinner: Add CCU DE2 2019-03-07 19:30:37 +00:00
contrib [ath_hal_ar9300] Add the missing bits from the previous HAL commit. 2019-03-06 08:52:02 +00:00
crypto Embedded chacha: Add 0-bit iv + 128-bit counter mode 2019-03-01 23:30:23 +00:00
ddb ddb: Print the thread's pcb in 'show thread' 2019-02-09 21:08:19 +00:00
dev Remove useless version check. 2019-03-12 18:57:11 +00:00
dts Adapt FreeBSD specific DT stub for Jetson TK1 board to be consistent with 2019-02-06 06:03:44 +00:00
fs Drop unused 'p' argument to nfsv4_strtogid(). 2019-03-12 15:07:47 +00:00
gdb
geom Revert revision 254095 2019-03-05 04:15:34 +00:00
gnu Correct my previous correction to the license. It now matches the text 2019-03-07 22:34:45 +00:00
i386 Fix typo. 2019-03-07 10:01:32 +00:00
isa
kern This is an additional fix for bug report 230962. When using 2019-03-12 19:08:41 +00:00
kgssapi * Handle SIGPIPE in gssd 2019-02-21 01:30:37 +00:00
libkern Add non-sleepable strdup variant strdup_flags 2019-02-20 20:48:10 +00:00
mips Remove sv_pagesize, originally introduced with r100384. 2019-03-01 16:16:38 +00:00
modules Add another required header file. 2019-03-01 04:17:43 +00:00
net Most Ethernet drivers that potentially can run a pfil(9) hook with 2019-03-10 17:20:09 +00:00
net80211 net80211(4): hide casts for 'i_seq' field offset calculation inside 2019-02-10 23:58:56 +00:00
netgraph Remove remnants of byte order manipulation, back when FreeBSD stack 2019-02-09 03:00:00 +00:00
netinet Improve ARP logging. 2019-03-09 01:12:59 +00:00
netinet6 Update for IETF draft-ietf-6man-ipv6only-flag. 2019-03-07 23:03:39 +00:00
netipsec Remove unused argument to priv_check_cred. 2018-12-11 19:32:16 +00:00
netpfil Add IP_FW_NAT64 to codes that ipfw_chk() can return. 2019-03-11 10:42:09 +00:00
netsmb Remove unused argument to priv_check_cred. 2018-12-11 19:32:16 +00:00
nfs
nfsclient
nfsserver
nlm
ofed Mechanical cleanup of epoch(9) usage in network stack. 2019-01-09 01:11:19 +00:00
opencrypto Fix another bug introduced during the review process of r344140: 2019-02-25 19:14:16 +00:00
powerpc powerpc: Print trap frame address in ddb backtraces 2019-03-09 03:24:39 +00:00
riscv Reorder copyright lines to preserve the source of "All rights reserved." 2019-03-06 16:50:14 +00:00
rpc Bump the default kern.rpc.gss.client_max from 128 to 1024. 2019-02-19 11:07:02 +00:00
security Create new EINTEGRITY error with message "Integrity check failed". 2019-01-17 06:35:45 +00:00
sparc64 Remove sv_pagesize, originally introduced with r100384. 2019-03-01 16:16:38 +00:00
sys Kill tz_minuteswest and tz_dsttime. 2019-03-12 04:49:47 +00:00
teken Attempt to complete fixing programmable function keys for syscons. 2019-02-20 02:14:41 +00:00
tests Regularize the Netflix copyright 2019-02-04 21:28:25 +00:00
tools make_dtb.sh: Use $CPP instead of assuming that cpp is in $PATH 2018-12-14 23:53:28 +00:00
ufs Add KASSERT to the softdep_disk_write_complete() function in the 2019-03-12 00:10:31 +00:00
vm Implement minidump support for RISC-V. 2019-03-06 00:01:06 +00:00
x86 Add register number, CPUID bits, and print identification for TSX 2019-03-12 18:59:01 +00:00
xdr
xen xen: introduce a new way to setup event channel upcall 2019-01-30 11:34:52 +00:00
Makefile