mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-06 03:45:24 -04:00
* refs/heads/tmp-ce5de62:
Revert "BACKPORT: tracing: Remove unnecessary DEBUG_FS dependency"
Linux 5.4.24
blktrace: Protect q->blk_trace with RCU
kvm: nVMX: VMWRITE checks unsupported field before read-only field
kvm: nVMX: VMWRITE checks VMCS-link pointer before VMCS field
mm, thp: fix defrag setting if newline is not used
mm/huge_memory.c: use head to check huge zero page
mm/gup: allow FOLL_FORCE for get_user_pages_fast()
mm/debug.c: always print flags in dump_page()
locking/lockdep: Fix lockdep_stats indentation problem
xfs: clear kernel only flags in XFS_IOC_ATTRMULTI_BY_HANDLE
bus: tegra-aconnect: Remove PM_CLK dependency
netfilter: nf_flowtable: fix documentation
netfilter: nft_tunnel: no need to call htons() when dumping ports
thermal: brcmstb_thermal: Do not use DT coefficients
thermal: db8500: Depromote debug print
ubifs: Fix ino_t format warnings in orphan_delete()
rcu: Allow only one expedited GP to run concurrently with wakeups
KVM: x86: Remove spurious clearing of async #PF MSR
KVM: x86: Remove spurious kvm_mmu_unload() from vcpu destruction path
x86/resctrl: Check monitoring static key in the MBM overflow handler
perf ui gtk: Add missing zalloc object
perf hists browser: Restore ESC as "Zoom out" of DSO/thread/etc
pwm: omap-dmtimer: put_device() after of_find_device_by_node()
lib/vdso: Update coarse timekeeper unconditionally
lib/vdso: Make __arch_update_vdso_data() logic understandable
kprobes: Set unoptimized flag after unoptimizing code
ima: ima/lsm policy rule loading logic bug fixes
drivers: net: xgene: Fix the order of the arguments of 'alloc_etherdev_mqs()'
RDMA/hns: Bugfix for posting a wqe with sge
RDMA/hns: Simplify the calculation and usage of wqe idx for post verbs
f2fs: fix to add swap extent correctly
sched/fair: Optimize select_idle_cpu
KVM: Check for a bad hva before dropping into the ghc slow path
KVM: SVM: Override default MMIO mask if memory encryption is enabled
mwifiex: delete unused mwifiex_get_intf_num()
mwifiex: drop most magic numbers from mwifiex_process_tdls_action_frame()
namei: only return -ECHILD from follow_dotdot_rcu()
kbuild: make single target builds even faster
kbuild: remove unneeded variable, single-all
kbuild: move headers_check rule to usr/include/Makefile
kbuild: remove header compile test
selftests: Install settings files to fix TIMEOUT failures
net: ena: make ena rxfh support ETH_RSS_HASH_NO_CHANGE
net/smc: no peer ID in CLC decline for SMCD
net: atlantic: fix out of range usage of active_vlans array
net: atlantic: fix potential error handling
net: atlantic: fix use after free kasan warn
net: netlink: cap max groups which will be considered in netlink_bind()
s390/qeth: vnicc Fix EOPNOTSUPP precedence
nvme-pci: Hold cq_poll_lock while completing CQEs
usb: charger: assign specific number for enum value
hv_netvsc: Fix unwanted wakeup in netvsc_attach()
kbuild: fix DT binding schema rule to detect command line changes
mac80211: Remove a redundant mutex unlock
nl80211: fix potential leak in AP start
drm/i915/gvt: Separate display reset from ALL_ENGINES reset
drm/i915/gvt: Fix orphan vgpu dmabuf_objs' lifetime
i2c: jz4780: silence log flood on txabrt
i2c: altera: Fix potential integer overflow
MIPS: VPE: Fix a double free and a memory leak in 'release_vpe()'
HID: hiddev: Fix race in in hiddev_disconnect()
HID: alps: Fix an error handling path in 'alps_input_configured()'
netfilter: xt_hashlimit: reduce hashlimit_mutex scope for htable_put()
netfilter: ipset: Fix forceadd evaluation path
vhost: Check docket sk_family instead of call getname
net/smc: transfer fasync_list in case of fallback
netfilter: ipset: Fix "INFO: rcu detected stall in hash_xxx" reports
io_uring: fix 32-bit compatability with sendmsg/recvmsg
cpufreq: Fix policy initialization for internal governor drivers
amdgpu/gmc_v9: save/restore sdpif regs during S3
Revert "PM / devfreq: Modify the device name as devfreq(X) for sysfs"
tracing: Disable trace_printk() on post poned tests
macintosh: therm_windtunnel: fix regression when instantiating devices
drm/radeon: Inline drm_get_pci_dev
drm/amdgpu: Drop DRIVER_USE_AGP
HID: core: increase HID report buffer size to 8KiB
HID: core: fix off-by-one memset in hid_report_raw_event()
HID: ite: Only bind to keyboard USB interface on Acer SW5-012 keyboard dock
KVM: VMX: check descriptor table exits on instruction emulation
ACPI: watchdog: Fix gas->access_width usage
ACPICA: Introduce ACPI_ACCESS_BYTE_WIDTH() macro
audit: always check the netlink payload length in audit_receive_msg()
audit: fix error handling in audit_data_to_entry()
ext4: potential crash on allocation error in ext4_alloc_flex_bg_array()
nvme/pci: move cqe check after device shutdown
nvme: prevent warning triggered by nvme_stop_keep_alive
nvme/tcp: fix bug on double requeue when send fails
net: hns3: fix a copying IPv6 address error in hclge_fd_get_flow_tuples()
net: hns3: add management table after IMP reset
mac80211: fix wrong 160/80+80 MHz setting
cfg80211: add missing policy for NL80211_ATTR_STATUS_CODE
cifs: Fix mode output in debugging statements
ice: update Unit Load Status bitmask to check after reset
net: ena: ena-com.c: prevent NULL pointer dereference
net: ena: ethtool: use correct value for crc32 hash
net: ena: fix corruption of dev_idx_to_host_tbl
net: ena: fix incorrectly saving queue numbers when setting RSS indirection table
net: ena: rss: store hash function as values and not bits
net: ena: rss: fix failure to get indirection table
net: ena: rss: do not allocate key when not supported
net: ena: fix incorrect default RSS key
net: ena: add missing ethtool TX timestamping indication
net: ena: fix uses of round_jiffies()
net: ena: fix potential crash when rxfh key is NULL
i40e: Fix the conditional for i40e_vc_validate_vqs_bitmaps
soc/tegra: fuse: Fix build with Tegra194 configuration
amdgpu: Prevent build errors regarding soft/hard-float FP ABI tags
drm/amd/display: Add initialitions for PLL2 clock source
drm/amd/display: Limit minimum DPPCLK to 100MHz.
drm/amd/display: Check engine is not NULL before acquiring
RDMA/siw: Remove unwanted WARN_ON in siw_cm_llp_data_ready()
drm/amd/display: Do not set optimized_require to false after plane disable
ARM: dts: sti: fixup sound frame-inversion for stihxxx-b2120.dtsi
ceph: do not execute direct write in parallel if O_APPEND is specified
perf/x86/msr: Add Tremont support
perf/x86/cstate: Add Tremont support
perf/x86/intel: Add Elkhart Lake support
perf/smmuv3: Use platform_get_irq_optional() for wired interrupt
NFSv4: Fix races between open and dentry revalidation
qmi_wwan: unconditionally reject 2 ep interfaces
qmi_wwan: re-add DW5821e pre-production variant
s390/zcrypt: fix card and queue total counter wrap
cfg80211: check wiphy driver existence for drvinfo report
mac80211: consider more elements in parsing CRC
dax: pass NOWAIT flag to iomap_apply
sched/fair: Prevent unlimited runtime on throttled group
timers/nohz: Update NOHZ load in remote tick
sched/core: Don't skip remote tick for idle CPUs
drm/msm: Set dma maximum segment size for mdss
ipmi:ssif: Handle a possible NULL pointer reference
ipv6: Fix nlmsg_flags when splitting a multipath route
ipv6: Fix route replacement with dev-only route
bonding: fix lockdep warning in bond_get_stats()
net: export netdev_next_lower_dev_rcu()
bonding: add missing netdev_update_lockdep_key()
bnxt_en: Issue PCIe FLR in kdump kernel to cleanup pending DMAs.
bnxt_en: Improve device shutdown method.
sctp: move the format error check out of __sctp_sf_do_9_1_abort
udp: rehash on disconnect
Revert "net: dev: introduce support for sch BYPASS for lockless qdisc"
qede: Fix race between rdma destroy workqueue and link change event
nfc: pn544: Fix occasional HW initialization failure
net/tls: Fix to avoid gettig invalid tls record
net: sched: correct flower port blocking
net: phy: restore mdio regs in the iproc mdio driver
net: mscc: fix in frame extraction
net: macb: ensure interface is not suspended on at91rm9200
net: fib_rules: Correctly set table field when table number exceeds 8 bits
net: dsa: b53: Ensure the default VID is untagged
EDAC: skx_common: downgrade message importance on missing PCI device
io_uring: grab ->fs as part of async offload
ANDROID: abi_gki_aarch64_whitelist: add module_layout and task_struct
ANDROID: gki_defconfig: disable KPROBES, update ABI
FROMGIT: scsi: ufs: Select INITIAL ADAPT type for HS Gear4
FROMLIST: scsi: ufs: Use ufshcd_config_pwr_mode() when scale gear
FROMGIT: scsi: ufs-qcom: Apply QUIRK_HOST_TACTIVATE for WDC UFS devices
FROMGIT: scsi: ufs: Allow vendor device quirks to be applied early
BACKPORT: scsi: ufs: Delete struct ufs_dev_desc
ANDROID: gki_defconfig: enable IOMMU_LIMIT_IOVA_ALIGNMENT
FROMLIST: iommu/iova: Support limiting IOVA alignment
FROMLIST: iommu/iova: Add a best-fit algorithm
FROMLIST: iommu/dma: Allow drivers to reserve an iova range
ANDROID: Unconditionally create bridge tracepoints
ANDROID: gki_defconfig: Enable MFD_SYSCON on x86
ANDROID: update ABI for CONFIG_IIO_* changes
ANDROID: gki_defconfig: add CONFIG_IIO_BUFFER and CONFIG_IIO_TRIGGER
ANDROID: gki: set CONFIG_SERIAL_SPRD_CONSOLE for earlycon
ANDROID: Re-add default y for VIRTIO_PCI_LEGACY
ANDROID: GKI: build in HVC_DRIVER
ANDROID: Removed default m for virtual sw crypto device
ANDROID: Remove default y on BRIDGE_IGMP_SNOOPING
ANDROID: GKI: Added missing SND configs
ANDROID: scsi: ufs: allow ufs variants to override sg entry size
ANDROID: GKI: Remove CONFIG_BRIDGE from arm64 config
ANDROID: Enable HID_NINTENDO as y
FROMLIST: HID: nintendo: add nintendo switch controller driver
UPSTREAM: iommu/arm-smmu: Restore naming of driver parameter prefix
ANDROID: gki_defconfig: Remove 'BRIDGE_NETFILTER is not set'
UPSTREAM: net: disable BRIDGE_NETFILTER by default
Linux 5.4.23
ASoC: SOF: Intel: hda: Add iDisp4 DAI
bpf: Selftests build error in sockmap_basic.c
s390/mm: Explicitly compare PAGE_DEFAULT_KEY against zero in storage_key_init_range
s390/kaslr: Fix casts in get_random
net/mlx5e: Fix crash in recovery flow without devlink reporter
net/mlx5: Fix sleep while atomic in mlx5_eswitch_get_vepa
net/mlx5e: Reset RQ doorbell counter before moving RQ state from RST to RDY
xen: Enable interrupts when calling _cond_resched()
ata: ahci: Add shutdown to freeze hardware resources of ahci
io_uring: prevent sq_thread from spinning when it should stop
rxrpc: Fix call RCU cleanup using non-bh-safe locks
netfilter: xt_hashlimit: limit the max size of hashtable
ALSA: seq: Fix concurrent access to queue current tick/time
ALSA: seq: Avoid concurrent access to queue flags
ALSA: rawmidi: Avoid bit fields for state flags
io_uring: fix __io_iopoll_check deadlock in io_sq_thread
arm64: lse: Fix LSE atomics with LLVM
bpf, offload: Replace bitwise AND by logical AND in bpf_prog_offload_info_fill
genirq/proc: Reject invalid affinity masks (again)
crypto: rename sm3-256 to sm3 in hash_algo_name
iommu/vt-d: Fix compile warning from intel-svm.h
ecryptfs: replace BUG_ON with error handling code
ASoC: fsl_sai: Fix exiting path on probing failure
ASoC: atmel: fix atmel_ssc_set_audio link failure
staging: greybus: use after free in gb_audio_manager_remove_all()
staging: rtl8723bs: fix copy of overlapping memory
usb: dwc2: Fix in ISOC request length checking
usb: gadget: composite: Fix bMaxPower for SuperSpeedPlus
scsi: Revert "target: iscsi: Wait for all commands to finish before freeing a session"
scsi: Revert "RDMA/isert: Fix a recently introduced regression related to logout"
drm/msm/dpu: fix BGR565 vs RGB565 confusion
drm/i915/gt: Protect defer_request() from new waiters
drm/bridge: tc358767: fix poll timeouts
drm/i915/gvt: more locking for ppgtt mm LRU list
drm/i915/execlists: Always force a context reload when rewinding RING_TAIL
drm/i915/gt: Detect if we miss WaIdleLiteRestore
Revert "dmaengine: imx-sdma: Fix memory leak"
Btrfs: fix deadlock during fast fsync when logging prealloc extents beyond eof
btrfs: don't set path->leave_spinning for truncate
Btrfs: fix race between shrinking truncate and fiemap
Btrfs: fix btrfs_wait_ordered_range() so that it waits for all ordered extents
btrfs: do not check delayed items are empty for single transaction cleanup
btrfs: reset fs_root to NULL on error in open_ctree
btrfs: fix bytes_may_use underflow in prealloc error condtition
btrfs: destroy qgroup extent records on transaction abort
KVM: apic: avoid calculating pending eoi from an uninitialized val
KVM: nVMX: handle nested posted interrupts when apicv is disabled for L1
KVM: nVMX: clear PIN_BASED_POSTED_INTR from nested pinbased_ctls only when apicv is globally disabled
KVM: nVMX: Check IO instruction VM-exit conditions
KVM: nVMX: Refactor IO bitmap checks into helper function
ext4: fix race between writepages and enabling EXT4_EXTENTS_FL
ext4: rename s_journal_flag_rwsem to s_writepages_rwsem
ext4: fix mount failure with quota configured as module
ext4: fix potential race between s_flex_groups online resizing and access
ext4: fix potential race between s_group_info online resizing and access
ext4: fix potential race between online resizing and write operations
ext4: add cond_resched() to __ext4_find_entry()
ext4: fix a data race in EXT4_I(inode)->i_disksize
KVM: x86: don't notify userspace IOAPIC on edge-triggered interrupt EOI
KVM: nVMX: Don't emulate instructions in guest mode
sched/psi: Fix OOB write when writing 0 bytes to PSI files
drm/i915: Update drm/i915 bug filing URL
drm/i915: Wean off drm_pci_alloc/drm_pci_free
drm/nouveau/kms/gv100-: Re-set LUT after clearing for modesets
drm/amdgpu/gfx10: disable gfxoff when reading rlc clock
drm/amdgpu/gfx9: disable gfxoff when reading rlc clock
drm/amdgpu/soc15: fix xclk for raven
mm: Avoid creating virtual address aliases in brk()/mmap()/mremap()
lib/stackdepot.c: fix global out-of-bounds in stack_slabs
mm/sparsemem: pfn_to_page is not valid yet on SPARSEMEM
mm/vmscan.c: don't round up scan size for online memory cgroup
genirq/irqdomain: Make sure all irq domain flags are distinct
nvme-multipath: Fix memory leak with ana_log_buf
mm/memcontrol.c: lost css_put in memcg_expand_shrinker_maps()
Revert "ipc,sem: remove uneeded sem_undo_list lock usage in exit_sem()"
ACPI: PM: s2idle: Check fixed wakeup events in acpi_s2idle_wake()
MAINTAINERS: Update drm/i915 bug filing URL
serdev: ttyport: restore client ops on deregistration
tty: serial: qcom_geni_serial: Fix RX cancel command failure
tty: serial: imx: setup the correct sg entry for tx dma
tty/serial: atmel: manage shutdown in case of RS485 or ISO7816 mode
serial: 8250: Check UPF_IRQ_SHARED in advance
x86/cpu/amd: Enable the fixed Instructions Retired counter IRPERF
x86/mce/amd: Fix kobject lifetime
x86/mce/amd: Publish the bank pointer only after setup has succeeded
x86/ima: use correct identifier for SetupMode variable
jbd2: fix ocfs2 corrupt when clearing block group bits
arm64: memory: Add missing brackets to untagged_addr() macro
powerpc/hugetlb: Fix 8M hugepages on 8xx
powerpc/hugetlb: Fix 512k hugepages on 8xx with 16k page size
powerpc/entry: Fix an #if which should be an #ifdef in entry_32.S
powerpc/tm: Fix clearing MSR[TS] in current when reclaiming on signal delivery
powerpc/eeh: Fix deadlock handling dead PHB
powerpc/8xx: Fix clearing of bits 20-23 in ITLB miss
drm/panfrost: perfcnt: Reserve/use the AS attached to the perfcnt MMU context
staging: rtl8723bs: Fix potential overuse of kernel memory
staging: rtl8723bs: Fix potential security hole
staging: rtl8188eu: Fix potential overuse of kernel memory
staging: rtl8188eu: Fix potential security hole
scsi: Revert "target/core: Inline transport_lun_remove_cmd()"
usb: dwc3: debug: fix string position formatting mixup with ret and len
usb: dwc3: gadget: Check for IOC/LST bit in TRB->ctrl fields
usb: dwc2: Fix SET/CLEAR_FEATURE and GET_STATUS flows
USB: hub: Fix the broken detection of USB3 device in SMSC hub
USB: hub: Don't record a connect-change event during reset-resume
USB: Fix novation SourceControl XL after suspend
usb: uas: fix a plug & unplug racing
USB: quirks: blacklist duplicate ep on Sound Devices USBPre2
USB: core: add endpoint-blacklist quirk
usb: host: xhci: update event ring dequeue pointer on purpose
xhci: Fix memory leak when caching protocol extended capability PSI tables - take 2
xhci: apply XHCI_PME_STUCK_QUIRK to Intel Comet Lake platforms
xhci: fix runtime pm enabling for quirky Intel hosts
xhci: Force Maximum Packet size for Full-speed bulk devices to valid range.
staging: vt6656: fix sign of rx_dbm to bb_pre_ed_rssi.
staging: android: ashmem: Disallow ashmem memory from being remapped
vt: vt_ioctl: fix race in VT_RESIZEX
vt: selection, handle pending signals in paste_selection
vt: fix scrollback flushing on background consoles
floppy: check FDC index for errors before assigning it
e1000e: Use rtnl_lock to prevent race conditions between net and pci/pm
USB: misc: iowarrior: add support for the 100 device
USB: misc: iowarrior: add support for the 28 and 28L devices
USB: misc: iowarrior: add support for 2 OEMed devices
thunderbolt: Prevent crash if non-active NVMem file is read
btrfs: handle logged extent failure properly
ecryptfs: fix a memory leak bug in ecryptfs_init_messaging()
ecryptfs: fix a memory leak bug in parse_tag_1_packet()
tpm: Initialize crypto_id of allocated_banks to HASH_ALGO__LAST
ASoC: sun8i-codec: Fix setting DAI data format
ASoC: codec2codec: avoid invalid/double-free of pcm runtime
ALSA: hda/realtek - Apply quirk for yet another MSI laptop
ALSA: hda/realtek - Apply quirk for MSI GP63, too
ALSA: hda: Use scnprintf() for printing texts for sysfs/procfs
iommu/qcom: Fix bogus detach logic
UPSTREAM: sched/psi: Fix OOB write when writing 0 bytes to PSI files
ANDROID: build.config.gki.aarch64: enable symbol trimming
ANDROID: kbuild: avoid excessively long argument lists
ANDROID: gki_defconfig: Enable CONFIG_RD_LZ4
ANDROID: net: wireless: Add module_param(mac_prefix) to mac80211_hwsim
ANDROID: gki: Enable BINFMT_MISC as part of GKI
ANDROID: gki_defconfig: disable CONFIG_CRYPTO_MD4
FROMLIST: kbuild: generate autoksyms.h early
FROMLIST: kbuild: split adjust_autoksyms.sh in two parts
FROMLIST: kbuild: allow symbol whitelisting with TRIM_UNUSED_KSYMS
ANDROID: ABI/Whitelist: update for unisoc
ANDROID: Disable wq fp check in CFI builds
ANDROID: gki_defconfig: Disable CONFIG_RT_GROUP_SCHED
FROMGIT: of: property: Add device link support for power-domains and hwlocks
ANDROID: drm/msm/a6xx: Make a6xx_gmu_bo.iova a dma_addr_t
FROMLIST: of: of_reserved_mem: Increase limit on number of reserved regions
ANDROID: dm: Add wrapped key support in dm-default-key
ANDROID: dm: add support for passing through derive_raw_secret
ANDROID: block: Prevent crypto fallback for wrapped keys
FROMLIST: drm/msm/a6xx: Use the DMA API for GMU memory objects
FROMLIST: arm64: dts: sdm845: Set the virtual address range for GMU allocations
UPSTREAM: of: Make of_dma_get_range() work on bus nodes
UPSTREAM: of/address: Fix of_pci_range_parser_one translation of DMA addresses
UPSTREAM: of/address: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'
UPSTREAM: of: Factor out #{addr,size}-cells parsing
UPSTREAM: of: address: Follow DMA parent for "dma-coherent"
UPSTREAM: of/address: Introduce of_get_next_dma_parent() helper
UPSTREAM: of: Make of_dma_get_range() private
ANDROID: fix merge issue in 5.4.22
ANDROID: update ABI for 5.4.22
Linux 5.4.22
rtc: Kconfig: select REGMAP_I2C when necessary
bcache: properly initialize 'path' and 'err' in register_bcache()
drm/amdgpu/display: handle multiple numbers of fclks in dcn_calcs.c (v2)
s390/pci: Recover handle in clp_set_pci_fn()
mlxsw: spectrum_dpipe: Add missing error path
fuse: don't overflow LLONG_MAX with end offset
virtio_balloon: prevent pfn array overflow
cifs: log warning message (once) if out of disk space
i40e: Relax i40e_xsk_wakeup's return value when PF is busy
help_next should increase position index
NFS: Fix memory leaks
drm/amdgpu/smu10: fix smu10_get_clock_by_type_with_voltage
drm/amdgpu/smu10: fix smu10_get_clock_by_type_with_latency
brd: check and limit max_part par
microblaze: Prevent the overflow of the start
asm-generic/tlb: add missing CONFIG symbol
iwlwifi: mvm: Check the sta is not NULL in iwl_mvm_cfg_he_sta()
iwlwifi: mvm: Fix thermal zone registration
nvme-pci: remove nvmeq->tags
nvmet: Pass lockdep expression to RCU lists
irqchip/gic-v3-its: Reference to its_invall_cmd descriptor when building INVALL
bcache: fix incorrect data type usage in btree_flush_write()
bcache: explicity type cast in bset_bkey_last()
bcache: fix memory corruption in bch_cache_accounting_clear()
reiserfs: prevent NULL pointer dereference in reiserfs_insert_item()
lib/scatterlist.c: adjust indentation in __sg_alloc_table
ocfs2: fix a NULL pointer dereference when call ocfs2_update_inode_fsync_trans()
ocfs2: make local header paths relative to C files
btrfs: do not do delalloc reservation under page lock
powerpc: Do not consider weak unresolved symbol relocations as bad
radeon: insert 10ms sleep in dce5_crtc_load_lut
trigger_next should increase position index
ftrace: fpid_next() should increase position index
char: hpet: Fix out-of-bounds read bug
drm/nouveau/disp/nv50-: prevent oops when no channel method map provided
irqchip/gic-v3: Only provision redistributors that are enabled in ACPI
drm/amd/display: do not allocate display_mode_lib unnecessarily
rbd: work around -Wuninitialized warning
ceph: check availability of mds cluster on mount after wait timeout
powerpc/mm: Don't log user reads to 0xffffffff
bpf: map_seq_next should always increase position index
cifs: fix NULL dereference in match_prepath
cifs: Fix mount options set in automount
cifs: fix unitialized variable poential problem with network I/O cache lock patch
iwlegacy: ensure loop counter addr does not wrap and cause an infinite loop
rtw88: fix potential NULL skb access in TX ISR
hostap: Adjust indentation in prism2_hostapd_add_sta
ALSA: usb-audio: add quirks for Line6 Helix devices fw>=2.82
ARM: 8951/1: Fix Kexec compilation issue.
selftests/eeh: Bump EEH wait time to 60s
powerpc/pseries/lparcfg: Fix display of Maximum Memory
jbd2: make sure ESHUTDOWN to be recorded in the journal superblock
jbd2: switch to use jbd2_journal_abort() when failed to submit the commit record
selftests: bpf: Reset global state between reuseport test runs
alarmtimer: Make alarmtimer platform device child of RTC device
iommu/vt-d: Remove unnecessary WARN_ON_ONCE()
bcache: fix use-after-free in register_bcache()
bcache: rework error unwinding in register_bcache
bcache: cached_dev_free needs to put the sb page
btrfs: Fix split-brain handling when changing FSID to metadata uuid
btrfs: separate definition of assertion failure handlers
media: uvcvideo: Add a quirk to force GEO GC6500 Camera bits-per-pixel value
powerpc/sriov: Remove VF eeh_dev state when disabling SR-IOV
drm/nouveau/mmu: fix comptag memory leak
sunrpc: Fix potential leaks in sunrpc_cache_unhash()
ALSA: hda - Add docking station support for Lenovo Thinkpad T420s
bpf, btf: Always output invariant hit in pahole DWARF to BTF transform
driver core: platform: fix u32 greater or equal to zero comparison
s390/ftrace: generate traced function stack frame
s390: adjust -mpacked-stack support check for clang 10
x86/decoder: Add TEST opcode to Group3-2
objtool: Fix ARCH=x86_64 build error
kbuild: use -S instead of -E for precise cc-option test in Kconfig
spi: spi-fsl-qspi: Ensure width is respected in spi-mem operations
ALSA: hda/hdmi - add retry logic to parse_intel_hdmi()
irqchip/mbigen: Set driver .suppress_bind_attrs to avoid remove problems
regulator: core: Fix exported symbols to the exported GPL version
remoteproc: Initialize rproc_class before use
module: avoid setting info->name early in case we can fall back to info->mod->name
btrfs: device stats, log when stats are zeroed
btrfs: safely advance counter when looking up bio csums
btrfs: fix possible NULL-pointer dereference in integrity checks
pwm: Remove set but not set variable 'pwm'
ide: serverworks: potential overflow in svwks_set_pio_mode()
cmd64x: potential buffer overflow in cmd64x_program_timings()
pwm: omap-dmtimer: Remove PWM chip in .remove before making it unfunctional
x86/mm: Fix NX bit clearing issue in kernel_map_pages_in_pgd
f2fs: fix memleak of kobject
regulator: vctrl-regulator: Avoid deadlock getting and setting the voltage
ASoC: SOF: Intel: hda: Fix SKL dai count
debugobjects: Fix various data races
watchdog/softlockup: Enforce that timestamp is valid on boot
perf/x86/amd: Constrain Large Increment per Cycle events
sched/topology: Assert non-NUMA topology masks don't (partially) overlap
sched/core: Fix size of rq::uclamp initialization
arm64: dts: ti: k3-j721e-main: Add missing power-domains for smmu
KVM: PPC: Remove set but not used variable 'ra', 'rs', 'rt'
EDAC/sifive: Fix return value check in ecc_register()
drm/amd/display: fixup DML dependencies
arm64: fix alternatives with LLVM's integrated assembler
arm64: lse: fix LSE atomics with LLVM's integrated assembler
RDMA/mlx5: Don't fake udata for kernel path
ALSA: usb-audio: add implicit fb quirk for MOTU M Series
crypto: essiv - fix AEAD capitalization and preposition use in help text
scsi: iscsi: Don't destroy session if there are outstanding connections
scsi: ufs-mediatek: add apply_dev_quirks variant operation
scsi: ufs: pass device information to apply_dev_quirks
f2fs: free sysfs kobject
f2fs: set I_LINKABLE early to avoid wrong access by vfs
ALSA: usb-audio: unlock on error in probe
iommu/arm-smmu-v3: Use WRITE_ONCE() when changing validity of an STE
kbuild: remove *.tmp file when filechk fails
usb: musb: omap2430: Get rid of musb .set_vbus for omap2430 glue
perf/imx_ddr: Fix cpu hotplug state cleanup
drm/vmwgfx: prevent memory leak in vmw_cmdbuf_res_add
gpiolib: Set lockdep class for hierarchical irq domains
dm thin: don't allow changing data device during thin-pool reload
drm/nouveau/fault/gv100-: fix memory leak on module unload
drm/nouveau/drm/ttm: Remove set but not used variable 'mem'
drm/nouveau: Fix copy-paste error in nouveau_fence_wait_uevent_handler
drm/nouveau/gr/gk20a,gm200-: add terminators to method lists read from fw
drm/nouveau/secboot/gm20b: initialize pointer in gm20b_secboot_new()
vme: bridges: reduce stack usage
bpf: Return -EBADRQC for invalid map type in __bpf_tx_xdp_map
ASoC: SOF: Intel: hda-dai: fix compilation warning in pcm_prepare
driver core: Print device when resources present in really_probe()
driver core: platform: Prevent resouce overflow from causing infinite loops
visorbus: fix uninitialized variable access
misc: xilinx_sdfec: fix xsdfec_poll()'s return type
tty: synclink_gt: Adjust indentation in several functions
tty: synclinkmp: Adjust indentation in several functions
raid6/test: fix a compilation warning
ASoC: atmel: fix build error with CONFIG_SND_ATMEL_SOC_DMA=m
ALSA: usb-audio: Add boot quirk for MOTU M Series
ARM: dts: rockchip: add reg property to brcmf sub node for rk3188-bqedison2qc
arm64: dts: rockchip: add reg property to brcmf sub-nodes
arm64: dts: rockchip: fix dwmmc clock name for px30
clocksource: davinci: only enable clockevents once tim34 is initialized
wan: ixp4xx_hss: fix compile-testing on 64-bit
x86/nmi: Remove irq_work from the long duration NMI handler
bnxt: Detach page from page pool before sending up the stack
Input: edt-ft5x06 - work around first register access error
rcu: Use WRITE_ONCE() for assignments to ->pprev for hlist_nulls
efi/x86: Don't panic or BUG() on non-critical error conditions
soc/tegra: fuse: Correct straps' address for older Tegra124 device trees
IB/hfi1: Add RcvShortLengthErrCnt to hfi1stats
IB/hfi1: Add software counter for ctxt0 seq drop
staging: rtl8188: avoid excessive stack usage
drm/mediatek: Add gamma property according to hardware capability
udf: Fix free space reporting for metadata and virtual partitions
usbip: Fix unsafe unaligned pointer usage
ARM: dts: stm32: Add power-supply for DSI panel on stm32f469-disco
usb: dwc3: use proper initializers for property entries
drm: remove the newline for CRC source name.
RDMA/hns: Avoid printing address of mtt page
mlx5: work around high stack usage with gcc
drm/amdkfd: Fix permissions of hang_hws
iommu/vt-d: Avoid sending invalid page response
iommu/vt-d: Match CPU and IOMMU paging mode
ACPI: button: Add DMI quirk for Razer Blade Stealth 13 late 2019 lid switch
ASoC: Intel: sof_rt5682: Ignore the speaker amp when there isn't one.
vfio/spapr/nvlink2: Skip unpinning pages on error exit
tools lib api fs: Fix gcc9 stringop-truncation compilation error
net: phy: fixed_phy: fix use-after-free when checking link GPIO
ALSA: sh: Fix compile warning wrt const
ALSA: hda/realtek - Apply mic mute LED quirk for Dell E7xx laptops, too
clk: uniphier: Add SCSSI clock gate for each channel
clk: Use parent node pointer during registration if necessary
ALSA: sh: Fix unused variable warnings
clk: sunxi-ng: add mux and pll notifiers for A64 CPU clock
RDMA/rxe: Fix error type of mmap_offset
fbdev: fix numbering of fbcon options
ASoC: soc-topology: fix endianness issues
reset: uniphier: Add SCSSI reset control for each channel
pinctrl: sh-pfc: sh7269: Fix CAN function GPIOs
drm/fbdev: Fallback to non tiled mode if all tiles not present
PM / devfreq: rk3399_dmc: Add COMPILE_TEST and HAVE_ARM_SMCCC dependency
PM / devfreq: exynos-ppmu: Fix excessive stack usage
x86/vdso: Provide missing include file
crypto: chtls - Fixed memory leak
net: phy: realtek: add logging for the RGMII TX delay configuration
bpf: Print error message for bpftool cgroup show
dmaengine: imx-sdma: Fix memory leak
dmaengine: Store module owner in dma_device struct
clk: actually call the clock init before any other callback of the clock
iommu/iova: Silence warnings under memory pressure
iommu/amd: Only support x2APIC with IVHD type 11h/40h
iommu/amd: Check feature support bit before accessing MSI capability registers
arm64: dts: qcom: db845c: Enable ath10k 8bit host-cap quirk
scsi: lpfc: Fix: Rework setting of fdmi symbolic node name registration
selinux: ensure we cleanup the internal AVC counters on error in avc_update()
ARM: dts: r8a7779: Add device node for ARM global timer
clk: renesas: rcar-gen3: Allow changing the RPC[D2] clocks
drm/mediatek: handle events when enabling/disabling crtc
crypto: inside-secure - add unspecified HAS_IOMEM dependency
scsi: aic7xxx: Adjust indentation in ahc_find_syncrate
scsi: ufs: Complete pending requests in host reset and restore path
nfsd: Clone should commit src file metadata too
ACPICA: Disassembler: create buffer fields in ACPI_PARSE_LOAD_PASS1
clk: qcom: smd: Add missing bimc clock
drm/amdgpu: fix KIQ ring test fail in TDR of SRIOV
orinoco: avoid assertion in case of NULL pointer
rtlwifi: rtl_pci: Fix -Wcast-function-type
iwlegacy: Fix -Wcast-function-type
ipw2x00: Fix -Wcast-function-type
b43legacy: Fix -Wcast-function-type
PCI: Add DMA alias quirk for PLX PEX NTB
PCI: Add nr_devfns parameter to pci_add_dma_alias()
ALSA: usx2y: Adjust indentation in snd_usX2Y_hwdep_dsp_status
netfilter: nft_tunnel: add the missing ERSPAN_VERSION nla_policy
fore200e: Fix incorrect checks of NULL pointer dereference
r8169: check that Realtek PHY driver module is loaded
samples/bpf: Set -fno-stack-protector when building BPF programs
reiserfs: Fix spurious unlock in reiserfs_fill_super() error handling
media: v4l2-device.h: Explicitly compare grp{id,mask} to zero in v4l2_device macros
selftests/net: make so_txtime more robust to timer variance
gpu/drm: ingenic: Avoid null pointer deference in plane atomic update
Revert "nfp: abm: fix memory leak in nfp_abm_u32_knode_replace"
PCI: Increase D3 delay for AMD Ryzen5/7 XHCI controllers
PCI: Add generic quirk for increasing D3hot delay
media: cx23885: Add support for AVerMedia CE310B
PCI: iproc: Apply quirk_paxc_bridge() for module as well as built-in
bus: ti-sysc: Implement quirk handling for CLKDM_NOAUTO
ARM: dts: imx6: rdu2: Limit USBH1 to Full Speed
ARM: dts: imx6: rdu2: Disable WP for USDHC2 and USDHC3
ARM: exynos_defconfig: Bring back explicitly wanted options
clk: imx: Add correct failure handling for clk based helpers
padata: validate cpumask without removed CPU during offline
arm64: dts: qcom: msm8996: Disable USB2 PHY suspend by core
selinux: ensure we cleanup the internal AVC counters on error in avc_insert()
opp: Free static OPPs on errors while adding them
arm: dts: allwinner: H3: Add PMU node
arm64: dts: allwinner: H5: Add PMU node
arm64: dts: allwinner: H6: Add PMU mode
NFC: port100: Convert cpu_to_le16(le16_to_cpu(E1) + E2) to use le16_add_cpu().
net/wan/fsl_ucc_hdlc: reject muram offsets above 64K
regulator: rk808: Lower log level on optional GPIOs being not available
ASoC: intel: sof_rt5682: Add support for tgl-max98357a-rt5682
ASoC: intel: sof_rt5682: Add quirk for number of HDMI DAI's
modules: lockdep: Suppress suspicious RCU usage warning
arm64: dts: rockchip: Fix NanoPC-T4 cooling maps
drm/panel: simple: Add Logic PD Type 28 display support
drm/amdgpu: Ensure ret is always initialized when using SOC15_WAIT_ON_RREG
ath10k: correct the tlv len of ath10k_wmi_tlv_op_gen_config_pno_start
drm/amdgpu: remove 4 set but not used variable in amdgpu_atombios_get_connector_info_from_object_table
bpf, sockhash: Synchronize_rcu before free'ing map
drm/amdkfd: Fix a bug in SDMA RLC queue counting under HWS mode
clk: qcom: rcg2: Don't crash if our parent can't be found; return an error
clk: qcom: Don't overwrite 'cfg' in clk_rcg2_dfs_populate_freq()
kconfig: fix broken dependency in randconfig-generated .config
block, bfq: do not plug I/O for bfq_queues with no proc refs
drivers/block/zram/zram_drv.c: fix error return codes not being returned in writeback_store
Btrfs: keep pages dirty when using btrfs_writepage_fixup_worker
KVM: s390: ENOTSUPP -> EOPNOTSUPP fixups
nbd: add a flush_workqueue in nbd_start_device
tracing: Simplify assignment parsing for hist triggers
drm/amd/display: Retrain dongles when SINK_COUNT becomes non-zero
rtc: i2c/spi: Avoid inclusion of REGMAP support when not needed
selftests: settings: tests can be in subsubdirs
brcmfmac: sdio: Fix OOB interrupt initialization on brcm43362
rtw88: fix rate mask for 1SS chip
ath10k: Correct the DMA direction for management tx buffers
ext4, jbd2: ensure panic when aborting with zero errno
ARM: 8952/1: Disable kmemleak on XIP kernels
tracing: Fix very unlikely race of registering two stat tracers
tracing: Fix tracing_stat return values in error handling paths
powerpc/iov: Move VF pdev fixup into pcibios_fixup_iov()
s390/pci: Fix possible deadlock in recover_store()
wan/hdlc_x25: fix skb handling
dmaengine: fsl-qdma: fix duplicated argument to &&
udf: Allow writing to 'Rewritable' partitions
pwm: omap-dmtimer: Simplify error handling
x86/sysfb: Fix check for bad VRAM size
clk: ti: dra7: fix parent for gmac_clkctrl
ext4: fix deadlock allocating bio_post_read_ctx from mempool
jbd2: clear JBD2_ABORT flag before journal_reset to update log tail info when load journal
kselftest: Minimise dependency of get_size on C library interfaces
drm/amd/display: Clear state after exiting fixed active VRR state
clocksource/drivers/bcm2835_timer: Fix memory leak of timer
usb: dwc2: Fix IN FIFO allocation
usb: gadget: udc: fix possible sleep-in-atomic-context bugs in gr_probe()
drm/nouveau/nouveau: fix incorrect sizeof on args.src an args.dst
spi: fsl-lpspi: fix only one cs-gpio working
drm/amdgpu/sriov: workaround on rev_id for Navi12 under sriov
uio: fix a sleep-in-atomic-context bug in uio_dmem_genirq_irqcontrol()
raid6/test: fix a compilation error
net: ethernet: ixp4xx: Standard module init
sparc: Add .exit.data section.
MIPS: Loongson: Fix potential NULL dereference in loongson3_platform_init()
efi/x86: Map the entire EFI vendor string before copying it
pinctrl: baytrail: Do not clear IRQ flags on direct-irq enabled pins
IB/core: Let IB core distribute cache update events
kernel/module: Fix memleak in module_add_modinfo_attrs()
media: sti: bdisp: fix a possible sleep-in-atomic-context bug in bdisp_device_run()
char/random: silence a lockdep splat with printk()
x86/fpu: Deactivate FPU state after failure during state load
iommu/vt-d: Fix off-by-one in PASID allocation
gpio: gpio-grgpio: fix possible sleep-in-atomic-context bugs in grgpio_irq_map/unmap()
clk: meson: meson8b: make the CCF use the glitch-free mali mux
powerpc/powernv/iov: Ensure the pdn for VFs always contains a valid PE number
clk: at91: sam9x60: fix programmable clock prescaler
media: sun4i-csi: Fix [HV]sync polarity handling
media: sun4i-csi: Fix data sampling polarity handling
media: sun4i-csi: Deal with DRAM offset
media: i2c: mt9v032: fix enum mbus codes and frame sizes
media: ov5640: Fix check for PLL1 exceeding max allowed rate
pxa168fb: Fix the function used to release some memory in an error handling path
drm/msm/adreno: fix zap vs no-zap handling
drm/mipi_dbi: Fix off-by-one bugs in mipi_dbi_blank()
printk: fix exclusive_console replaying
pinctrl: sh-pfc: sh7264: Fix CAN function GPIOs
gianfar: Fix TX timestamping with a stacked DSA driver
ALSA: ctl: allow TLV read operation for callback type of element in locked case
ext4: fix ext4_dax_read/write inode locking sequence for IOCB_NOWAIT
leds: pca963x: Fix open-drain initialization
drm/amd/display: Map ODM memory correctly when doing ODM combine
PCI: Fix pci_add_dma_alias() bitmask size
brcmfmac: Fix use after free in brcmf_sdio_readframes()
brcmfmac: Fix memory leak in brcmf_p2p_create_p2pdev()
cpu/hotplug, stop_machine: Fix stop_machine vs hotplug order
clk: meson: pll: Fix by 0 division in __pll_params_to_rate()
media: meson: add missing allocation failure check on new_buf
f2fs: call f2fs_balance_fs outside of locked page
f2fs: preallocate DIO blocks when forcing buffered_io
rcu: Fix data-race due to atomic_t copy-by-value
rcu: Fix missed wakeup of exp_wq waiters
rcu/nocb: Fix dump_tree hierarchy print always active
drm/qxl: Complete exception handling in qxl_device_init()
wil6210: fix break that is never reached because of zero'ing of a retry counter
ath10k: Fix qmi init error handling
drm/gma500: Fixup fbdev stolen size usage evaluation
net/sched: flower: add missing validation of TCA_FLOWER_FLAGS
net/sched: matchall: add missing validation of TCA_MATCHALL_FLAGS
net: dsa: tag_qca: Make sure there is headroom for tag
net/smc: fix leak of kernel memory to user space
enic: prevent waking up stopped tx queues over watchdog reset
core: Don't skip generic XDP program execution for cloned SKBs
ANDROID: ufs, block: fix crypto power management and move into block layer
ANDROID: rtc: class: support hctosys from modular RTC drivers
ANDROID: update the abi after clk changes
ANDROID: update abi for f2fs/fscrypt merge
ANDROID: Kconfig.gki: Remove most of the built in qcom clks
FROMLIST: f2fs: Handle casefolding with Encryption
FROMLIST: fscrypt: Have filesystems handle their d_ops
FROMLIST: ext4: Use generic casefolding support
FROMLIST: f2fs: Use generic casefolding support
FROMLIST: Add standard casefolding support
FROMLIST: unicode: Add utf8_casefold_hash
ANDROID: gki: Set CONFIG_SERIAL_SAMSUNG for early con.
UPSTREAM: tty: serial: samsung_tty: remove SERIAL_SAMSUNG_DEBUG
UPSTREAM: tty: serial: samsung_tty: build it for any platform
UPSTREAM: tty: serial: samsung_tty: do not abuse the struct uart_port unused fields
UPSTREAM: tty: serial: samsung_tty: fix blank line checkpatch warning
UPSTREAM: tty: serial: samsung_tty: fix up minor comment formatting
UPSTREAM: tty: serial: samsung_tty: use 'unsigned int' not 'unsigned'
UPSTREAM: tty: serial: samsung_tty: use standard debugging macros
UPSTREAM: tty: serial: samsung_tty: drop unneded dbg() calls
UPSTREAM: tty: serial: samsung_tty: delete samsung.h
UPSTREAM: tty: serial: samsung.h: remove reset_port callback from struct s3c24xx_uart_info
UPSTREAM: tty: serial: samsung.h: fix up minor comment issues
UPSTREAM: tty: serial: samsung_tty: fix build warning
UPSTREAM: tty: serial: samsung: allow driver to be built by anyone
UPSTREAM: tty: serial: samsung: remove variable 'ufstat' set but not used
UPSTREAM: {tty: serial, nand: onenand}: samsung: rename to fix build warning
UPSTREAM: random: ignore GRND_RANDOM in getentropy(2)
UPSTREAM: random: add GRND_INSECURE to return best-effort non-cryptographic bytes
UPSTREAM: linux/random.h: Mark CONFIG_ARCH_RANDOM functions __must_check
UPSTREAM: linux/random.h: Use false with bool
UPSTREAM: linux/random.h: Remove arch_has_random, arch_has_random_seed
UPSTREAM: random: remove some dead code of poolinfo
UPSTREAM: random: fix typo in add_timer_randomness()
UPSTREAM: random: Add and use pr_fmt()
UPSTREAM: random: convert to ENTROPY_BITS for better code readability
UPSTREAM: random: remove unnecessary unlikely()
UPSTREAM: random: remove kernel.random.read_wakeup_threshold
UPSTREAM: random: delete code to pull data into pools
UPSTREAM: random: remove the blocking pool
UPSTREAM: random: make /dev/random be almost like /dev/urandom
UPSTREAM: random: Add a urandom_read_nowait() for random APIs that don't warn
UPSTREAM: random: Don't wake crng_init_wait when crng_init == 1
UPSTREAM: char/random: silence a lockdep splat with printk()
ANDROID: Incremental fs: Support xattrs
BACKPORT: sched/fair: Remove wake_cap()
UPSTREAM: sched/core: Remove for_each_lower_domain()
UPSTREAM: sched/topology: Remove SD_BALANCE_WAKE on asymmetric capacity systems
UPSTREAM: sched/fair: Add asymmetric CPU capacity wakeup scan
ANDROID: ufs: add quirk to fix abnormal ocs fatal error
FROMLIST: ufs: fix a bug on printing PRDT
ANDROID: update abi for 5.4.21
ANDROID: clang: update to 10.0.4
Linux 5.4.21
mmc: core: Rework wp-gpio handling
gpio: add gpiod_toggle_active_low()
KVM: x86/mmu: Fix struct guest_walker arrays for 5-level paging
ext4: choose hardlimit when softlimit is larger than hardlimit in ext4_statfs_project()
jbd2: do not clear the BH_Mapped flag when forgetting a metadata buffer
jbd2: move the clearing of b_modified flag to the journal_unmap_buffer()
Revert "drm/sun4i: drv: Allow framebuffer modifiers in mode config"
NFSv4.1 make cachethis=no for writes
perf stat: Don't report a null stalled cycles per insn metric
KVM: x86: Mask off reserved bit from #DB exception payload
arm64: dts: fast models: Fix FVP PCI interrupt-map property
cifs: fix mount option display for sec=krb5i
mac80211: fix quiet mode activation in action frames
hwmon: (pmbus/ltc2978) Fix PMBus polling of MFR_COMMON definitions.
perf/x86/intel: Fix inaccurate period in context switch for auto-reload
spmi: pmic-arb: Set lockdep class for hierarchical irq domains
sched/uclamp: Reject negative values in cpu_uclamp_write()
s390/time: Fix clk type in get_tod_clock
RDMA/core: Fix protection fault in get_pkey_idx_qp_list
RDMA/rxe: Fix soft lockup problem due to using tasklets in softirq
RDMA/hfi1: Fix memory leak in _dev_comp_vect_mappings_create
RDMA/iw_cxgb4: initiate CLOSE when entering TERM
RDMA/core: Fix invalid memory access in spec_filter_size
IB/umad: Fix kernel crash while unloading ib_umad
IB/rdmavt: Reset all QPs when the device is shut down
IB/hfi1: Close window for pq and request coliding
IB/hfi1: Acquire lock to release TID entries when user file is closed
IB/mlx5: Return failure when rts2rts_qp_counters_set_id is not supported
drivers: ipmi: fix off-by-one bounds check that leads to a out-of-bounds write
nvme: fix the parameter order for nvme_get_log in nvme_get_fw_slot_info
bus: moxtet: fix potential stack buffer overflow
drm/panfrost: Make sure the shrinker does not reclaim referenced BOs
drm/vgem: Close use-after-free race in vgem_gem_create
s390/uv: Fix handling of length extensions
s390/pkey: fix missing length of protected key on return
perf/x86/amd: Add missing L2 misses event spec to AMD Family 17h's event map
KVM: nVMX: Use correct root level for nested EPT shadow page tables
EDAC/mc: Fix use-after-free and memleaks during device removal
EDAC/sysfs: Remove csrow objects on errors
cifs: make sure we do not overflow the max EA buffer size
xprtrdma: Fix DMA scatter-gather list mapping imbalance
arm64: ssbs: Fix context-switch when SSBS is present on all CPUs
gpio: xilinx: Fix bug where the wrong GPIO register is written to
ARM: npcm: Bring back GPIOLIB support
btrfs: log message when rw remount is attempted with unclean tree-log
btrfs: print message when tree-log replay starts
btrfs: ref-verify: fix memory leaks
Btrfs: fix race between using extent maps and merging them
ext4: improve explanation of a mount failure caused by a misconfigured kernel
ext4: add cond_resched() to ext4_protect_reserved_inode
ext4: fix checksum errors with indexed dirs
ext4: fix support for inode sizes > 1024 bytes
ext4: don't assume that mmp_nodename/bdevname have NUL
ALSA: usb-audio: Add clock validity quirk for Denon MC7000/MCX8000
ALSA: usb-audio: sound: usb: usb true/false for bool return type
ACPI: PM: s2idle: Prevent spurious SCIs from waking up the system
ACPICA: Introduce acpi_any_gpe_status_set()
ACPI: PM: s2idle: Avoid possible race related to the EC GPE
ACPI: EC: Fix flushing of pending work
ALSA: usb-audio: Apply sample rate quirk for Audioengine D1
ALSA: hda/realtek - Fix silent output on MSI-GL73
ALSA: hda/realtek - Add more codec supported Headset Button
ALSA: usb-audio: Fix UAC2/3 effect unit parsing
Input: synaptics - remove the LEN0049 dmi id from topbuttonpad list
Input: synaptics - enable SMBus on ThinkPad L470
Input: synaptics - switch T470s to RMI4 by default
ANDROID: ABI/Whitelist: initial unisoc whitelist
ANDROID: Fix ABI representation after enabling CONFIG_NET_NS
ANDROID: gki_defconfig: Enable CONFIG_NET_NS
ANDROID: gki_defconfig: Enable XDP_SOCKETS
ANDROID: gki_defconfig: Enable MAC80211_RC_MINSTREL
ANDROID: virtio: virtio_input: pass _DIRECT only if the device advertises _DIRECT
ANDROID: staging: ion: delete unused heap types and IDs
ANDROID: gki_defconfig: disable system_contig ion heap.
ANDROID: cf build: Use merge_configs
ANDROID: net: bpf: Allow TC programs to call BPF_FUNC_skb_change_head
ANDROID: gki_defconfig: Disable SDCARD_FS
Linux 5.4.20
selinux: fall back to ref-walk if audit is required
libertas: make lbs_ibss_join_existing() return error code on rates overflow
libertas: don't exit from lbs_ibss_join_existing() with RCU read lock held
mwifiex: Fix possible buffer overflows in mwifiex_cmd_append_vsie_tlv()
mwifiex: Fix possible buffer overflows in mwifiex_ret_wmm_get_status()
dmaengine: axi-dmac: add a check for devm_regmap_init_mmio
clk: meson: g12a: fix missing uart2 in regmap table
mfd: max77650: Select REGMAP_IRQ in Kconfig
regmap: fix writes to non incrementing registers
pinctrl: sh-pfc: r8a7778: Fix duplicate SDSELF_B and SD1_CLK_B
pinctrl: sh-pfc: r8a77965: Fix DU_DOTCLKIN3 drive/bias control
selinux: fix regression introduced by move_mount(2) syscall
selinux: revert "stop passing MAY_NOT_BLOCK to the AVC upon follow_link"
bcache: avoid unnecessary btree nodes flushing in btree_flush_write()
dt-bindings: iio: adc: ad7606: Fix wrong maxItems value
media: i2c: adv748x: Fix unsafe macros
drivers: watchdog: stm32_iwdg: set WDOG_HW_RUNNING at probe
crypto: caam/qi2 - fix typo in algorithm's driver name
crypto: atmel-sha - fix error handling when setting hmac key
crypto: artpec6 - return correct error code for failed setkey()
crypto: testmgr - don't try to decrypt uninitialized buffers
mtd: sharpslpart: Fix unsigned comparison to zero
mtd: onenand_base: Adjust indentation in onenand_read_ops_nolock
arm64: nofpsmid: Handle TIF_FOREIGN_FPSTATE flag cleanly
KVM: arm64: Treat emulated TVAL TimerValue as a signed 32-bit integer
KVM: arm64: pmu: Fix chained SW_INCR counters
KVM: arm64: pmu: Don't increment SW_INCR if PMCR.E is unset
KVM: arm: Make inject_abt32() inject an external abort instead
KVM: arm: Fix DFSR setting for non-LPAE aarch32 guests
KVM: arm/arm64: Fix young bit from mmu notifier
arm64: ptrace: nofpsimd: Fail FP/SIMD regset operations
arm64: cpufeature: Set the FP/SIMD compat HWCAP bits properly
arm64: cpufeature: Fix the type of no FP/SIMD capability
sched/uclamp: Fix a bug in propagating uclamp value in new cgroups
ARM: 8949/1: mm: mark free_memmap as __init
KVM: arm/arm64: vgic-its: Fix restoration of unmapped collections
ARM: at91: pm: use of_device_id array to find the proper shdwc node
ARM: at91: pm: use SAM9X60 PMC's compatible
iommu/arm-smmu-v3: Populate VMID field for CMDQ_OP_TLBI_NH_VA
powerpc/pseries: Allow not having ibm, hypertas-functions::hcall-multi-tce for DDW
powerpc/pseries/vio: Fix iommu_table use-after-free refcount warning
powerpc/papr_scm: Fix leaking 'bus_desc.provider_name' in some paths
powerpc/ptdump: Only enable PPC_CHECK_WX with STRICT_KERNEL_RWX
powerpc/ptdump: Fix W+X verification call in mark_rodata_ro()
Revert "powerpc/pseries/iommu: Don't use dma_iommu_ops on secure guests"
soc: qcom: rpmhpd: Set 'active_only' for active only power domains
tools/power/acpi: fix compilation error
ARM: dts: at91: sama5d3: define clock rate range for tcb1
ARM: dts: at91: sama5d3: fix maximum peripheral clock rates
ARM: dts: meson8b: use the actual frequency for the GPU's 364MHz OPP
ARM: dts: meson8: use the actual frequency for the GPU's 182.1MHz OPP
arm64: dts: marvell: clearfog-gt-8k: fix switch cpu port node
arm64: dts: renesas: r8a77990: ebisu: Remove clkout-lr-synchronous from sound
ARM: dts: am43xx: add support for clkout1 clock
ARM: dts: at91: Reenable UART TX pull-ups
arm64: dts: uDPU: fix broken ethernet
arm64: dts: qcom: msm8998: Fix tcsr syscon size
platform/x86: intel_mid_powerbtn: Take a copy of ddata
ARC: [plat-axs10x]: Add missing multicast filter number to GMAC node
watchdog: qcom: Use platform_get_irq_optional() for bark irq
rtc: cmos: Stop using shared IRQ
rtc: hym8563: Return -EINVAL if the time is known to be invalid
x86/boot: Handle malformed SRAT tables during early ACPI parsing
NFSv4.0: nfs4_do_fsinfo() should not do implicit lease renewals
NFSv4: try lease recovery on NFS4ERR_EXPIRED
NFSv4: pnfs_roc() must use cred_fscmp() to compare creds
NFS: Fix fix of show_nfs_errors
NFS/pnfs: Fix pnfs_generic_prepare_to_resend_writes()
NFS: Revalidate the file size on a fatal write error
nfs: NFS_SWAP should depend on SWAP
bpf, sockmap: Check update requirements after locking
bpf: Improve bucket_log calculation logic
selftests/bpf: Test freeing sockmap/sockhash with a socket in it
bpf, sockhash: Synchronize_rcu before free'ing map
bpf, sockmap: Don't sleep while holding RCU lock on tear-down
bpftool: Don't crash on missing xlated program instructions
iwlwifi: mvm: avoid use after free for pmsr request
PCI/AER: Initialize aer_fifo
PCI: Don't disable bridge BARs when assigning bus resources
PCI: tegra: Fix afi_pex2_ctrl reg offset for Tegra30
PCI/switchtec: Fix vep_vector_number ioread width
PCI/switchtec: Use dma_set_mask_and_coherent()
ath10k: pci: Only dump ATH10K_MEM_REGION_TYPE_IOREG when safe
PCI/IOV: Fix memory leak in pci_iov_add_virtfn()
scsi: ufs: Fix ufshcd_probe_hba() reture value in case ufshcd_scsi_add_wlus() fails
RDMA/umem: Fix ib_umem_find_best_pgsz()
RDMA/cma: Fix unbalanced cm_id reference count during address resolve
RDMA/uverbs: Verify MR access flags
RDMA/core: Fix locking in ib_uverbs_event_read
RDMA/i40iw: fix a potential NULL pointer dereference
RDMA/netlink: Do not always generate an ACK for some netlink operations
IB/mlx4: Fix leak in id_map_find_del
IB/srp: Never use immediate data if it is disabled by a user
IB/mlx4: Fix memory leak in add_gid error flow
hv_sock: Remove the accept port restriction
ASoC: pcm: update FE/BE trigger order based on the command
ANDROID: gki_defconfig: Add CONFIG_UNICODE
ANDROID: added memory initialization tests to cuttlefish config
ANDROID: gki_defconfig: enable CONFIG_RUNTIME_TESTING_MENU
fs-verity: use u64_to_user_ptr()
fs-verity: use mempool for hash requests
fs-verity: implement readahead of Merkle tree pages
fs-verity: implement readahead for FS_IOC_ENABLE_VERITY
fscrypt: improve format of no-key names
ubifs: allow both hash and disk name to be provided in no-key names
ubifs: don't trigger assertion on invalid no-key filename
fscrypt: clarify what is meant by a per-file key
fscrypt: derive dirhash key for casefolded directories
fscrypt: don't allow v1 policies with casefolding
fscrypt: add "fscrypt_" prefix to fname_encrypt()
fscrypt: don't print name of busy file when removing key
ubifs: use IS_ENCRYPTED() instead of ubifs_crypt_is_encrypted()
fscrypt: document gfp_flags for bounce page allocation
fscrypt: optimize fscrypt_zeroout_range()
fscrypt: remove redundant bi_status check
fscrypt: Allow modular crypto algorithms
FROMLIST: rename missed uaccess .fixup section
ANDROID: gki_defconfig: enable heap and stack initialization.
ANDROID: ABI/Whitelist: update for db845c
ANDROID: ABI/Whitelist: update for Cuttlefish
ANDROID: update ABI representation and GKI whitelist
ANDROID: f2fs: fix missing blk-crypto changes
fscrypt: include <linux/ioctl.h> in UAPI header
fscrypt: don't check for ENOKEY from fscrypt_get_encryption_info()
fscrypt: remove fscrypt_is_direct_key_policy()
fscrypt: move fscrypt_valid_enc_modes() to policy.c
fscrypt: check for appropriate use of DIRECT_KEY flag earlier
fscrypt: split up fscrypt_supported_policy() by policy version
fscrypt: introduce fscrypt_needs_contents_encryption()
fscrypt: move fscrypt_d_revalidate() to fname.c
fscrypt: constify inode parameter to filename encryption functions
fscrypt: constify struct fscrypt_hkdf parameter to fscrypt_hkdf_expand()
fscrypt: verify that the crypto_skcipher has the correct ivsize
fscrypt: use crypto_skcipher_driver_name()
fscrypt: support passing a keyring key to FS_IOC_ADD_ENCRYPTION_KEY
UPSTREAM: dynamic_debug: allow to work if debugfs is disabled
UPSTREAM: serial: sprd: Add polling IO support
UPSTREAM: dmaengine: sprd: Add wrap address support for link-list mode
UPSTREAM: pinctrl: sprd: Add CM4 sleep mode support
UPSTREAM: pinctrl: sprd: Add PIN_CONFIG_BIAS_DISABLE configuration support
UPSTREAM: spi: sprd: adi: Set BIT_WDG_NEW bit when rebooting
UPSTREAM: nvmem: sprd: Add Spreadtrum SoCs eFuse support
UPSTREAM: dt-bindings: nvmem: Add Spreadtrum eFuse controller documentation
UPSTREAM: scsi: ufs-mediatek: enable low-power mode for hibern8 state
BACKPORT: scsi: ufs: export some functions for vendor usage
UPSTREAM: scsi: ufs-mediatek: add dbg_register_dump implementation
UPSTREAM: scsi: ufs-mediatek: add apply_dev_quirks variant operation
UPSTREAM: scsi: ufs: pass device information to apply_dev_quirks
UPSTREAM: scsi: ufs: add device reset history for vendor implementations
UPSTREAM: scsi: ufs: fix empty check of error history
UPSTREAM: scsi: ufs-mediatek: configure and enable clk-gating
UPSTREAM: scsi: ufs-mediatek: configure customized auto-hibern8 timer
BACKPORT: scsi: ufs: export ufshcd_auto_hibern8_update for vendor usage
UPSTREAM: scsi: ufs-mediatek: introduce reference clock control
UPSTREAM: scsi: ufs-mediatek: add device reset implementation
UPSTREAM: scsi: soc: mediatek: add header for SiP service interface
BACKPORT: scsi: ufs: use ufshcd_vops_dbg_register_dump for vendor specific dumps
BACKPORT: scsi: ufs: unify scsi_block_requests usage
UPSTREAM: scsi: ufs: disable interrupt during clock-gating
UPSTREAM: scsi: ufs: disable irq before disabling clocks
UPSTREAM: scsi: ufs-mediatek: enable auto suspend capability
ANDROID: update ABI for 5.4.19
ANDROID: fix up dummy-cpufreq.c due to api changes
Linux 5.4.19
powerpc/kuap: Fix set direction in allow/prevent_user_access()
regulator fix for "regulator: core: Add regulator_is_equal() helper"
rxrpc: Fix service call disconnection
perf/core: Fix mlock accounting in perf_mmap()
clocksource: Prevent double add_timer_on() for watchdog_timer
x86/apic/msi: Plug non-maskable MSI affinity race
cifs: fail i/o on soft mounts if sessionsetup errors out
KVM: Play nice with read-only memslots when querying host page size
KVM: Use vcpu-specific gva->hva translation when querying host page size
KVM: nVMX: vmread should not set rflags to specify success in case of #PF
KVM: x86: fix overlap between SPTE_MMIO_MASK and generation
KVM: x86: Use gpa_t for cr2/gpa to fix TDP support on 32-bit KVM
KVM: x86: use CPUID to locate host page table reserved bits
KVM: x86/mmu: Apply max PA check for MMIO sptes to 32-bit KVM
drm/dp_mst: Remove VCPI while disabling topology mgr
btrfs: free block groups after free'ing fs trees
btrfs: use bool argument in free_root_pointers()
x86/timer: Don't skip PIT setup when APIC is disabled or in legacy mode
mfd: bd70528: Fix hour register mask
mfd: rn5t618: Mark ADC control register volatile
mfd: da9062: Fix watchdog compatible string
ASoC: Intel: skl_hda_dsp_common: Fix global-out-of-bounds bug
net/mlx5: Deprecate usage of generic TLS HW capability bit
net/mlx5: Fix deadlock in fs_core
drop_monitor: Do not cancel uninitialized work item
qed: Fix timestamping issue for L2 unicast ptp packets.
ipv6/addrconf: fix potential NULL deref in inet6_set_link_af()
taprio: Fix dropping packets when using taprio + ETF offloading
taprio: Use taprio_reset_tc() to reset Traffic Classes configuration
taprio: Add missing policy validation for flags
taprio: Fix still allowing changing the flags during runtime
taprio: Fix enabling offload with wrong number of traffic classes
net: macb: Limit maximum GEM TX length in TSO
net: macb: Remove unnecessary alignment check for TSO
net/mlx5: IPsec, fix memory leak at mlx5_fpga_ipsec_delete_sa_ctx
net/mlx5: IPsec, Fix esp modify function attribute
net: systemport: Avoid RBUF stuck in Wake-on-LAN mode
net: stmmac: fix a possible endless loop
net_sched: fix a resource leak in tcindex_set_parms()
net: mvneta: move rx_dropped and rx_errors in per-cpu stats
net: dsa: microchip: enable module autoprobe
net: dsa: bcm_sf2: Only 7278 supports 2Gb/sec IMP port
net: dsa: b53: Always use dev->vlan_enabled in b53_configure_vlan()
dpaa_eth: support all modes with rate adapting PHYs
devlink: report 0 after hitting end in region read
bonding/alb: properly access headers in bond_alb_xmit()
ASoC: sgtl5000: Fix VDDA and VDDIO comparison
regulator: core: Add regulator_is_equal() helper
ubifs: Fix memory leak from c->sup_node
ubi: Fix an error pointer dereference in error handling code
ubi: fastmap: Fix inverted logic in seen selfcheck
virtio_balloon: Fix memory leaks on errors in virtballoon_probe()
virtio-balloon: Fix memory leak when unloading while hinting is in progress
nfsd: Return the correct number of bytes written to the file
nfsd: fix jiffies/time_t mixup in LRU list
nfsd: fix delay timer on 32-bit architectures
IB/core: Fix ODP get user pages flow
IB/mlx5: Fix outstanding_pi index for GSI qps
net: tulip: Adjust indentation in {dmfe, uli526x}_init_module
net: smc911x: Adjust indentation in smc911x_phy_configure
ppp: Adjust indentation into ppp_async_input
NFC: pn544: Adjust indentation in pn544_hci_check_presence
drm: msm: mdp4: Adjust indentation in mdp4_dsi_encoder_enable
powerpc/44x: Adjust indentation in ibm4xx_denali_fixup_memsize
ext2: Adjust indentation in ext2_fill_super
phy: qualcomm: Adjust indentation in read_poll_timeout
mtd: spi-nor: Split mt25qu512a (n25q512a) entry into two
scsi: ufs: Recheck bkops level if bkops is disabled
scsi: qla4xxx: Adjust indentation in qla4xxx_mem_free
scsi: csiostor: Adjust indentation in csio_device_reset
scsi: qla2xxx: Fix the endianness of the qla82xx_get_fw_size() return type
ASoC: meson: axg-fifo: fix fifo threshold setup
percpu: Separate decrypted varaibles anytime encryption can be enabled
broken ping to ipv6 linklocal addresses on debian buster
fix up iter on short count in fuse_direct_io()
virtio-pci: check name when counting MSI-X vectors
virtio-balloon: initialize all vq callbacks
drm/amd/dm/mst: Ignore payload update failures
clk: tegra: Mark fuse clock as critical
mm/mmu_gather: invalidate TLB correctly on batch allocation failure and flush
arm64: dts: qcom: qcs404-evb: Set vdd_apc regulator in high power mode
mm/page_alloc.c: fix uninitialized memmaps on a partially populated last section
ocfs2: fix oops when writing cloned file
KVM: s390: do not clobber registers during guest reset/store status
KVM: x86: Revert "KVM: X86: Fix fpu state crash in kvm guest"
KVM: x86: Ensure guest's FPU state is loaded when accessing for emulation
KVM: x86: Handle TIF_NEED_FPU_LOAD in kvm_{load,put}_guest_fpu()
KVM: x86: Free wbinvd_dirty_mask if vCPU creation fails
KVM: x86: Don't let userspace set host-reserved cr4 bits
KVM: VMX: Add non-canonical check on writes to RTIT address MSRs
x86/KVM: Clean up host's steal time structure
x86/kvm: Cache gfn to pfn translation
x86/KVM: Make sure KVM_VCPU_FLUSH_TLB flag is not missed
x86/kvm: Introduce kvm_(un)map_gfn()
x86/kvm: Be careful not to clear KVM_VCPU_FLUSH_TLB bit
kvm/svm: PKU not currently supported
KVM: PPC: Book3S PR: Free shared page if mmu initialization fails
KVM: PPC: Book3S HV: Uninit vCPU if vcore creation fails
KVM: x86: Fix potential put_fpu() w/o load_fpu() on MPX platform
KVM: x86: Protect MSR-based index computations in fixed_msr_to_seg_unit() from Spectre-v1/L1TF attacks
KVM: x86: Protect x86_decode_insn from Spectre-v1/L1TF attacks
KVM: x86: Protect MSR-based index computations from Spectre-v1/L1TF attacks in x86.c
KVM: x86: Protect ioapic_read_indirect() from Spectre-v1/L1TF attacks
KVM: x86: Protect MSR-based index computations in pmu.h from Spectre-v1/L1TF attacks
KVM: x86: Protect ioapic_write_indirect() from Spectre-v1/L1TF attacks
KVM: x86: Protect kvm_hv_msr_[get|set]_crash_data() from Spectre-v1/L1TF attacks
KVM: x86: Protect kvm_lapic_reg_write() from Spectre-v1/L1TF attacks
KVM: x86: Protect DR-based index computations from Spectre-v1/L1TF attacks
KVM: x86: Protect pmu_intel.c from Spectre-v1/L1TF attacks
KVM: x86: Refactor prefix decoding to prevent Spectre-v1/L1TF attacks
KVM: x86: Refactor picdev_write() to prevent Spectre-v1/L1TF attacks
aio: prevent potential eventfd recursion on poll
eventfd: track eventfd_signal() recursion depth
bcache: add readahead cache policy options via sysfs interface
watchdog: fix UAF in reboot notifier handling in watchdog core code
xen/balloon: Support xend-based toolstack take two
tools/kvm_stat: Fix kvm_exit filter name
media: rc: ensure lirc is initialized before registering input device
media: iguanair: fix endpoint sanity check
drm/rect: Avoid division by zero
drm: atmel-hlcdc: prefer a lower pixel-clock than requested
drm: atmel-hlcdc: enable clock before configuring timing engine
drm: atmel-hlcdc: use double rate for pixel clock only if supported
gfs2: fix O_SYNC write handling
gfs2: move setting current->backing_dev_info
gfs2: fix gfs2_find_jhead that returns uninitialized jhead with seq 0
sunrpc: expiry_time should be seconds not timeval
mwifiex: fix unbalanced locking in mwifiex_process_country_ie()
iwlwifi: don't throw error when trying to remove IGTK
ARM: tegra: Enable PLLP bypass during Tegra124 LP1
btrfs: Correctly handle empty trees in find_first_clear_extent_bit
btrfs: flush write bio if we loop in extent_write_cache_pages
Btrfs: fix race between adding and putting tree mod seq elements and nodes
btrfs: drop log root for dropped roots
btrfs: set trans->drity in btrfs_commit_transaction
Btrfs: fix infinite loop during fsync after rename operations
Btrfs: make deduplication with range including the last block work
Btrfs: fix missing hole after hole punching and fsync when using NO_HOLES
ext4: fix race conditions in ->d_compare() and ->d_hash()
ext4: fix deadlock allocating crypto bounce page from mempool
jbd2_seq_info_next should increase position index
nfsd: fix filecache lookup
NFS: Directory page cache pages need to be locked when read
NFS: Fix memory leaks and corruption in readdir
scsi: qla2xxx: Fix unbound NVME response length
powerpc/futex: Fix incorrect user access blocking
crypto: picoxcell - adjust the position of tasklet_init and fix missed tasklet_kill
crypto: api - Fix race condition in crypto_spawn_alg
crypto: atmel-aes - Fix counter overflow in CTR mode
crypto: pcrypt - Do not clear MAY_SLEEP flag in original request
crypto: arm64/ghash-neon - bump priority to 150
crypto: ccp - set max RSA modulus size for v3 platform devices as well
crypto: hisilicon - Use the offset fields in sqe to avoid need to split scatterlists
crypto: api - fix unexpectedly getting generic implementation
selftests: bpf: Ignore FIN packets for reuseport tests
selftests: bpf: Use a temporary file in test_sockmap
selftests/bpf: Skip perf hw events test if the setup disabled it
selftests/bpf: Fix test_attach_probe
samples/bpf: Xdp_redirect_cpu fix missing tracepoint attach
samples/bpf: Don't try to remove user's homedir on clean
tc-testing: fix eBPF tests failure on linux fresh clones
libbpf: Fix realloc usage in bpf_core_find_cands
bpf, devmap: Pass lockdep expression to RCU lists
selftests/bpf: Fix perf_buffer test on systems w/ offline CPUs
riscv, bpf: Fix broken BPF tail calls
btrfs: Handle another split brain scenario with metadata uuid feature
btrfs: fix improper setting of scanned for range cyclic write cache pages
crypto: pcrypt - Avoid deadlock by using per-instance padata queues
ftrace: Protect ftrace_graph_hash with ftrace_sync
ftrace: Add comment to why rcu_dereference_sched() is open coded
tracing: Annotate ftrace_graph_notrace_hash pointer with __rcu
tracing: Annotate ftrace_graph_hash pointer with __rcu
ASoC: SOF: core: release resources on errors in probe_continue
ASoC: SOF: Introduce state machine for FW boot
scsi: qla2xxx: Fix stuck login session using prli_pend_timer
dm: fix potential for q->make_request_fn NULL pointer
dm thin metadata: use pool locking at end of dm_pool_metadata_close
dm crypt: fix benbi IV constructor crash if used in authenticated mode
dm crypt: fix GFP flags passed to skcipher_request_alloc()
dm writecache: fix incorrect flush sequence when doing SSD mode commit
dm space map common: fix to ensure new block isn't already in use
dm zoned: support zone sizes smaller than 128MiB
ARM: dma-api: fix max_pfn off-by-one error in __dma_supported()
of: Add OF_DMA_DEFAULT_COHERENT & select it on powerpc
cpufreq: Avoid creating excessively large stack frames
PM: core: Fix handling of devices deleted during system-wide resume
f2fs: fix race conditions in ->d_compare() and ->d_hash()
f2fs: fix dcache lookup of !casefolded directories
f2fs: code cleanup for f2fs_statfs_project()
f2fs: fix miscounted block limit in f2fs_statfs_project()
f2fs: choose hardlimit when softlimit is larger than hardlimit in f2fs_statfs_project()
ovl: fix lseek overflow on 32bit
ovl: fix wrong WARN_ON() in ovl_cache_update_ino()
power: supply: ltc2941-battery-gauge: fix use-after-free
power: supply: axp20x_ac_power: Fix reporting online status
cpupower: Revert library ABI changes from commit ae2917093f
scsi: qla2xxx: Fix mtcp dump collection failure
scsi: megaraid_sas: Do not initiate OCR if controller is not in ready state
erofs: fix out-of-bound read for shifted uncompressed block
scripts/find-unused-docs: Fix massive false positives
fs: allow deduplication of eof block into the end of the destination file
padata: Remove broken queue flushing
crypto: ccree - fix PM race condition
crypto: ccree - fix FDE descriptor sequence
crypto: ccree - fix pm wrongful error reporting
crypto: ccree - fix AEAD decrypt auth fail
crypto: ccree - fix backlog memory leak
crypto: api - Check spawn->alg under lock in crypto_drop_spawn
nvmem: core: fix memory abort in cleanup path
mfd: axp20x: Mark AXP20X_VBUS_IPSOUT_MGMT as volatile
hv_balloon: Balloon up according to request page number
ASoC: SOF: core: free trace on errors
mmc: sdhci-of-at91: fix memleak on clk_get failure
ubifs: Fix deadlock in concurrent bulk-read and writepage
ubifs: Fix FS_IOC_SETFLAGS unexpectedly clearing encrypt flag
ubifs: Fix wrong memory allocation
ubifs: don't trigger assertion on invalid no-key filename
fscrypt: don't print name of busy file when removing key
alarmtimer: Unregister wakeup source when module get fails
ACPI / battery: Deal better with neither design nor full capacity not being reported
ACPI / battery: Use design-cap for capacity calculations if full-cap is not available
ACPI / battery: Deal with design or full capacity being reported as -1
ACPI: video: Do not export a non working backlight interface on MSI MS-7721 boards
mmc: spi: Toggle SPI polarity, do not hardcode it
PCI: keystone: Fix error handling when "num-viewport" DT property is not populated
PCI: keystone: Fix link training retries initiation
PCI: keystone: Fix outbound region mapping
PCI: tegra: Fix return value check of pm_runtime_get_sync()
tracing: Fix now invalid var_ref_vals assumption in trace action
powerpc/32s: Fix CPU wake-up from sleep mode
powerpc/32s: Fix bad_kuap_fault()
powerpc/pseries: Advance pfn if section is not present in lmb_is_removable()
powerpc/xmon: don't access ASDR in VMs
powerpc/ptdump: Fix W+X verification
powerpc/mmu_gather: enable RCU_TABLE_FREE even for !SMP case
s390/mm: fix dynamic pagetable upgrade for hugetlbfs
MIPS: boot: fix typo in 'vmlinux.lzma.its' target
MIPS: fix indentation of the 'RELOCS' message
MIPS: syscalls: fix indentation of the 'SYSNR' message
KVM: arm64: Only sign-extend MMIO up to register width
KVM: arm/arm64: Correct AArch32 SPSR on exception entry
KVM: arm/arm64: Correct CPSR on exception entry
KVM: arm64: Correct PSTATE on exception entry
arm64: acpi: fix DAIF manipulation with pNMI
ALSA: hda: Add JasperLake PCI ID and codec vid
ALSA: hda: Add Clevo W65_67SB the power_save blacklist
ALSA: hda: Apply aligned MMIO access only conditionally
platform/x86: intel_scu_ipc: Fix interrupt support
x86/cpu: Update cached HLE state on write to TSX_CTRL_CPUID_CLEAR
irqdomain: Fix a memory leak in irq_domain_push_irq()
lib/test_kasan.c: fix memory leak in kmalloc_oob_krealloc_more()
media: v4l2-rect.h: fix v4l2_rect_map_inside() top/left adjustments
media: v4l2-core: compat: ignore native command codes
media/v4l2-core: set pages dirty upon releasing DMA buffers
mm: move_pages: report the number of non-attempted pages
mm: thp: don't need care deferred split queue in memcg charge move path
mm/memory_hotplug: fix remove_memory() lockdep splat
utimes: Clamp the timestamps in notify_change()
mmc: sdhci-pci: Make function amd_sdhci_reset static
mm/sparse.c: reset section's mem_map when fully deactivated
memcg: fix a crash in wb_workfn when a device disappears
ALSA: dummy: Fix PCM format loop in proc output
ALSA: usb-audio: Annotate endianess in Scarlett gen2 quirk
ALSA: usb-audio: Fix endianess in descriptor validation
usb: gadget: f_ecm: Use atomic_t to track in-flight request
usb: gadget: f_ncm: Use atomic_t to track in-flight request
usb: gadget: legacy: set max_speed to super-speed
usb: gadget: f_fs: set req->num_sgs as 0 for non-sg transfer
objtool: Silence build output
usb: typec: tcpci: mask event interrupts when remove driver
usb: dwc3: gadget: Delay starting transfer
usb: dwc3: gadget: Check END_TRANSFER completion
brcmfmac: Fix memory leak in brcmf_usbdev_qinit
Bluetooth: btusb: Disable runtime suspend on Realtek devices
Bluetooth: btusb: fix memory leak on fw
nvmet: Fix controller use after free
nvmet: Fix error print message at nvmet_install_queue function
rcu: Use READ_ONCE() for ->expmask in rcu_read_unlock_special()
srcu: Apply *_ONCE() to ->srcu_last_gp_end
rcu: Avoid data-race in rcu_gp_fqs_check_wake()
rcu: Use *_ONCE() to protect lockless ->expmask accesses
tracing: Fix sched switch start/stop refcount racy updates
tracing/kprobes: Have uname use __get_str() in print_fmt
ipc/msg.c: consolidate all xxxctl_down() functions
netfilter: ipset: fix suspicious RCU usage in find_set_and_id
mfd: dln2: More sanity checking for endpoints
media: uvcvideo: Avoid cyclic entity chains due to malformed USB descriptors
bnxt_en: Fix logic that disables Bus Master during firmware reset.
netdevsim: fix stack-out-of-bounds in nsim_dev_debugfs_init()
MAINTAINERS: correct entries for ISDN/mISDN section
ionic: fix rxq comp packet type mask
tcp: clear tp->segs_{in|out} in tcp_disconnect()
tcp: clear tp->data_segs{in|out} in tcp_disconnect()
tcp: clear tp->delivered in tcp_disconnect()
tcp: clear tp->total_retrans in tcp_disconnect()
rxrpc: Fix NULL pointer deref due to call->conn being cleared on disconnect
rxrpc: Fix missing active use pinning of rxrpc_local object
rxrpc: Fix insufficient receive notification generation
rxrpc: Fix use-after-free in rxrpc_put_local()
bnxt_en: Fix TC queue mapping.
net: stmmac: Delete txtimer in suspend()
net_sched: fix an OOB access in cls_tcindex
net: hsr: fix possible NULL deref in hsr_handle_frame()
l2tp: Allow duplicate session creation with UDP
gtp: use __GFP_NOWARN to avoid memalloc warning
cls_rsvp: fix rsvp_policy
bnxt_en: Move devlink_register before registering netdev
sparc32: fix struct ipc64_perm type definition
ANDROID: Revert "ANDROID: gki_defconfig: removed CONFIG_PM_WAKELOCKS"
ANDROID: dm: prevent default-key from being enabled without needed hooks
UPSTREAM: crypto: x86 - Regularize glue function prototypes
ANDROID: gki: x86: Enable PCI_MSI, WATCHDOG, HPET
ANDROID: drm: Add support for DP 1.4 Compliance edid corruption test
ANDROID: drm: Parse Colorimetry data block from EDID
ANDROID: drm: fix HDR static metadata type field numbering
ANDROID: Incremental fs: Make files writeable
UPSTREAM: mfd: syscon: Add arguments support for syscon reference
ANDROID: Incremental fs: Fix crash on failed lookup
UPSTREAM: usb: gadget: f_fs: set req->num_sgs as 0 for non-sg transfer
ANDROID: support GKI image that contains an uncompressed Kernel Image.
ANDROID: update ABI for 5.4.18
Linux 5.4.18
tracing/uprobe: Fix to make trace_uprobe_filter alignment safe
Revert "rsi: fix potential null dereference in rsi_probe()"
ASoC: topology: fix soc_tplg_fe_link_create() - link->dobj initialization order
mm/migrate.c: also overwrite error when it is bigger than zero
perf report: Fix no libunwind compiled warning break s390 issue
dm thin: fix use-after-free in metadata_pre_commit_callback
flow_dissector: Fix to use new variables for port ranges in bpf hook
cpuidle: teo: Avoid using "early hits" incorrectly
btrfs: do not zero f_bavail if we have available space
net: Fix skb->csum update in inet_proto_csum_replace16().
netfilter: nf_tables_offload: fix check the chain offload flag
netfilter: conntrack: sctp: use distinct states for new SCTP connections
l2t_seq_next should increase position index
seq_tab_next() should increase position index
net: fsl/fman: rename IF_MODE_XGMII to IF_MODE_10G
net/fsl: treat fsl,erratum-a011043
powerpc/fsl/dts: add fsl,erratum-a011043
qlcnic: Fix CPU soft lockup while collecting firmware dump
ARM: dts: am43x-epos-evm: set data pin directions for spi0 and spi1
r8152: disable DelayPhyPwrChg
r8152: avoid the MCU to clear the lanwake
r8152: disable test IO for RTL8153B
r8152: Disable PLA MCU clock speed down
r8152: disable U2P3 for RTL8153B
r8152: get default setting of WOL before initializing
tee: optee: Fix compilation issue with nommu
led: max77650: add of_match table
ARM: 8955/1: virt: Relax arch timer version check during early boot
scsi: fnic: do not queue commands during fwreset
Input: max77650-onkey - add of_match table
xfrm: interface: do not confirm neighbor when do pmtu update
xfrm interface: fix packet tx through bpf_redirect()
vti[6]: fix packet tx through bpf_redirect()
ARM: dts: am335x-boneblack-common: fix memory size
Input: evdev - convert kzalloc()/vzalloc() to kvzalloc()
iwlwifi: dbg: force stop the debug monitor HW
iwlwifi: Don't ignore the cap field upon mcc update
iwlwifi: pcie: allocate smaller dev_cmd for TX headers
XArray: Fix xas_pause at ULONG_MAX
riscv: delete temporary files
perf/x86/intel/uncore: Remove PCIe3 unit for SNR
perf/x86/intel/uncore: Add PCI ID of IMC for Xeon E3 V5 Family
wireless: wext: avoid gcc -O3 warning
mac80211: Fix TKIP replay protection immediately after key setup
cfg80211: Fix radar event during another phy CAC
wireless: fix enabling channel 12 for custom regulatory domain
lkdtm/bugs: fix build error in lkdtm_UNSET_SMEP
parisc: Use proper printk format for resource_size_t
qmi_wwan: Add support for Quectel RM500Q
ASoC: sti: fix possible sleep-in-atomic
ASoC: hdac_hda: Fix error in driver removal after failed probe
ASoC: SOF: Intel: fix HDA codec driver probe with multiple controllers
platform/x86: intel_pmc_core: update Comet Lake platform driver
platform/x86: GPD pocket fan: Allow somewhat lower/higher temperature limits
iavf: remove current MAC address filter on VF reset
igb: Fix SGMII SFP module discovery for 100FX/LX.
ixgbe: Fix calculation of queue with VFs and flow director on interface flap
ixgbevf: Remove limit of 10 entries for unicast filter list
i40e: Fix virtchnl_queue_select bitmap validation
s390/zcrypt: move ap device reset from bus to driver code
ASoC: rt5640: Fix NULL dereference on module unload
clk: mmp2: Fix the order of timer mux parents
mac80211: mesh: restrict airtime metric to peered established plinks
clk: sunxi-ng: h6-r: Fix AR100/R_APB2 parent order
clk: sunxi-ng: sun8i-r: Fix divider on APB0 clock
rseq: Unregister rseq for clone CLONE_VM
tools lib traceevent: Fix memory leakage in filter_event
soc: ti: wkup_m3_ipc: Fix race condition with rproc_boot
ARM: dts: beagle-x15-common: Model 5V0 regulator
ARM: dts: am57xx-beagle-x15/am57xx-idk: Remove "gpios" for endpoint dt nodes
ARM: dts: sun8i: a83t: Correct USB3503 GPIOs polarity
arm64: dts: meson-sm1-sei610: add gpio bluetooth interrupt
clk: sunxi-ng: v3s: Fix incorrect number of hw_clks.
cgroup: Prevent double killing of css when enabling threaded cgroup
Bluetooth: Fix race condition in hci_release_sock()
ttyprintk: fix a potential deadlock in interrupt context issue
tomoyo: Use atomic_t for statistics counter
media: dvb-usb/dvb-usb-urb.c: initialize actlen to 0
media: gspca: zero usb_buf
media: vp7045: do not read uninitialized values if usb transfer fails
media: af9005: uninitialized variable printked
media: digitv: don't continue if remote control state can't be read
reiserfs: Fix memory leak of journal device string
mm/mempolicy.c: fix out of bounds write in mpol_parse_str()
arm64: kbuild: remove compressed images on 'make ARCH=arm64 (dist)clean'
tools lib: Fix builds when glibc contains strlcpy()
PM / devfreq: Add new name attribute for sysfs
perf c2c: Fix return type for histogram sorting comparision functions
gfs2: Another gfs2_find_jhead fix
e1000e: Revert "e1000e: Make watchdog use delayed work"
e1000e: Drop unnecessary __E1000_DOWN bit twiddling
x86/resctrl: Fix use-after-free due to inaccurate refcount of rdtgroup
x86/resctrl: Fix use-after-free when deleting resource groups
x86/resctrl: Fix a deadlock due to inaccurate reference
cifs: fix soft mounts hanging in the reconnect code
vfs: fix do_last() regression
ANDROID: Incremental fs: Remove C++-style comments
ANDROID: gki_defconfig: Set CONFIG_ANDROID_BINDERFS=y
FROMLIST: selinux: Fix typo in filesystem name
UPSTREAM: drm: Add DisplayPort colorspace property creation function
UPSTREAM: drm: Rename HDMI colorspace property creation function
ANDROID: db845c: Update db845c_gki.fragment to add support for bluetooth modules
UPSTREAM: sched/rt: Make RT capacity-aware
UPSTREAM: sched/fair: Make EAS wakeup placement consider uclamp restrictions
UPSTREAM: sched/fair: Make task_fits_capacity() consider uclamp restrictions
UPSTREAM: sched/uclamp: Rename uclamp_util_with() into uclamp_rq_util_with()
UPSTREAM: sched/uclamp: Make uclamp util helpers use and return UL values
BACKPORT: sched/uclamp: Remove uclamp_util()
Revert "ANDROID: sched/fair: EAS: Add uclamp support to find_energy_efficient_cpu()"
Linux 5.4.17
power/supply: ingenic-battery: Don't change scale if there's only one
Revert "um: Enable CONFIG_CONSTRUCTORS"
KVM: arm64: Write arch.mdcr_el2 changes since last vcpu_load on VHE
crypto: pcrypt - Fix user-after-free on module unload
crypto: caam - do not reset pointer size from MCFGR register
crypto: vmx - reject xts inputs that are too short
crypto: af_alg - Use bh_lock_sock in sk_destruct
rsi: fix non-atomic allocation in completion handler
rsi: fix memory leak on failed URB submission
rsi: fix use-after-free on probe errors
rsi: fix use-after-free on failed probe and unbind
bus: ti-sysc: Fix missing force mstandby quirk handling
Bluetooth: btbcm: Use the BDADDR_PROPERTY quirk
Bluetooth: Allow combination of BDADDR_PROPERTY and INVALID_BDADDR quirks
ALSA: hda/realtek - Move some alc236 pintbls to fallback table
usb-storage: Disable UAS on JMicron SATA enclosure
bus: ti-sysc: Add module enable quirk for audio AESS
mmc: sdhci-pci: Add support for Intel JSL
mmc: sdhci-pci: Quirk for AMD SDHC Device 0x7906
ARM: OMAP2+: SmartReflex: add omap_sr_pdata definition
ARM: config: aspeed-g5: Enable 8250_DW quirks
mfd: intel-lpss: Add Intel Comet Lake PCH-H PCI IDs
perf/imx_ddr: Add enhanced AXI ID filter support
iommu/amd: Support multiple PCI DMA aliases in IRQ Remapping
iommu/amd: Support multiple PCI DMA aliases in device table
spi: pxa2xx: Add support for Intel Comet Lake-H
bus: ti-sysc: Use swsup quirks also for am335x musb
bus: ti-sysc: Handle mstandby quirk and use it for musb
media: dvbsky: add support for eyeTV Geniatech T2 lite
PCI: Add DMA alias quirk for Intel VCA NTB
platform/x86: dell-laptop: disable kbd backlight on Inspiron 10xx
staging: mt7621-pci: add quirks for 'E2' revision using 'soc_device_attribute'
libbpf: Fix BTF-defined map's __type macro handling of arrays
drm/amdgpu/SRIOV: add navi12 pci id for SRIOV (v2)
ASoC: Intel: cht_bsw_rt5645: Add quirk for boards using pmc_plt_clk_0
extcon-intel-cht-wc: Don't reset USB data connection at probe
HID: steam: Fix input device disappearing
atm: eni: fix uninitialized variable warning
stmmac: debugfs entry name is not be changed when udev rename device name.
drm/amd/display: Reduce HDMI pixel encoding if max clock is exceeded
iommu/dma: fix variable 'cookie' set but not used
gpio: max77620: Add missing dependency on GPIOLIB_IRQCHIP
net: wan: sdla: Fix cast from pointer to integer of different size
drivers/net/b44: Change to non-atomic bit operations on pwol_mask
net: Google gve: Remove dma_wmb() before ringing doorbell
spi: spi-dw: Add lock protect dw_spi rx/tx to prevent concurrent calls
can: tcan4x5x: tcan4x5x_parse_config(): reset device before register access
usb: musb: jz4740: Silence error if code is -EPROBE_DEFER
watchdog: orion: fix platform_get_irq() complaints
watchdog: rn5t618_wdt: fix module aliases
watchdog: max77620_wdt: fix potential build errors
HID: intel-ish-hid: ipc: Add Tiger Lake PCI device ID
phy: cpcap-usb: Prevent USB line glitches from waking up modem
ASoC: topology: Prevent use-after-free in snd_soc_get_pcm_runtime()
ASoC: fsl_audmix: add missed pm_runtime_disable
phy: qcom-qmp: Increase PHY ready timeout
drivers/hid/hid-multitouch.c: fix a possible null pointer access.
ASoC: SOF: Intel: hda: hda-dai: fix oops on hda_link .hw_free
ASoC: SOF: fix fault at driver unload after failed probe
HID: wacom: Recognize new MobileStudio Pro PID
HID: intel-ish-hid: ipc: add CMP device id
HID: Add quirk for incorrect input length on Lenovo Y720
HID: asus: Ignore Asus vendor-page usage-code 0xff events
HID: ite: Add USB id match for Acer SW5-012 keyboard dock
HID: Add quirk for Xin-Mo Dual Controller
arc: eznps: fix allmodconfig kconfig warning
HID: multitouch: Add LG MELF0410 I2C touchscreen support
rxrpc: Fix use-after-free in rxrpc_receive_data()
net: include struct nhmsg size in nh nlmsg size
mlxsw: minimal: Fix an error handling path in 'mlxsw_m_port_create()'
udp: segment looped gso packets correctly
net: socionext: fix xdp_result initialization in netsec_process_rx
net: socionext: fix possible user-after-free in netsec_process_rx
net_sched: walk through all child classes in tc_bind_tclass()
net_sched: fix ops->bind_class() implementations
net_sched: ematch: reject invalid TCF_EM_SIMPLE
zd1211rw: fix storage endpoint lookup
rtl8xxxu: fix interface sanity check
brcmfmac: fix interface sanity check
ath9k: fix storage endpoint lookup
cifs: Fix memory allocation in __smb2_handle_cancelled_cmd()
cifs: set correct max-buffer-size for smb2_ioctl_init()
CIFS: Fix task struct use-after-free on reconnect
crypto: chelsio - fix writing tfm flags to wrong place
driver core: Fix test_async_driver_probe if NUMA is disabled
iio: st_gyro: Correct data for LSM9DS0 gyro
iio: adc: stm32-dfsdm: fix single conversion
mei: me: add comet point (lake) H device ids
mei: hdcp: bind only with i915 on the same PCH
binder: fix log spam for existing debugfs file creation.
component: do not dereference opaque pointer in debugfs
debugfs: Return -EPERM when locked down
serial: imx: fix a race condition in receive path
serial: 8250_bcm2835aux: Fix line mismatch on driver unbind
staging: vt6656: Fix false Tx excessive retries reporting.
staging: vt6656: use NULLFUCTION stack on mac80211
staging: vt6656: correct packet types for CTS protect, mode.
staging: wlan-ng: ensure error return is actually returned
staging: most: net: fix buffer overflow
usb: typec: fusb302: fix "op-sink-microwatt" default that was in mW
usb: typec: wcove: fix "op-sink-microwatt" default that was in mW
usb: dwc3: turn off VBUS when leaving host mode
USB: serial: ir-usb: fix IrLAP framing
USB: serial: ir-usb: fix link-speed handling
USB: serial: ir-usb: add missing endpoint sanity check
usb: host: xhci-tegra: set MODULE_FIRMWARE for tegra186
usb: dwc3: pci: add ID for the Intel Comet Lake -V variant
rsi_91x_usb: fix interface sanity check
orinoco_usb: fix interface sanity check
Bluetooth: btusb: fix non-atomic allocation in completion handler
ANDROID: scsi: ufs: fix collision between CRYPTO and RPM_AUTOSUSPEND bits
ANDROID: gki: Removed cf modules from gki_defconfig
ANDROID: Remove default y for VIRTIO_PCI_LEGACY
ANDROID: gki_defconfig: enabled INTERCONNECT
ANDROID: gki_defconfig: Remove SND_8X0
ANDROID: gki: Fixed some typos in Kconfig.gki
ANDROID: gki_defconfig: Enable req modules in GKI
ANDROID: modularize BLK_MQ_VIRTIO
ANDROID: kallsyms: strip hashes from static functions with ThinLTO and CFI
ANDROID: Incremental fs: Remove unneeded compatibility typedef
ANDROID: Incremental fs: Enable incrementalfs in GKI
ANDROID: Incremental fs: Fix sparse errors
ANDROID: Fixing incremental fs style issues
ANDROID: Make incfs selftests pass
ANDROID: Initial commit of Incremental FS
Linux 5.4.16
net/x25: fix nonblocking connect
netfilter: nf_tables: autoload modules from the abort path
netfilter: nf_tables: add __nft_chain_type_get()
netfilter: ipset: use bitmap infrastructure completely
media: v4l2-ioctl.c: zero reserved fields for S/TRY_FMT
libertas: Fix two buffer overflows at parsing bss descriptor
net/sonic: Prevent tx watchdog timeout
net/sonic: Fix CAM initialization
net/sonic: Fix command register usage
net/sonic: Quiesce SONIC before re-initializing descriptor memory
net/sonic: Fix receive buffer replenishment
net/sonic: Improve receive descriptor status flag check
net/sonic: Avoid needless receive descriptor EOL flag updates
net/sonic: Fix receive buffer handling
net/sonic: Fix interface error stats collection
net/sonic: Use MMIO accessors
net/sonic: Clear interrupt flags immediately
net/sonic: Add mutual exclusion for accessing shared state
readdir: be more conservative with directory entry names
do_last(): fetch directory ->i_mode and ->i_uid before it's too late
net, sk_msg: Don't check if sock is locked when tearing down psock
xfrm: support output_mark for offload ESP packets
drm/i915/userptr: fix size calculation
iwlwifi: mvm: fix potential SKB leak on TXQ TX
iwlwifi: mvm: fix SKB leak on invalid queue
tracing: xen: Ordered comparison of function pointers
scsi: RDMA/isert: Fix a recently introduced regression related to logout
hwmon: (nct7802) Fix non-working alarm on voltages
hwmon: (nct7802) Fix voltage limits to wrong registers
hsr: Fix a compilation error
leds: gpio: Fix uninitialized gpio label for fwnode based probe
readdir: make user_access_begin() use the real access range
iommu/amd: Fix IOMMU perf counter clobbering during init
lib: Reduce user_access_begin() boundaries in strncpy_from_user() and strnlen_user()
netfilter: nft_osf: add missing check for DREG attribute
Input: sun4i-ts - add a check for devm_thermal_zone_of_sensor_register
Input: pegasus_notetaker - fix endpoint sanity check
Input: aiptek - fix endpoint sanity check
Input: gtco - fix endpoint sanity check
Input: sur40 - fix interface sanity checks
Input: pm8xxx-vib - fix handling of separate enable register
net/tls: fix async operation
mlxsw: switchx2: Do not modify cloned SKBs during xmit
mmc: sdhci_am654: Reset Command and Data line after tuning
mmc: sdhci_am654: Remove Inverted Write Protect flag
mmc: sdhci: fix minimum clock rate for v3 controller
mmc: tegra: fix SDR50 tuning override
ARM: 8950/1: ftrace/recordmcount: filter relocation types
Revert "Input: synaptics-rmi4 - don't increment rmiaddr for SMBus transfers"
Input: keyspan-remote - fix control-message timeouts
iommu/vt-d: Call __dmar_remove_one_dev_info with valid pointer
pinctrl: sunrisepoint: Add missing Interrupt Status register offset
XArray: Fix xas_find returning too many entries
XArray: Fix xa_find_after with multi-index entries
XArray: Fix infinite loop with entry at ULONG_MAX
iwlwifi: mvm: don't send the IWL_MVM_RXQ_NSSN_SYNC notif to Rx queues
Revert "iwlwifi: mvm: fix scan config command size"
powerpc/xive: Discard ESB load value when interrupt is invalid
powerpc/mm/hash: Fix sharing context ids between kernel & userspace
tracing: Fix histogram code when expression has same var as value
tracing: Do not set trace clock if tracefs lockdown is in effect
tracing/uprobe: Fix double perf_event linking on multiprobe uprobe
tracing: trigger: Replace unneeded RCU-list traversals
PM: hibernate: fix crashes with init_on_free=1
drm/i915: Align engine->uabi_class/instance with i915_drm.h
drm/panfrost: Add the panfrost_gem_mapping concept
PCI: Mark AMD Navi14 GPU rev 0xc5 ATS as broken
ceph: hold extra reference to r_parent over life of request
hwmon: (core) Do not use device managed functions for memory allocations
hwmon: (adt7475) Make volt2reg return same reg as reg2volt input
afs: Fix characters allowed into cell names
Revert "io_uring: only allow submit from owning task"
ipv4: Detect rollover in specific fib table dump
net/mlx5e: kTLS, Do not send decrypted-marked SKBs via non-accel path
net/mlx5e: kTLS, Remove redundant posts in TX resync flow
net/mlx5e: kTLS, Fix corner-case checks in TX resync flow
net/mlx5: DR, use non preemptible call to get the current cpu number
net/mlx5: E-Switch, Prevent ingress rate configuration of uplink rep
net/mlx5: DR, Enable counter on non-fwd-dest objects
net/mlx5: Update the list of the PCI supported devices
net/mlx5: Fix lowest FDB pool size
net: Fix packet reordering caused by GRO and listified RX cooperation
fou: Fix IPv6 netlink policy
mlxsw: spectrum_acl: Fix use-after-free during reload
airo: Add missing CAP_NET_ADMIN check in AIROOLDIOCTL/SIOCDEVPRIVATE
airo: Fix possible info leak in AIROOLDIOCTL/SIOCDEVPRIVATE
tun: add mutex_unlock() call and napi.skb clearing in tun_get_user()
tcp: do not leave dangling pointers in tp->highest_sack
tcp_bbr: improve arithmetic division in bbr_update_bw()
Revert "udp: do rmem bulk free even if the rx sk queue is empty"
net: usb: lan78xx: Add .ndo_features_check
net-sysfs: Fix reference count leak
net_sched: use validated TCA_KIND attribute in tc_new_tfilter()
net_sched: fix datalen for ematch
net: rtnetlink: validate IFLA_MTU attribute in rtnl_create_link()
net, ip_tunnel: fix namespaces move
net, ip6_tunnel: fix namespaces move
net: ip6_gre: fix moving ip6gre between namespaces
net: cxgb3_main: Add CAP_NET_ADMIN check to CHELSIO_GET_MEM
net: bcmgenet: Use netif_tx_napi_add() for TX NAPI
ipv6: sr: remove SKB_GSO_IPXIP6 on End.D* actions
gtp: make sure only SOCK_DGRAM UDP sockets are accepted
firestream: fix memory leaks
can, slip: Protect tty->disc_data in write_wakeup and close with RCU
ANDROID: gki_defconfig: Set IKHEADERS back to =y
ANDROID: gki_defconfig: Enable CONFIG_BTT
f2fs: fix race conditions in ->d_compare() and ->d_hash()
f2fs: fix dcache lookup of !casefolded directories
f2fs: Add f2fs stats to sysfs
f2fs: delete duplicate information on sysfs nodes
f2fs: change to use rwsem for gc_mutex
f2fs: update f2fs document regarding to fsync_mode
f2fs: add a way to turn off ipu bio cache
f2fs: code cleanup for f2fs_statfs_project()
f2fs: fix miscounted block limit in f2fs_statfs_project()
f2fs: show the CP_PAUSE reason in checkpoint traces
f2fs: fix deadlock allocating bio_post_read_ctx from mempool
f2fs: remove unneeded check for error allocating bio_post_read_ctx
f2fs: convert inline_dir early before starting rename
f2fs: fix memleak of kobject
f2fs: fix to add swap extent correctly
f2fs: run fsck when getting bad inode during GC
f2fs: support data compression
f2fs: free sysfs kobject
f2fs: declare nested quota_sem and remove unnecessary sems
f2fs: don't put new_page twice in f2fs_rename
f2fs: set I_LINKABLE early to avoid wrong access by vfs
f2fs: don't keep META_MAPPING pages used for moving verity file blocks
f2fs: introduce private bioset
f2fs: cleanup duplicate stats for atomic files
f2fs: Check write pointer consistency of non-open zones
f2fs: Check write pointer consistency of open zones
f2fs: set GFP_NOFS when moving inline dentries
f2fs: should avoid recursive filesystem ops
f2fs: keep quota data on write_begin failure
f2fs: call f2fs_balance_fs outside of locked page
f2fs: preallocate DIO blocks when forcing buffered_io
FROMGIT: ext4: Add EXT4_IOC_FSGETXATTR/EXT4_IOC_FSSETXATTR to compat_ioctl.
ANDROID: gki_defconfig: Set IKHEADERS back to =m
ANDROID: gki_defconfig: enable NVDIMM/PMEM options
Linux 5.4.15
optee: Fix multi page dynamic shm pool alloc
phy/rockchip: inno-hdmi: round clock rate down to closest 1000 Hz
gpio: aspeed: avoid return type warning
net-sysfs: Call dev_hold always in netdev_queue_add_kobject
s390/qeth: fix dangling IO buffers after halt/clear
block: fix memleak of bio integrity data
platform/chrome: wilco_ec: fix use after free issue
xdp: Fix cleanup on map free for devmap_hash map type
drm/radeon: fix bad DMA from INTERRUPT_CNTL2
dmaengine: ti: edma: fix missed failure handling
afs: Remove set but not used variables 'before', 'after'
dma-direct: don't check swiotlb=force in dma_direct_map_resource
mt76: mt76u: rely on usb_interface instead of usb_dev
sched/cpufreq: Move the cfs_rq_util_change() call to cpufreq_update_util()
SUNRPC: Fix another issue with MIC buffer space
workqueue: Add RCU annotation for pwq list walk
tee: optee: fix device enumeration error handling
tee: optee: Fix dynamic shm pool allocations
mmc: core: fix wl1251 sdio quirks
mmc: sdio: fix wl1251 vendor id
firmware: arm_scmi: Fix doorbell ring logic for !CONFIG_64BIT
kselftests: cgroup: Avoid the reuse of fd after it is deallocated
i2c: stm32f7: report dma error during probe
packet: fix data-race in fanout_flow_is_huge()
rtc: bd70528: fix module alias to autoload module
selftests: gen_kselftest_tar.sh: Do not clobber kselftest/
net: axienet: Fix error return code in axienet_probe()
net: neigh: use long type to store jiffies delta
rt2800: remove errornous duplicate condition
hv_netvsc: flag software created hash value
net: openvswitch: don't unlock mutex when changing the user_features fails
scsi: ufs: delete redundant function ufshcd_def_desc_sizes()
dpaa_eth: avoid timestamp read on error paths
dpaa_eth: perform DMA unmapping before read
rcu: Fix uninitialized variable in nocb_gp_wait()
libbpf: Don't use kernel-side u32 type in xsk.c
firmware: imx: Remove call to devm_of_platform_populate
power: supply: bd70528: Add MODULE_ALIAS to allow module auto loading
drm/amdgpu/vi: silence an uninitialized variable warning
regulator: bd70528: Add MODULE_ALIAS to allow module auto loading
pwm: sun4i: Fix incorrect calculation of duty_cycle/period
ACPI: platform: Unregister stale platform devices
net: netsec: Correct dma sync for XDP_TX frames
drm: rcar_lvds: Fix color mismatches on R-Car H2 ES2.0 and later
PCI: mobiveil: Fix csr_read()/write() build issue
software node: Get reference to parent swnode in get_parent op
drm/rockchip: Round up _before_ giving to the clock framework
dpaa2-eth: Fix minor bug in ethtool stats reporting
hwrng: omap3-rom - Fix missing clock by probing with device tree
drm/amdgpu: remove excess function parameter description
drm: panel-lvds: Potential Oops in probe error handling
drm/panfrost: Add missing check for pfdev->regulator
rtw88: fix error handling when setup efuse info
rtw88: fix beaconing mode rsvd_page memory violation issue
gpiolib: No need to call gpiochip_remove_pin_ranges() twice
sched/core: Further clarify sched_class::set_next_task()
ipmi: Fix memory leak in __ipmi_bmc_register
watchdog: sprd: Fix the incorrect pointer getting from driver data
soc: aspeed: Fix snoop_file_poll()'s return type
soc: renesas: Add missing check for non-zero product register address
soc: qcom: llcc: Name regmaps to avoid collisions
soc/tegra: pmc: Fix crashes for hierarchical interrupts
leds: tlc591xx: update the maximum brightness
perf map: No need to adjust the long name of modules
crypto: sun4i-ss - fix big endian issues
crypto: amcc - restore CRYPTO_AES dependency
nfsd: depend on CRYPTO_MD5 for legacy client tracking
s390/pkey: fix memory leak within _copy_apqns_from_user()
ice: fix stack leakage
mt7601u: fix bbp version check in mt7601u_wait_bbp_ready
mt76: mt76u: fix endpoint definition order
phy: ti: gmii-sel: fix mac tx internal delay for rgmii-rxid
net: phy: broadcom: Fix RGMII delays configuration for BCM54210E
phy: lantiq: vrx200-pcie: fix error return code in ltq_vrx200_pcie_phy_power_on()
net/mlx5e: Fix free peer_flow when refcount is 0
tipc: fix wrong timeout input for tipc_wait_for_cond()
tipc: fix wrong socket reference counter after tipc_sk_timeout() returns
tipc: fix potential memory leak in __tipc_sendmsg()
tipc: update mon's self addr when node addr generated
tipc: reduce sensitive to retransmit failures
powerpc/archrandom: fix arch_get_random_seed_int()
powerpc/kasan: Fix boot failure with RELOCATABLE && FSL_BOOKE
powerpc/pseries: Enable support for ibm,drc-info property
powerpc/security: Fix debugfs data leak on 32-bit
SUNRPC: Fix backchannel latency metrics
SUNRPC: Fix svcauth_gss_proxy_init()
mfd: intel-lpss: Add default I2C device properties for Gemini Lake
i2c: i2c-stm32f7: fix 10-bits check in slave free id search loop
i2c: stm32f7: rework slave_id allocation
xfs: Sanity check flags of Q_XQUOTARM call
ARM: OMAP2+: Add missing put_device() call in omapdss_init_of()
ARM: dts: logicpd-torpedo-37xx-devkit-28: Reference new DRM panel
samples/bpf: Fix broken xdp_rxq_info due to map order assumptions
samples: bpf: update map definition to new syntax BTF-defined map
bpf: Force .BTF section start to zero when dumping from vmlinux
libbpf: Make btf__resolve_size logic always check size error condition
libbpf: Fix another potential overflow issue in bpf_prog_linfo
libbpf: Fix potential overflow issue
libbpf: Fix memory leak/double free issue
libbpf: Fix compatibility for kernels without need_wakeup
drm/i915: Fix pid leak with banned clients
ANDROID: update ABI following inline crypto changes
ANDROID: gki_defconfig: enable dm-default-key
ANDROID: dm: add dm-default-key target for metadata encryption
ANDROID: dm: enable may_passthrough_inline_crypto on some targets
ANDROID: dm: add support for passing through inline crypto support
ANDROID: block: Introduce passthrough keyslot manager
ANDROID: ext4, f2fs: enable direct I/O with inline encryption
FROMLIST: scsi: ufs: add program_key() variant op
ANDROID: block: export symbols needed for modules to use inline crypto
ANDROID: block: fix some inline crypto bugs
UPSTREAM: mm/page_io.c: annotate refault stalls from swap_readpage
FROMLIST: security: selinux: allow per-file labelling for binderfs
Revert "ANDROID: security,perf: Allow further restriction of perf_event_open"
ANDROID: selinux: modify RTM_GETLINK permission
BACKPORT: tracing: Remove unnecessary DEBUG_FS dependency
BACKPORT: debugfs: Fix !DEBUG_FS debugfs_create_automount
Linux 5.4.14
scsi: lpfc: use hdwq assigned cpu for allocation
perf script: Fix --reltime with --time
hwmon: (pmbus/ibm-cffps) Fix LED blink behavior
hwmon: (pmbus/ibm-cffps) Switch LEDs to blocking brightness call
regulator: ab8500: Remove SYSCLKREQ from enum ab8505_regulator_id
clk: imx7ulp: Correct DDR clock mux options
clk: imx7ulp: Correct system clock source option #7
clk: sprd: Use IS_ERR() to validate the return value of syscon_regmap_lookup_by_phandle()
perf script: Allow --time with --reltime
perf probe: Fix wrong address verification
rtw88: fix potential read outside array boundary
scsi: lpfc: Fix a kernel warning triggered by lpfc_get_sgl_per_hdwq()
scsi: lpfc: Fix hdwq sgl locks and irq handling
scsi: lpfc: Fix list corruption detected in lpfc_put_sgl_per_hdwq
scsi: core: scsi_trace: Use get_unaligned_be*()
scsi: qla2xxx: fix rports not being mark as lost in sync fabric scan
scsi: qla2xxx: Fix qla2x00_request_irqs() for MSI
scsi: scsi_transport_sas: Fix memory leak when removing devices
scsi: hisi_sas: Return directly if init hardware failed
scsi: lpfc: fix: Coverity: lpfc_get_scsi_buf_s3(): Null pointer dereferences
scsi: target: core: Fix a pr_debug() argument
scsi: bnx2i: fix potential use after free
scsi: qla4xxx: fix double free bug
scsi: hisi_sas: Set the BIST init value before enabling BIST
scsi: hisi_sas: Don't create debugfs dump folder twice
scsi: esas2r: unlock on error in esas2r_nvram_read_direct()
reiserfs: fix handling of -EOPNOTSUPP in reiserfs_for_each_xattr
um: virtio_uml: Disallow modular build
um: Don't trace irqflags during shutdown
mtd: cfi_cmdset_0002: fix delayed error detection on HyperFlash
mtd: cfi_cmdset_0002: only check errors when ready in cfi_check_err_status()
mtd: devices: fix mchp23k256 read and write
Revert "arm64: dts: juno: add dma-ranges property"
ARM: dts: Fix sgx sysconfig register for omap4
arm64: dts: juno: Fix UART frequency
ARM: dts: dra7: fix cpsw mdio fck clock
arm64: dts: allwinner: a64: Re-add PMU node
ARM: dts: imx6ul-kontron-n6310-s: Disable the snvs-poweroff driver
arm64: dts: qcom: sdm845-cheza: delete zap-shader
arm64: dts: imx8mm-evk: Assigned clocks for audio plls
arm64: dts: renesas: r8a774a1: Remove audio port node
arm64: dts: marvell: Fix CP110 NAND controller node multi-line comment alignment
tick/sched: Annotate lockless access to last_jiffies_update
cfg80211: check for set_wiphy_params
arm64: dts: marvell: Add AP806-dual missing CPU clocks
arm64: dts: renesas: r8a77970: Fix PWM3
arm64: dts: meson-gxl-s905x-khadas-vim: fix gpio-keys-polled node
arm64: dts: meson: g12: fix audio fifo reg size
arm64: dts: meson: axg: fix audio fifo reg size
cw1200: Fix a signedness bug in cw1200_load_firmware()
arm64: dts: qcom: msm8998: Disable coresight by default
irqchip: Place CONFIG_SIFIVE_PLIC into the menu
tcp: refine rule to allow EPOLLOUT generation under mem pressure
dt-bindings: Add missing 'properties' keyword enclosing 'snps,tso'
xen/blkfront: Adjust indentation in xlvbd_alloc_gendisk
devlink: Wait longer before warning about unset port type
net: stmmac: tc: Do not setup flower filtering if RSS is enabled
net: stmmac: selftests: Update status when disabling RSS
selftests: mlxsw: qos_mc_aware: Fix mausezahn invocation
net: stmmac: selftests: Mark as fail when received VLAN ID != expected
net: stmmac: selftests: Make it work in Synopsys AXS101 boards
mlxsw: spectrum_qdisc: Include MC TCs in Qdisc counters
mlxsw: spectrum: Wipe xstats.backlog of down ports
mlxsw: spectrum: Do not modify cloned SKBs during xmit
sh_eth: check sh_eth_cpu_data::dual_port when dumping registers
drm/amdgpu: allow direct upload save restore list for raven2
i40e: prevent memory leak in i40e_setup_macvlans
net: dsa: bcm_sf2: Configure IMP port for 2Gb/sec
net: sched: act_ctinfo: fix memory leak
net: dsa: tag_gswip: fix typo in tagger name
net: dsa: sja1105: Don't error out on disabled ports with no phy-mode
net: systemport: Fixed queue mapping in internal ring map
net: ethernet: ave: Avoid lockdep warning
bnxt_en: Do not treat DSN (Digital Serial Number) read failure as fatal.
bnxt_en: Fix ipv6 RFS filter matching logic.
bnxt_en: Fix NTUPLE firmware command failures.
tcp: fix marked lost packets not being retransmitted
r8152: add missing endpoint sanity check
ptp: free ptp device pin descriptors properly
net/wan/fsl_ucc_hdlc: fix out of bounds write on array utdm_info
net: usb: lan78xx: limit size of local TSO packets
net/sched: act_ife: initalize ife->metalist earlier
net: phy: dp83867: Set FORCE_LINK_GOOD to default after reset
net: hns: fix soft lockup when there is not enough memory
net: hns3: pad the short frame before sending to the hardware
net: dsa: tag_qca: fix doubled Tx statistics
net: avoid updating qdisc_xmit_lock_key in netdev_update_lockdep_key()
hv_netvsc: Fix memory leak when removing rndis device
macvlan: use skb_reset_mac_header() in macvlan_queue_xmit()
batman-adv: Fix DAT candidate selection on little endian systems
bpftool: Fix printing incorrect pointer in btf_dump_ptr
net: bpf: Don't leak time wait and request sockets
NFC: pn533: fix bulk-message timeout
netfilter: nf_tables: fix flowtable list del corruption
netfilter: nf_tables: store transaction list locally while requesting module
netfilter: nf_tables: remove WARN and add NLA_STRING upper limits
netfilter: nft_tunnel: ERSPAN_VERSION must not be null
netfilter: nft_tunnel: fix null-attribute check
netfilter: nat: fix ICMP header corruption on ICMP errors
netfilter: arp_tables: init netns pointer in xt_tgdtor_param struct
netfilter: fix a use-after-free in mtype_destroy()
i2c: iop3xx: Fix memory leak in probe error path
bpf/sockmap: Read psock ingress_msg before sk_receive_queue
cfg80211: fix page refcount issue in A-MSDU decap
cfg80211: fix memory leak in cfg80211_cqm_rssi_update
cfg80211: fix memory leak in nl80211_probe_mesh_link
cfg80211: fix deadlocks in autodisconnect work
i2c: tegra: Properly disable runtime PM on driver's probe error
i2c: tegra: Fix suspending in active runtime PM state
bpf: Sockmap/tls, fix pop data with SK_DROP return code
bpf: Sockmap/tls, skmsg can have wrapped skmsg that needs extra chaining
bpf: Sockmap/tls, tls_sw can create a plaintext buf > encrypt buf
bpf: Sockmap/tls, msg_push_data may leave end mark in place
bpf: Sockmap, skmsg helper overestimates push, pull, and pop bounds
bpf: Sockmap/tls, push write_space updates through ulp updates
bpf: Sockmap, ensure sock lock held during tear down
bpf: Sockmap/tls, during free we may call tcp_bpf_unhash() in loop
bpf: Fix incorrect verifier simulation of ARSH under ALU32
drm/amd/display: Reorder detect_edp_sink_caps before link settings read.
block: Fix the type of 'sts' in bsg_queue_rq()
net: fix kernel-doc warning in <linux/netdevice.h>
tipc: fix retrans failure due to wrong destination
tipc: fix potential hanging after b/rcast changing
reset: Fix {of,devm}_reset_control_array_get kerneldoc return types
net: stmmac: Enable 16KB buffer size
net: stmmac: 16KB buffer must be 16 byte aligned
ARM: dts: imx7: Fix Toradex Colibri iMX7S 256MB NAND flash support
ARM: dts: imx6q-icore-mipi: Use 1.5 version of i.Core MX6DL
ARM: dts: imx6sll-evk: Remove incorrect power supply assignment
ARM: dts: imx6sl-evk: Remove incorrect power supply assignment
ARM: dts: imx6sx-sdb: Remove incorrect power supply assignment
ARM: dts: imx6qdl-sabresd: Remove incorrect power supply assignment
mm: khugepaged: add trace status description for SCAN_PAGE_HAS_PRIVATE
mm/page-writeback.c: avoid potential division by zero in wb_min_max_ratio()
mm/memory_hotplug: don't free usage map when removing a re-added early section
Btrfs: always copy scrub arguments back to user space
btrfs: check rw_devices, not num_devices for balance
btrfs: fix memory leak in qgroup accounting
btrfs: relocation: fix reloc_root lifespan and access
btrfs: do not delete mismatched root refs
btrfs: fix invalid removal of root ref
btrfs: rework arguments of btrfs_unlink_subvol
mm, debug_pagealloc: don't rely on static keys too early
mm: memcg/slab: call flush_memcg_workqueue() only if memcg workqueue is valid
mm: memcg/slab: fix percpu slab vmstats flushing
mm/huge_memory.c: thp: fix conflict of above-47bit hint address and PMD alignment
mm/shmem.c: thp, shmem: fix conflict of above-47bit hint address and PMD alignment
perf report: Fix incorrectly added dimensions as switch perf data file
locking/lockdep: Fix buffer overrun problem in stack_trace[]
perf hists: Fix variable name's inconsistency in hists__for_each() macro
clk: samsung: exynos5420: Keep top G3D clocks enabled
s390/setup: Fix secure ipl message
efi/earlycon: Fix write-combine mapping on x86
x86/resctrl: Fix potential memory leak
drm/i915: Add missing include file <linux/math64.h>
mtd: spi-nor: Fix selection of 4-byte addressing opcodes on Spansion
scsi: storvsc: Correctly set number of hardware queues for IDE disk
s390/zcrypt: Fix CCA cipher key gen with clear key value function
x86/efistub: Disable paging at mixed mode entry
perf/x86/intel/uncore: Fix missing marker for snr_uncore_imc_freerunning_events
locking/rwsem: Fix kernel crash when spinning on RWSEM_OWNER_UNKNOWN
x86/CPU/AMD: Ensure clearing of SME/SEV features is maintained
x86/resctrl: Fix an imbalance in domain_remove_cpu()
cpu/SMT: Fix x86 link error without CONFIG_SYSFS
usb: core: hub: Improved device recognition on remote wakeup
mtd: rawnand: gpmi: Restore nfc timing setup after suspend/resume
mtd: rawnand: gpmi: Fix suspend/resume problem
ptrace: reintroduce usage of subjective credentials in ptrace_has_cap()
scsi: mptfusion: Fix double fetch bug in ioctl
scsi: fnic: fix invalid stack access
staging: comedi: ni_routes: allow partial routing information
staging: comedi: ni_routes: fix null dereference in ni_find_route_source()
USB: serial: quatech2: handle unbound ports
USB: serial: keyspan: handle unbound ports
USB: serial: io_edgeport: add missing active-port sanity check
USB: serial: io_edgeport: handle unbound ports on URB completion
USB: serial: ch341: handle unbound port at reset_resume
USB: serial: suppress driver bind attributes
USB: serial: option: add support for Quectel RM500Q in QDL mode
USB: serial: opticon: fix control-message timeouts
USB: serial: option: Add support for Quectel RM500Q
USB: serial: simple: Add Motorola Solutions TETRA MTP3xxx and MTP85xx
iio: buffer: align the size of scan bytes to size of the largest element
iio: chemical: pms7003: fix unmet triggered buffer dependency
iio: light: vcnl4000: Fix scale for vcnl4040
iio: imu: st_lsm6dsx: Fix selection of ST_LSM6DS3_ID
iio: adc: ad7124: Fix DT channel configuration
perf: Correctly handle failed perf_get_aux_event()
ARM: davinci: select CONFIG_RESET_CONTROLLER
ARM: dts: am571x-idk: Fix gpios property to have the correct gpio number
cpuidle: teo: Fix intervals[] array indexing bug
io_uring: only allow submit from owning task
fuse: fix fuse_send_readpages() in the syncronous read case
block: fix an integer overflow in logical block size
clk: sunxi-ng: r40: Allow setting parent rate for external clock outputs
Fix built-in early-load Intel microcode alignment
arm64: dts: agilex/stratix10: fix pmu interrupt numbers
arm64: dts: allwinner: a64: olinuxino: Fix eMMC supply regulator
arm64: dts: allwinner: a64: olinuxino: Fix SDIO supply regulator
ALSA: usb-audio: fix sync-ep altsetting sanity check
ALSA: firewire-tascam: fix corruption due to spin lock without restoration in SoftIRQ context
ALSA: seq: Fix racy access for queue timer in proc read
ALSA: dice: fix fallback from protocol extension into limited functionality
ASoC: Intel: bytcht_es8316: Fix Irbis NB41 netbook quirk
ARM: dts: imx6q-dhcom: Fix SGTL5000 VDDIO regulator connection
ARM: dts: imx7ulp: fix reg of cpu node
ARM: OMAP2+: Fix ti_sysc_find_one_clockdomain to check for to_clk_hw_omap
ASoC: msm8916-wcd-analog: Fix MIC BIAS Internal1
ASoC: msm8916-wcd-analog: Fix selected events for MIC BIAS External1
ASoC: stm32: dfsdm: fix 16 bits record
ASoC: stm32: sai: fix possible circular locking
ASoC: msm8916-wcd-digital: Reset RX interpolation path after use
arm64: dts: imx8mq-librem5-devkit: use correct interrupt for the magnetometer
Revert "gpio: thunderx: Switch to GPIOLIB_IRQCHIP"
clk: Don't try to enable critical clocks if prepare failed
bus: ti-sysc: Fix iterating over clocks
arm64: dts: imx8mm: Change SDMA1 ahb clock for imx8mm
arm64: dts: ls1028a: fix endian setting for dcfg
ARM: dts: imx6q-dhcom: fix rtc compatible
dt-bindings: reset: meson8b: fix duplicate reset IDs
soc: amlogic: meson-ee-pwrc: propagate errors from pm_genpd_init()
soc: amlogic: meson-ee-pwrc: propagate PD provider registration errors
clk: qcom: gcc-sdm845: Add missing flag to votable GDSCs
ARM: dts: meson8: fix the size of the PMU registers
ANDROID: gki: Make GKI specific modules builtins
ANDROID: virtio-net: Skip set_features on non-cvq devices
ANDROID: fscrypt: add support for hardware-wrapped keys
ANDROID: block: add KSM op to derive software secret from wrapped key
ANDROID: block: provide key size as input to inline crypto APIs
ANDROID: ufshcd-crypto: export cap find API
ANDROID: build config for cuttlefish ramdisk
ANDROID: x86: gki_defconfig: enable LTO and CFI
ANDROID: x86: map CFI jump tables in pti_clone_entry_text
ANDROID: x86, module: Ignore __typeid__ relocations
ANDROID: x86, relocs: Ignore __typeid__ relocations
ANDROID: x86/alternatives: Use C int3 selftest but disable KASAN
ANDROID: x86/extable: Do not mark exception callback as CFI
ANDROID: x86, build: allow LTO_CLANG and THINLTO to be selected
ANDROID: x86: disable UNWINDER_ORC with LTO_CLANG
ANDROID: x86: disable STACK_VALIDATION with LTO_CLANG
ANDROID: x86: disable HAVE_ARCH_PREL32_RELOCATIONS with LTO_CLANG
ANDROID: x86/vdso: disable LTO only for VDSO
FROMLIST: crypto, x86/sha: Eliminate casts on asm implementations
UPSTREAM: x86/vmlinux: Actually use _etext for the end of the text segment
Linux 5.4.13
ocfs2: call journal flush to mark journal as empty after journal recovery when mount
hexagon: work around compiler crash
hexagon: parenthesize registers in asm predicates
kbuild/deb-pkg: annotate libelf-dev dependency as :native
media: intel-ipu3: Align struct ipu3_uapi_awb_fr_config_s to 32 bytes
drm/amdgpu: enable gfxoff for raven1 refresh
ioat: ioat_alloc_ring() failure handling.
s390/qeth: lock the card while changing its hsuid
dmaengine: k3dma: Avoid null pointer traversal
rxrpc: Fix missing security check on incoming calls
rxrpc: Don't take call->user_mutex in rxrpc_new_incoming_call()
rxrpc: Unlock new call in rxrpc_new_incoming_call() rather than the caller
drm/arm/mali: make malidp_mw_connector_helper_funcs static
MIPS: Prevent link failure with kcov instrumentation
tomoyo: Suppress RCU warning at list_for_each_entry_rcu().
mips: Fix gettimeofday() in the vdso library
mips: cacheinfo: report shared CPU map
riscv: export flush_icache_all to modules
rseq/selftests: Turn off timeout setting
selftests: firmware: Fix it to do root uid check and skip
scsi: target/iblock: Fix protection error with blocks greater than 512B
scsi: libcxgbi: fix NULL pointer dereference in cxgbi_device_destroy()
gpio: mpc8xxx: Add platform device to gpiochip->parent
rtc: bd70528: Add MODULE ALIAS to autoload module
rtc: brcmstb-waketimer: add missed clk_disable_unprepare
rtc: msm6242: Fix reading of 10-hour digit
NFSD fixing possible null pointer derefering in copy offload
f2fs: fix potential overflow
sch_cake: Add missing NLA policy entry TCA_CAKE_SPLIT_GSO
iwlwifi: mvm: fix support for single antenna diversity
rtlwifi: Remove unnecessary NULL check in rtl_regd_init
iwlwifi: mvm: consider ieee80211 station max amsdu value
spi: lpspi: fix memory leak in fsl_lpspi_probe
spi: rspi: Use platform_get_irq_byname_optional() for optional irqs
spi: atmel: fix handling of cs_change set on non-last xfer
spi: pxa2xx: Set controller->max_transfer_size in dma mode
mtd: spi-nor: fix silent truncation in spi_nor_read_raw()
mtd: spi-nor: fix silent truncation in spi_nor_read()
spi: sprd: Fix the incorrect SPI register
ubifs: do_kill_orphans: Fix a memory leak bug
ubifs: Fixed missed le64_to_cpu() in journal
Revert "ubifs: Fix memory leak bug in alloc_ubifs_info() error path"
memory: mtk-smi: Add PM suspend and resume ops
iommu/mediatek: Add a new tlb_lock for tlb_flush
iommu/mediatek: Correct the flush_iotlb_all callback
media: hantro: Set H264 FIELDPIC_FLAG_E flag correctly
media: aspeed-video: Fix memory leaks in aspeed_video_probe
media: hantro: Do not reorder H264 scaling list
media: cedrus: Use correct H264 8x8 scaling list
media: coda: fix deadlock between decoder picture run and start command
media: exynos4-is: Fix recursive locking in isp_video_release()
media: v4l: cadence: Fix how unsued lanes are handled in 'csi2rx_start()'
media: hantro: h264: Fix the frame_num wraparound case
media: rcar-vin: Fix incorrect return statement in rvin_try_format()
media: ov6650: Fix default format not applied on device probe
media: ov6650: Fix .get_fmt() V4L2_SUBDEV_FORMAT_TRY support
media: ov6650: Fix some format attributes not under control
media: ov6650: Fix incorrect use of JPEG colorspace
ARM: 8943/1: Fix topology setup in case of CPU hotplug for CONFIG_SCHED_MC
tty: serial: pch_uart: correct usage of dma_unmap_sg
tty: serial: imx: use the sg count from dma_map_sg
MIPS: SGI-IP27: Fix crash, when CPUs are disabled via nr_cpus parameter
MIPS: Loongson: Fix return value of loongson_hwmon_init
MIPS: PCI: remember nasid changed by set interrupt affinity
powerpc/powernv: Disable native PCIe port management
PCI/PTM: Remove spurious "d" from granularity message
tools: PCI: Fix fd leakage
PCI/PM: Clear PCIe PME Status even for legacy power management
PCI: Fix missing bridge dma_ranges resource list cleanup
PCI: dwc: Fix find_next_bit() usage
PCI: aardvark: Fix PCI_EXP_RTCTL register configuration
PCI: aardvark: Use LTSSM state to build link training flag
compat_ioctl: handle SIOCOUTQNSD
af_unix: add compat_ioctl support
gfs2: add compat_ioctl support
arm64: dts: apq8096-db820c: Increase load on l21 for SDCARD
scsi: sd: enable compat ioctls for sed-opal
drm/amdgpu/discovery: reserve discovery data at the top of VRAM
drm/amdgpu: cleanup creating BOs at fixed location (v2)
Revert "drm/virtio: switch virtio_gpu_wait_ioctl() to gem helper."
PCI: pciehp: Do not disable interrupt twice on suspend
pinctrl: lewisburg: Update pin list according to v1.1v6
pinctrl: sh-pfc: Do not use platform_get_irq() to count interrupts
pinctrl: sh-pfc: Fix PINMUX_IPSR_PHYS() to set GPSR
pinctl: ti: iodelay: fix error checking on pinctrl_count_index_with_args call
affs: fix a memory leak in affs_remount
rsi: fix potential null dereference in rsi_probe()
clk: imx: pll14xx: Fix quick switch of S/K parameter
dmaengine: dw: platform: Mark 'hclk' clock optional
clk: Fix memory leak in clk_unregister()
clk: samsung: exynos5420: Preserve CPU clocks configuration during suspend/resume
clk: meson: axg-audio: fix regmap last register
mei: fix modalias documentation
iio: imu: adis16480: assign bias value only if operation succeeded
iio: imu: st_lsm6dsx: fix gyro gain definitions for LSM9DS1
NFSv4.x: Drop the slot if nfs4_delegreturn_prepare waits for layoutreturn
NFSv4.x: Handle bad/dead sessions correctly in nfs41_sequence_process()
nfsd: v4 support requires CRYPTO_SHA256
nfsd: Fix cld_net->cn_tfm initialization
NFSv2: Fix a typo in encode_sattr()
crypto: geode-aes - convert to skcipher API and make thread-safe
crypto: algif_skcipher - Use chunksize instead of blocksize
crypto: virtio - implement missing support for output IVs
crypto: arm64/aes-neonbs - add return value of skcipher_walk_done() in __xts_crypt()
crypto: hisilicon - select NEED_SG_DMA_LENGTH in qm Kconfig
crypto: cavium/nitrox - fix firmware assignment to AE cores
scsi: ufs: Give an unique ID to each ufs-bsg
dm: add dm-clone to the documentation index
xprtrdma: Fix oops in Receive handler after device removal
xprtrdma: Fix completion wait during device removal
xprtrdma: Fix create_qp crash on device unload
Documentation/ABI: Add missed attribute for mlxreg-io sysfs interfaces
Documentation/ABI: Fix documentation inconsistency for mlxreg-io sysfs interfaces
asm-generic/nds32: don't redefine cacheflush primitives
platform/x86: GPD pocket fan: Use default values when wrong modparams are given
platform/x86: asus-wmi: Fix keyboard brightness cannot be set to 0
platform/mellanox: fix potential deadlock in the tmfifo driver
scsi: sd: Clear sdkp->protection_type if disk is reformatted without PI
scsi: enclosure: Fix stale device oops with hot replug
keys: Fix request_key() cache
afs: Fix afs_lookup() to not clobber the version on a new dentry
afs: Fix use-after-loss-of-ref
libbpf: Fix Makefile' libbpf symbol mismatch diagnostic
bpf: Support pre-2.25-binutils objcopy for vmlinux BTF
bpf: skmsg, fix potential psock NULL pointer dereference
bpf: Make use of probe_user_write in probe write helper
uaccess: Add non-pagefault user-space write function
RDMA/srpt: Report the SCSI residual to the initiator
RDMA/mlx5: Return proper error value
rdma: Remove nes ABI header
RDMA/hns: Bugfix for qpc/cqc timer configuration
RDMA/hns: Fix to support 64K page for srq
xprtrdma: Close window between waking RPC senders and posting Receives
xprtrdma: Fix MR list handling
xprtrdma: Connection becomes unstable after a reconnect
xprtrdma: Add unique trace points for posting Local Invalidate WRs
RDMA/hns: Release qp resources when failed to destroy qp
RDMA/hns: Fix build error again
RDMA/siw: Fix port number endianness in a debug message
RDMA/counter: Prevent QP counter manual binding in auto mode
RDMA/hns: Modify return value of restrack functions
RDMA/hns: remove a redundant le16_to_cpu
RDMA/hns: Prevent undefined behavior in hns_roce_set_user_sq_size()
ASoC: rsnd: fix DALIGN register for SSIU
ASoC: core: Fix compile warning with CONFIG_DEBUG_FS=n
ASoC: SOF: Intel: Broadwell: clarify mutual exclusion with legacy driver
ASoC: fsl_esai: Add spin lock to protect reset, stop and start
ASoC: simple_card_utils.h: Add missing include
ASoC: dt-bindings: mt8183: add missing update
netfilter: nft_meta: use 64-bit time arithmetic
netfilter: nf_tables_offload: release flow_rule on error from commit path
btrfs: simplify inode locking for RWF_NOWAIT
hsr: fix slab-out-of-bounds Read in hsr_debugfs_rename()
syscalls/x86: Fix function types in COND_SYSCALL
syscalls/x86: Use the correct function type for sys_ni_syscall
syscalls/x86: Use COMPAT_SYSCALL_DEFINE0 for IA32 (rt_)sigreturn
syscalls/x86: Wire up COMPAT_SYSCALL_DEFINE0
perf vendor events s390: Remove name from L1D_RO_EXCL_WRITES description
afs: Fix missing cell comparison in afs_test_super()
reset: brcmstb: Remove resource checks
dt-bindings: reset: Fix brcmstb-reset example
can: j1939: fix address claim code example
ath9k: use iowrite32 over __raw_writel
MAINTAINERS: Append missed file to the database
scsi: smartpqi: Update attribute name to `driver_version`
cifs: Adjust indentation in smb2_open_file
s390/qeth: fix initialization on old HW
s390/qeth: vnicc Fix init to default
s390/qeth: Fix vnicc_is_in_use if rx_bcast not set
s390/qeth: fix false reporting of VNIC CHAR config failure
s390/qeth: fix qdio teardown after early init error
hsr: reset network header when supervision frame is created
hsr: rename debugfs file when interface name is changed
hsr: add hsr root debugfs directory
drm/tegra: Fix ordering of cleanup code
PCI: amlogic: Fix probed clock names
PM / devfreq: tegra: Add COMMON_CLK dependency
gpio: Fix error message on out-of-range GPIO in lookup table
scsi: mpt3sas: Fix double free in attach error handling
fs: move guard_bio_eod() after bio_set_op_attrs
bpf: cgroup: prevent out-of-order release of cgroup bpf
iommu: Remove device link to group on failure
iommu/vt-d: Unlink device if failed to add to group
selftests: loopback.sh: skip this test if the driver does not support
pinctrl: meson: Fix wrong shift value when get drive-strength
gpio: zynq: Fix for bug in zynq_gpio_restore_context API
mtd: onenand: omap2: Pass correct flags for prep_dma_memcpy
ASoC: SOF: imx8: Fix dsp_box offset
netfilter: nft_flow_offload: fix underflow in flowtable reference counter
pinctrl: lochnagar: select GPIOLIB
ASoC: stm32: spdifrx: fix input pin state management
ASoC: stm32: spdifrx: fix race condition in irq handler
ASoC: stm32: spdifrx: fix inconsistent lock state
ASoC: soc-core: Set dpcm_playback / dpcm_capture
ASoC: SOF: imx8: fix memory allocation failure check on priv->pd_dev
i2c: bcm2835: Store pointer to bus clock
mtd: rawnand: stm32_fmc2: avoid to lock the CPU bus
IB/hfi1: Don't cancel unused work item
RDMA/bnxt_re: Fix Send Work Entry state check while polling completions
RDMA/bnxt_re: Avoid freeing MR resources if dereg fails
phy: mapphone-mdm6600: Fix uninitialized status value regression
rtc: mt6397: fix alarm register overwrite
HID: hidraw, uhid: Always report EPOLLOUT
FROMGIT: drivers/iommu: Initialise module 'owner' field in iommu_device_set_ops()
Revert "drm/virtio: switch virtio_gpu_wait_ioctl() to gem helper."
ANDROID: update kernel ABI for CONFIG_DUMMY
ANDROID: update ABI whitelist
UPSTREAM: dmaengine: k3dma: Avoid null pointer traversal
GKI: enable CONFIG_DUMMY=y
ANDROID: update kernel ABI for f2fs/fscrypt/other changes
ANDROID: db845c: Add build config
ANDROID: db845c: add db845c_gki.fragment
FROMLIST: usb: dwc3: gadget: Correct the logic for finding last SG entry
FROMLIST: usb: xhci: provide a debugfs hook for erasing rom
FROMLIST: usb: renesas-xhci: allow multiple firmware versions
FROMLIST: usb: renesas-xhci: Add ROM loader for uPD720201
FROMLIST: usb: renesas-xhci: Add the renesas xhci driver
FROMLIST: usb: xhci: export few functions
ANDROID: arm64: dts: db845c: Add clocks entry to display to track real clock inputs
ANDROID: arm64: dts: db845c: add Low speed expansion i2c and spi nodes
ANDROID: arm64: dts: qcom: sdm845-db845c: Bring in LT9611
ANDROID: arm64: dts: qcom: db845c: Enable PCIe controllers
ANDROID: arm64: dts: qcom: sdm845: Add second PCIe PHY and controller
ANDROID: arm64: dts: qcom: sdm845: Add first PCIe controller and PHY
ANDROID: arm64: dts/sdm845: Enable FW implemented safe sequence handler on MTP
ANDROID: drm/bridge: Introduce LT9611 DSI to HDMI bridge
FROMLIST: drm: msm: Quiet down plane errors in atomic_check
FROMLIST: reset: qcom-aoss: Allow CONFIG_RESET_QCOM_AOSS to be a tristate
FROMLIST: tty: serial: Kconfig: Allow SERIAL_QCOM_GENI_CONSOLE to be enabled if SERIAL_QCOM_GENI is a module
FROMLIST: lib/list_sort: fix function type mismatches
UPSTREAM: kcov: fix struct layout for kcov_remote_arg
docs: fs-verity: mention statx() support
f2fs: support STATX_ATTR_VERITY
ext4: support STATX_ATTR_VERITY
statx: define STATX_ATTR_VERITY
docs: fs-verity: document first supported kernel version
f2fs: add support for IV_INO_LBLK_64 encryption policies
ext4: add support for IV_INO_LBLK_64 encryption policies
fscrypt: add support for IV_INO_LBLK_64 policies
fscrypt: avoid data race on fscrypt_mode::logged_impl_name
fscrypt: zeroize fscrypt_info before freeing
fscrypt: remove struct fscrypt_ctx
fscrypt: invoke crypto API for ESSIV handling
null_blk: remove unused variable warning on !CONFIG_BLK_DEV_ZONED
block: set the zone size in blk_revalidate_disk_zones atomically
block: don't handle bio based drivers in blk_revalidate_disk_zones
null_blk: cleanup null_gendisk_register
null_blk: fix zone size paramter check
block: allocate the zone bitmaps lazily
block: replace seq_zones_bitmap with conv_zones_bitmap
block: simplify blkdev_nr_zones
block: remove the empty line at the end of blk-zoned.c
scsi: sd_zbc: Improve report zones error printout
scsi: sd_zbc: Remove set but not used variable 'buflen'
block: rework zone reporting
scsi: sd_zbc: Cleanup sd_zbc_alloc_report_buffer()
null_blk: clean up report zones
null_blk: clean up the block device operations
null_blk: return fixed zoned reads > write pointer
scsi: sd_zbc: add zone open, close, and finish support
block: Remove partition support for zoned block devices
block: Simplify report zones execution
block: cleanup the !zoned case in blk_revalidate_disk_zones
block: Enhance blk_revalidate_disk_zones()
block: add zone open, close and finish ioctl support
block: add zone open, close and finish operations
block: Simplify REQ_OP_ZONE_RESET_ALL handling
block: Remove REQ_OP_ZONE_RESET plugging
f2fs: stop GC when the victim becomes fully valid
f2fs: expose main_blkaddr in sysfs
f2fs: choose hardlimit when softlimit is larger than hardlimit in f2fs_statfs_project()
f2fs: Fix deadlock in f2fs_gc() context during atomic files handling
f2fs: show f2fs instance in printk_ratelimited
f2fs: fix potential overflow
f2fs: fix to update dir's i_pino during cross_rename
f2fs: support aligned pinned file
f2fs: avoid kernel panic on corruption test
f2fs: fix wrong description in document
f2fs: cache global IPU bio
f2fs: fix to avoid memory leakage in f2fs_listxattr
f2fs: check total_segments from devices in raw_super
f2fs: update multi-dev metadata in resize_fs
f2fs: mark recovery flag correctly in read_raw_super_block()
f2fs: fix to update time in lazytime mode
Conflicts:
Documentation/devicetree/bindings
Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml
Documentation/devicetree/bindings/net/snps,dwmac.yaml
Documentation/devicetree/bindings/reset/brcm,brcmstb-reset.txt
Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt
Makefile
block/keyslot-manager.c
drivers/clk/qcom/clk-rcg2.c
drivers/cpufreq/cpufreq.c
drivers/gpu/drm/drm_connector.c
drivers/hid/hid-quirks.c
drivers/iommu/Makefile
drivers/iommu/arm-smmu.c
drivers/iommu/iova.c
drivers/md/Kconfig
drivers/md/dm.c
drivers/scsi/ufs/ufs.h
drivers/scsi/ufs/ufs_quirks.h
drivers/scsi/ufs/ufshcd-crypto.c
drivers/scsi/ufs/unipro.h
drivers/staging/android/ion/heaps/Kconfig
drivers/staging/android/ion/heaps/Makefile
drivers/tty/serial/Kconfig
drivers/usb/dwc3/gadget.c
fs/crypto/keyring.c
fs/crypto/keysetup.c
include/linux/keyslot-manager.h
include/linux/perf_event.h
kernel/sched/fair.c
kernel/sched/rt.c
Added change 552546366a ("hugetlbfs: hugetlb_fault_mutex_hash()
cleanup") to fix build errors against mm/hugetlb.c
Extra updated files to fit properly imported content
into downstream:
arch/arm64/configs/vendor/genericarmv8-64_defconfig
arch/arm64/configs/vendor/lahaina_QGKI.config
arch/arm64/configs/vendor/lahaina_debug.config
drivers/android/binderfs.c
drivers/regulator/core.c
drivers/scsi/ufs/ufshcd-qti.c
drivers/staging/android/ion/heaps/ion_carveout_heap.c
drivers/staging/android/ion/heaps/msm_ion.c
drivers/usb/dwc3/host.c
drivers/scsi/ufs/ufshcd-crypto-qti.c
fs/hugetlbfs/inode.c
gen_headers_arm.bp
gen_headers_arm64.bp
include/linux/cpufreq.h
include/linux/hugetlb.h
include/uapi/linux/msm_ion.h
include/uapi/linux/msm_ion_ids.h
kernel/sched/cpufreq_schedutil.c
kernel/sched/fair.c
mm/hugetlb.c
mm/userfaultfd.c
Change-Id: I22295df9d7bca3fc7be9587e893cdd59128cc528
Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
3491 lines
90 KiB
C
3491 lines
90 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* linux/fs/buffer.c
|
|
*
|
|
* Copyright (C) 1991, 1992, 2002 Linus Torvalds
|
|
*/
|
|
|
|
/*
|
|
* Start bdflush() with kernel_thread not syscall - Paul Gortmaker, 12/95
|
|
*
|
|
* Removed a lot of unnecessary code and simplified things now that
|
|
* the buffer cache isn't our primary cache - Andrew Tridgell 12/96
|
|
*
|
|
* Speed up hash, lru, and free list operations. Use gfp() for allocating
|
|
* hash table, use SLAB cache for buffer heads. SMP threading. -DaveM
|
|
*
|
|
* Added 32k buffer block sizes - these are required older ARM systems. - RMK
|
|
*
|
|
* async buffer flushing, 1999 Andrea Arcangeli <andrea@suse.de>
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/sched/signal.h>
|
|
#include <linux/syscalls.h>
|
|
#include <linux/fs.h>
|
|
#include <linux/iomap.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/percpu.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/capability.h>
|
|
#include <linux/blkdev.h>
|
|
#include <linux/file.h>
|
|
#include <linux/quotaops.h>
|
|
#include <linux/highmem.h>
|
|
#include <linux/export.h>
|
|
#include <linux/backing-dev.h>
|
|
#include <linux/writeback.h>
|
|
#include <linux/hash.h>
|
|
#include <linux/suspend.h>
|
|
#include <linux/buffer_head.h>
|
|
#include <linux/task_io_accounting_ops.h>
|
|
#include <linux/bio.h>
|
|
#include <linux/cpu.h>
|
|
#include <linux/bitops.h>
|
|
#include <linux/mpage.h>
|
|
#include <linux/bit_spinlock.h>
|
|
#include <linux/pagevec.h>
|
|
#include <linux/sched/mm.h>
|
|
#include <trace/events/block.h>
|
|
#include <linux/fscrypt.h>
|
|
|
|
static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
|
|
static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
|
|
enum rw_hint hint, struct writeback_control *wbc);
|
|
|
|
#define BH_ENTRY(list) list_entry((list), struct buffer_head, b_assoc_buffers)
|
|
|
|
inline void touch_buffer(struct buffer_head *bh)
|
|
{
|
|
trace_block_touch_buffer(bh);
|
|
mark_page_accessed(bh->b_page);
|
|
}
|
|
EXPORT_SYMBOL(touch_buffer);
|
|
|
|
void __lock_buffer(struct buffer_head *bh)
|
|
{
|
|
wait_on_bit_lock_io(&bh->b_state, BH_Lock, TASK_UNINTERRUPTIBLE);
|
|
}
|
|
EXPORT_SYMBOL(__lock_buffer);
|
|
|
|
void unlock_buffer(struct buffer_head *bh)
|
|
{
|
|
clear_bit_unlock(BH_Lock, &bh->b_state);
|
|
smp_mb__after_atomic();
|
|
wake_up_bit(&bh->b_state, BH_Lock);
|
|
}
|
|
EXPORT_SYMBOL(unlock_buffer);
|
|
|
|
/*
|
|
* Returns if the page has dirty or writeback buffers. If all the buffers
|
|
* are unlocked and clean then the PageDirty information is stale. If
|
|
* any of the pages are locked, it is assumed they are locked for IO.
|
|
*/
|
|
void buffer_check_dirty_writeback(struct page *page,
|
|
bool *dirty, bool *writeback)
|
|
{
|
|
struct buffer_head *head, *bh;
|
|
*dirty = false;
|
|
*writeback = false;
|
|
|
|
BUG_ON(!PageLocked(page));
|
|
|
|
if (!page_has_buffers(page))
|
|
return;
|
|
|
|
if (PageWriteback(page))
|
|
*writeback = true;
|
|
|
|
head = page_buffers(page);
|
|
bh = head;
|
|
do {
|
|
if (buffer_locked(bh))
|
|
*writeback = true;
|
|
|
|
if (buffer_dirty(bh))
|
|
*dirty = true;
|
|
|
|
bh = bh->b_this_page;
|
|
} while (bh != head);
|
|
}
|
|
EXPORT_SYMBOL(buffer_check_dirty_writeback);
|
|
|
|
/*
|
|
* Block until a buffer comes unlocked. This doesn't stop it
|
|
* from becoming locked again - you have to lock it yourself
|
|
* if you want to preserve its state.
|
|
*/
|
|
void __wait_on_buffer(struct buffer_head * bh)
|
|
{
|
|
wait_on_bit_io(&bh->b_state, BH_Lock, TASK_UNINTERRUPTIBLE);
|
|
}
|
|
EXPORT_SYMBOL(__wait_on_buffer);
|
|
|
|
static void
|
|
__clear_page_buffers(struct page *page)
|
|
{
|
|
ClearPagePrivate(page);
|
|
set_page_private(page, 0);
|
|
put_page(page);
|
|
}
|
|
|
|
static void buffer_io_error(struct buffer_head *bh, char *msg)
|
|
{
|
|
if (!test_bit(BH_Quiet, &bh->b_state))
|
|
printk_ratelimited(KERN_ERR
|
|
"Buffer I/O error on dev %pg, logical block %llu%s\n",
|
|
bh->b_bdev, (unsigned long long)bh->b_blocknr, msg);
|
|
}
|
|
|
|
/*
|
|
* End-of-IO handler helper function which does not touch the bh after
|
|
* unlocking it.
|
|
* Note: unlock_buffer() sort-of does touch the bh after unlocking it, but
|
|
* a race there is benign: unlock_buffer() only use the bh's address for
|
|
* hashing after unlocking the buffer, so it doesn't actually touch the bh
|
|
* itself.
|
|
*/
|
|
static void __end_buffer_read_notouch(struct buffer_head *bh, int uptodate)
|
|
{
|
|
if (uptodate) {
|
|
set_buffer_uptodate(bh);
|
|
} else {
|
|
/* This happens, due to failed read-ahead attempts. */
|
|
clear_buffer_uptodate(bh);
|
|
}
|
|
unlock_buffer(bh);
|
|
}
|
|
|
|
/*
|
|
* Default synchronous end-of-IO handler.. Just mark it up-to-date and
|
|
* unlock the buffer. This is what ll_rw_block uses too.
|
|
*/
|
|
void end_buffer_read_sync(struct buffer_head *bh, int uptodate)
|
|
{
|
|
__end_buffer_read_notouch(bh, uptodate);
|
|
put_bh(bh);
|
|
}
|
|
EXPORT_SYMBOL(end_buffer_read_sync);
|
|
|
|
void end_buffer_write_sync(struct buffer_head *bh, int uptodate)
|
|
{
|
|
if (uptodate) {
|
|
set_buffer_uptodate(bh);
|
|
} else {
|
|
buffer_io_error(bh, ", lost sync page write");
|
|
mark_buffer_write_io_error(bh);
|
|
clear_buffer_uptodate(bh);
|
|
}
|
|
unlock_buffer(bh);
|
|
put_bh(bh);
|
|
}
|
|
EXPORT_SYMBOL(end_buffer_write_sync);
|
|
|
|
/*
|
|
* Various filesystems appear to want __find_get_block to be non-blocking.
|
|
* But it's the page lock which protects the buffers. To get around this,
|
|
* we get exclusion from try_to_free_buffers with the blockdev mapping's
|
|
* private_lock.
|
|
*
|
|
* Hack idea: for the blockdev mapping, private_lock contention
|
|
* may be quite high. This code could TryLock the page, and if that
|
|
* succeeds, there is no need to take private_lock.
|
|
*/
|
|
static struct buffer_head *
|
|
__find_get_block_slow(struct block_device *bdev, sector_t block)
|
|
{
|
|
struct inode *bd_inode = bdev->bd_inode;
|
|
struct address_space *bd_mapping = bd_inode->i_mapping;
|
|
struct buffer_head *ret = NULL;
|
|
pgoff_t index;
|
|
struct buffer_head *bh;
|
|
struct buffer_head *head;
|
|
struct page *page;
|
|
int all_mapped = 1;
|
|
static DEFINE_RATELIMIT_STATE(last_warned, HZ, 1);
|
|
|
|
index = block >> (PAGE_SHIFT - bd_inode->i_blkbits);
|
|
page = find_get_page_flags(bd_mapping, index, FGP_ACCESSED);
|
|
if (!page)
|
|
goto out;
|
|
|
|
spin_lock(&bd_mapping->private_lock);
|
|
if (!page_has_buffers(page))
|
|
goto out_unlock;
|
|
head = page_buffers(page);
|
|
bh = head;
|
|
do {
|
|
if (!buffer_mapped(bh))
|
|
all_mapped = 0;
|
|
else if (bh->b_blocknr == block) {
|
|
ret = bh;
|
|
get_bh(bh);
|
|
goto out_unlock;
|
|
}
|
|
bh = bh->b_this_page;
|
|
} while (bh != head);
|
|
|
|
/* we might be here because some of the buffers on this page are
|
|
* not mapped. This is due to various races between
|
|
* file io on the block device and getblk. It gets dealt with
|
|
* elsewhere, don't buffer_error if we had some unmapped buffers
|
|
*/
|
|
ratelimit_set_flags(&last_warned, RATELIMIT_MSG_ON_RELEASE);
|
|
if (all_mapped && __ratelimit(&last_warned)) {
|
|
printk("__find_get_block_slow() failed. block=%llu, "
|
|
"b_blocknr=%llu, b_state=0x%08lx, b_size=%zu, "
|
|
"device %pg blocksize: %d\n",
|
|
(unsigned long long)block,
|
|
(unsigned long long)bh->b_blocknr,
|
|
bh->b_state, bh->b_size, bdev,
|
|
1 << bd_inode->i_blkbits);
|
|
}
|
|
out_unlock:
|
|
spin_unlock(&bd_mapping->private_lock);
|
|
put_page(page);
|
|
out:
|
|
return ret;
|
|
}
|
|
|
|
/*
|
|
* I/O completion handler for block_read_full_page() - pages
|
|
* which come unlocked at the end of I/O.
|
|
*/
|
|
static void end_buffer_async_read(struct buffer_head *bh, int uptodate)
|
|
{
|
|
unsigned long flags;
|
|
struct buffer_head *first;
|
|
struct buffer_head *tmp;
|
|
struct page *page;
|
|
int page_uptodate = 1;
|
|
|
|
BUG_ON(!buffer_async_read(bh));
|
|
|
|
page = bh->b_page;
|
|
if (uptodate) {
|
|
set_buffer_uptodate(bh);
|
|
} else {
|
|
clear_buffer_uptodate(bh);
|
|
buffer_io_error(bh, ", async page read");
|
|
SetPageError(page);
|
|
}
|
|
|
|
/*
|
|
* Be _very_ careful from here on. Bad things can happen if
|
|
* two buffer heads end IO at almost the same time and both
|
|
* decide that the page is now completely done.
|
|
*/
|
|
first = page_buffers(page);
|
|
local_irq_save(flags);
|
|
bit_spin_lock(BH_Uptodate_Lock, &first->b_state);
|
|
clear_buffer_async_read(bh);
|
|
unlock_buffer(bh);
|
|
tmp = bh;
|
|
do {
|
|
if (!buffer_uptodate(tmp))
|
|
page_uptodate = 0;
|
|
if (buffer_async_read(tmp)) {
|
|
BUG_ON(!buffer_locked(tmp));
|
|
goto still_busy;
|
|
}
|
|
tmp = tmp->b_this_page;
|
|
} while (tmp != bh);
|
|
bit_spin_unlock(BH_Uptodate_Lock, &first->b_state);
|
|
local_irq_restore(flags);
|
|
|
|
/*
|
|
* If none of the buffers had errors and they are all
|
|
* uptodate then we can set the page uptodate.
|
|
*/
|
|
if (page_uptodate && !PageError(page))
|
|
SetPageUptodate(page);
|
|
unlock_page(page);
|
|
return;
|
|
|
|
still_busy:
|
|
bit_spin_unlock(BH_Uptodate_Lock, &first->b_state);
|
|
local_irq_restore(flags);
|
|
return;
|
|
}
|
|
|
|
/*
|
|
* Completion handler for block_write_full_page() - pages which are unlocked
|
|
* during I/O, and which have PageWriteback cleared upon I/O completion.
|
|
*/
|
|
void end_buffer_async_write(struct buffer_head *bh, int uptodate)
|
|
{
|
|
unsigned long flags;
|
|
struct buffer_head *first;
|
|
struct buffer_head *tmp;
|
|
struct page *page;
|
|
|
|
BUG_ON(!buffer_async_write(bh));
|
|
|
|
page = bh->b_page;
|
|
if (uptodate) {
|
|
set_buffer_uptodate(bh);
|
|
} else {
|
|
buffer_io_error(bh, ", lost async page write");
|
|
mark_buffer_write_io_error(bh);
|
|
clear_buffer_uptodate(bh);
|
|
SetPageError(page);
|
|
}
|
|
|
|
first = page_buffers(page);
|
|
local_irq_save(flags);
|
|
bit_spin_lock(BH_Uptodate_Lock, &first->b_state);
|
|
|
|
clear_buffer_async_write(bh);
|
|
unlock_buffer(bh);
|
|
tmp = bh->b_this_page;
|
|
while (tmp != bh) {
|
|
if (buffer_async_write(tmp)) {
|
|
BUG_ON(!buffer_locked(tmp));
|
|
goto still_busy;
|
|
}
|
|
tmp = tmp->b_this_page;
|
|
}
|
|
bit_spin_unlock(BH_Uptodate_Lock, &first->b_state);
|
|
local_irq_restore(flags);
|
|
end_page_writeback(page);
|
|
return;
|
|
|
|
still_busy:
|
|
bit_spin_unlock(BH_Uptodate_Lock, &first->b_state);
|
|
local_irq_restore(flags);
|
|
return;
|
|
}
|
|
EXPORT_SYMBOL(end_buffer_async_write);
|
|
|
|
/*
|
|
* If a page's buffers are under async readin (end_buffer_async_read
|
|
* completion) then there is a possibility that another thread of
|
|
* control could lock one of the buffers after it has completed
|
|
* but while some of the other buffers have not completed. This
|
|
* locked buffer would confuse end_buffer_async_read() into not unlocking
|
|
* the page. So the absence of BH_Async_Read tells end_buffer_async_read()
|
|
* that this buffer is not under async I/O.
|
|
*
|
|
* The page comes unlocked when it has no locked buffer_async buffers
|
|
* left.
|
|
*
|
|
* PageLocked prevents anyone starting new async I/O reads any of
|
|
* the buffers.
|
|
*
|
|
* PageWriteback is used to prevent simultaneous writeout of the same
|
|
* page.
|
|
*
|
|
* PageLocked prevents anyone from starting writeback of a page which is
|
|
* under read I/O (PageWriteback is only ever set against a locked page).
|
|
*/
|
|
static void mark_buffer_async_read(struct buffer_head *bh)
|
|
{
|
|
bh->b_end_io = end_buffer_async_read;
|
|
set_buffer_async_read(bh);
|
|
}
|
|
|
|
static void mark_buffer_async_write_endio(struct buffer_head *bh,
|
|
bh_end_io_t *handler)
|
|
{
|
|
bh->b_end_io = handler;
|
|
set_buffer_async_write(bh);
|
|
}
|
|
|
|
void mark_buffer_async_write(struct buffer_head *bh)
|
|
{
|
|
mark_buffer_async_write_endio(bh, end_buffer_async_write);
|
|
}
|
|
EXPORT_SYMBOL(mark_buffer_async_write);
|
|
|
|
|
|
/*
|
|
* fs/buffer.c contains helper functions for buffer-backed address space's
|
|
* fsync functions. A common requirement for buffer-based filesystems is
|
|
* that certain data from the backing blockdev needs to be written out for
|
|
* a successful fsync(). For example, ext2 indirect blocks need to be
|
|
* written back and waited upon before fsync() returns.
|
|
*
|
|
* The functions mark_buffer_inode_dirty(), fsync_inode_buffers(),
|
|
* inode_has_buffers() and invalidate_inode_buffers() are provided for the
|
|
* management of a list of dependent buffers at ->i_mapping->private_list.
|
|
*
|
|
* Locking is a little subtle: try_to_free_buffers() will remove buffers
|
|
* from their controlling inode's queue when they are being freed. But
|
|
* try_to_free_buffers() will be operating against the *blockdev* mapping
|
|
* at the time, not against the S_ISREG file which depends on those buffers.
|
|
* So the locking for private_list is via the private_lock in the address_space
|
|
* which backs the buffers. Which is different from the address_space
|
|
* against which the buffers are listed. So for a particular address_space,
|
|
* mapping->private_lock does *not* protect mapping->private_list! In fact,
|
|
* mapping->private_list will always be protected by the backing blockdev's
|
|
* ->private_lock.
|
|
*
|
|
* Which introduces a requirement: all buffers on an address_space's
|
|
* ->private_list must be from the same address_space: the blockdev's.
|
|
*
|
|
* address_spaces which do not place buffers at ->private_list via these
|
|
* utility functions are free to use private_lock and private_list for
|
|
* whatever they want. The only requirement is that list_empty(private_list)
|
|
* be true at clear_inode() time.
|
|
*
|
|
* FIXME: clear_inode should not call invalidate_inode_buffers(). The
|
|
* filesystems should do that. invalidate_inode_buffers() should just go
|
|
* BUG_ON(!list_empty).
|
|
*
|
|
* FIXME: mark_buffer_dirty_inode() is a data-plane operation. It should
|
|
* take an address_space, not an inode. And it should be called
|
|
* mark_buffer_dirty_fsync() to clearly define why those buffers are being
|
|
* queued up.
|
|
*
|
|
* FIXME: mark_buffer_dirty_inode() doesn't need to add the buffer to the
|
|
* list if it is already on a list. Because if the buffer is on a list,
|
|
* it *must* already be on the right one. If not, the filesystem is being
|
|
* silly. This will save a ton of locking. But first we have to ensure
|
|
* that buffers are taken *off* the old inode's list when they are freed
|
|
* (presumably in truncate). That requires careful auditing of all
|
|
* filesystems (do it inside bforget()). It could also be done by bringing
|
|
* b_inode back.
|
|
*/
|
|
|
|
/*
|
|
* The buffer's backing address_space's private_lock must be held
|
|
*/
|
|
static void __remove_assoc_queue(struct buffer_head *bh)
|
|
{
|
|
list_del_init(&bh->b_assoc_buffers);
|
|
WARN_ON(!bh->b_assoc_map);
|
|
bh->b_assoc_map = NULL;
|
|
}
|
|
|
|
int inode_has_buffers(struct inode *inode)
|
|
{
|
|
return !list_empty(&inode->i_data.private_list);
|
|
}
|
|
|
|
/*
|
|
* osync is designed to support O_SYNC io. It waits synchronously for
|
|
* all already-submitted IO to complete, but does not queue any new
|
|
* writes to the disk.
|
|
*
|
|
* To do O_SYNC writes, just queue the buffer writes with ll_rw_block as
|
|
* you dirty the buffers, and then use osync_inode_buffers to wait for
|
|
* completion. Any other dirty buffers which are not yet queued for
|
|
* write will not be flushed to disk by the osync.
|
|
*/
|
|
static int osync_buffers_list(spinlock_t *lock, struct list_head *list)
|
|
{
|
|
struct buffer_head *bh;
|
|
struct list_head *p;
|
|
int err = 0;
|
|
|
|
spin_lock(lock);
|
|
repeat:
|
|
list_for_each_prev(p, list) {
|
|
bh = BH_ENTRY(p);
|
|
if (buffer_locked(bh)) {
|
|
get_bh(bh);
|
|
spin_unlock(lock);
|
|
wait_on_buffer(bh);
|
|
if (!buffer_uptodate(bh))
|
|
err = -EIO;
|
|
brelse(bh);
|
|
spin_lock(lock);
|
|
goto repeat;
|
|
}
|
|
}
|
|
spin_unlock(lock);
|
|
return err;
|
|
}
|
|
|
|
void emergency_thaw_bdev(struct super_block *sb)
|
|
{
|
|
while (sb->s_bdev && !thaw_bdev(sb->s_bdev, sb))
|
|
printk(KERN_WARNING "Emergency Thaw on %pg\n", sb->s_bdev);
|
|
}
|
|
|
|
/**
|
|
* sync_mapping_buffers - write out & wait upon a mapping's "associated" buffers
|
|
* @mapping: the mapping which wants those buffers written
|
|
*
|
|
* Starts I/O against the buffers at mapping->private_list, and waits upon
|
|
* that I/O.
|
|
*
|
|
* Basically, this is a convenience function for fsync().
|
|
* @mapping is a file or directory which needs those buffers to be written for
|
|
* a successful fsync().
|
|
*/
|
|
int sync_mapping_buffers(struct address_space *mapping)
|
|
{
|
|
struct address_space *buffer_mapping = mapping->private_data;
|
|
|
|
if (buffer_mapping == NULL || list_empty(&mapping->private_list))
|
|
return 0;
|
|
|
|
return fsync_buffers_list(&buffer_mapping->private_lock,
|
|
&mapping->private_list);
|
|
}
|
|
EXPORT_SYMBOL(sync_mapping_buffers);
|
|
|
|
/*
|
|
* Called when we've recently written block `bblock', and it is known that
|
|
* `bblock' was for a buffer_boundary() buffer. This means that the block at
|
|
* `bblock + 1' is probably a dirty indirect block. Hunt it down and, if it's
|
|
* dirty, schedule it for IO. So that indirects merge nicely with their data.
|
|
*/
|
|
void write_boundary_block(struct block_device *bdev,
|
|
sector_t bblock, unsigned blocksize)
|
|
{
|
|
struct buffer_head *bh = __find_get_block(bdev, bblock + 1, blocksize);
|
|
if (bh) {
|
|
if (buffer_dirty(bh))
|
|
ll_rw_block(REQ_OP_WRITE, 0, 1, &bh);
|
|
put_bh(bh);
|
|
}
|
|
}
|
|
|
|
void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode)
|
|
{
|
|
struct address_space *mapping = inode->i_mapping;
|
|
struct address_space *buffer_mapping = bh->b_page->mapping;
|
|
|
|
mark_buffer_dirty(bh);
|
|
if (!mapping->private_data) {
|
|
mapping->private_data = buffer_mapping;
|
|
} else {
|
|
BUG_ON(mapping->private_data != buffer_mapping);
|
|
}
|
|
if (!bh->b_assoc_map) {
|
|
spin_lock(&buffer_mapping->private_lock);
|
|
list_move_tail(&bh->b_assoc_buffers,
|
|
&mapping->private_list);
|
|
bh->b_assoc_map = mapping;
|
|
spin_unlock(&buffer_mapping->private_lock);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(mark_buffer_dirty_inode);
|
|
|
|
/*
|
|
* Mark the page dirty, and set it dirty in the page cache, and mark the inode
|
|
* dirty.
|
|
*
|
|
* If warn is true, then emit a warning if the page is not uptodate and has
|
|
* not been truncated.
|
|
*
|
|
* The caller must hold lock_page_memcg().
|
|
*/
|
|
void __set_page_dirty(struct page *page, struct address_space *mapping,
|
|
int warn)
|
|
{
|
|
unsigned long flags;
|
|
|
|
xa_lock_irqsave(&mapping->i_pages, flags);
|
|
if (page->mapping) { /* Race with truncate? */
|
|
WARN_ON_ONCE(warn && !PageUptodate(page));
|
|
account_page_dirtied(page, mapping);
|
|
__xa_set_mark(&mapping->i_pages, page_index(page),
|
|
PAGECACHE_TAG_DIRTY);
|
|
}
|
|
xa_unlock_irqrestore(&mapping->i_pages, flags);
|
|
}
|
|
EXPORT_SYMBOL_GPL(__set_page_dirty);
|
|
|
|
/*
|
|
* Add a page to the dirty page list.
|
|
*
|
|
* It is a sad fact of life that this function is called from several places
|
|
* deeply under spinlocking. It may not sleep.
|
|
*
|
|
* If the page has buffers, the uptodate buffers are set dirty, to preserve
|
|
* dirty-state coherency between the page and the buffers. It the page does
|
|
* not have buffers then when they are later attached they will all be set
|
|
* dirty.
|
|
*
|
|
* The buffers are dirtied before the page is dirtied. There's a small race
|
|
* window in which a writepage caller may see the page cleanness but not the
|
|
* buffer dirtiness. That's fine. If this code were to set the page dirty
|
|
* before the buffers, a concurrent writepage caller could clear the page dirty
|
|
* bit, see a bunch of clean buffers and we'd end up with dirty buffers/clean
|
|
* page on the dirty page list.
|
|
*
|
|
* We use private_lock to lock against try_to_free_buffers while using the
|
|
* page's buffer list. Also use this to protect against clean buffers being
|
|
* added to the page after it was set dirty.
|
|
*
|
|
* FIXME: may need to call ->reservepage here as well. That's rather up to the
|
|
* address_space though.
|
|
*/
|
|
int __set_page_dirty_buffers(struct page *page)
|
|
{
|
|
int newly_dirty;
|
|
struct address_space *mapping = page_mapping(page);
|
|
|
|
if (unlikely(!mapping))
|
|
return !TestSetPageDirty(page);
|
|
|
|
spin_lock(&mapping->private_lock);
|
|
if (page_has_buffers(page)) {
|
|
struct buffer_head *head = page_buffers(page);
|
|
struct buffer_head *bh = head;
|
|
|
|
do {
|
|
set_buffer_dirty(bh);
|
|
bh = bh->b_this_page;
|
|
} while (bh != head);
|
|
}
|
|
/*
|
|
* Lock out page->mem_cgroup migration to keep PageDirty
|
|
* synchronized with per-memcg dirty page counters.
|
|
*/
|
|
lock_page_memcg(page);
|
|
newly_dirty = !TestSetPageDirty(page);
|
|
spin_unlock(&mapping->private_lock);
|
|
|
|
if (newly_dirty)
|
|
__set_page_dirty(page, mapping, 1);
|
|
|
|
unlock_page_memcg(page);
|
|
|
|
if (newly_dirty)
|
|
__mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
|
|
|
|
return newly_dirty;
|
|
}
|
|
EXPORT_SYMBOL(__set_page_dirty_buffers);
|
|
|
|
/*
|
|
* Write out and wait upon a list of buffers.
|
|
*
|
|
* We have conflicting pressures: we want to make sure that all
|
|
* initially dirty buffers get waited on, but that any subsequently
|
|
* dirtied buffers don't. After all, we don't want fsync to last
|
|
* forever if somebody is actively writing to the file.
|
|
*
|
|
* Do this in two main stages: first we copy dirty buffers to a
|
|
* temporary inode list, queueing the writes as we go. Then we clean
|
|
* up, waiting for those writes to complete.
|
|
*
|
|
* During this second stage, any subsequent updates to the file may end
|
|
* up refiling the buffer on the original inode's dirty list again, so
|
|
* there is a chance we will end up with a buffer queued for write but
|
|
* not yet completed on that list. So, as a final cleanup we go through
|
|
* the osync code to catch these locked, dirty buffers without requeuing
|
|
* any newly dirty buffers for write.
|
|
*/
|
|
static int fsync_buffers_list(spinlock_t *lock, struct list_head *list)
|
|
{
|
|
struct buffer_head *bh;
|
|
struct list_head tmp;
|
|
struct address_space *mapping;
|
|
int err = 0, err2;
|
|
struct blk_plug plug;
|
|
|
|
INIT_LIST_HEAD(&tmp);
|
|
blk_start_plug(&plug);
|
|
|
|
spin_lock(lock);
|
|
while (!list_empty(list)) {
|
|
bh = BH_ENTRY(list->next);
|
|
mapping = bh->b_assoc_map;
|
|
__remove_assoc_queue(bh);
|
|
/* Avoid race with mark_buffer_dirty_inode() which does
|
|
* a lockless check and we rely on seeing the dirty bit */
|
|
smp_mb();
|
|
if (buffer_dirty(bh) || buffer_locked(bh)) {
|
|
list_add(&bh->b_assoc_buffers, &tmp);
|
|
bh->b_assoc_map = mapping;
|
|
if (buffer_dirty(bh)) {
|
|
get_bh(bh);
|
|
spin_unlock(lock);
|
|
/*
|
|
* Ensure any pending I/O completes so that
|
|
* write_dirty_buffer() actually writes the
|
|
* current contents - it is a noop if I/O is
|
|
* still in flight on potentially older
|
|
* contents.
|
|
*/
|
|
write_dirty_buffer(bh, REQ_SYNC);
|
|
|
|
/*
|
|
* Kick off IO for the previous mapping. Note
|
|
* that we will not run the very last mapping,
|
|
* wait_on_buffer() will do that for us
|
|
* through sync_buffer().
|
|
*/
|
|
brelse(bh);
|
|
spin_lock(lock);
|
|
}
|
|
}
|
|
}
|
|
|
|
spin_unlock(lock);
|
|
blk_finish_plug(&plug);
|
|
spin_lock(lock);
|
|
|
|
while (!list_empty(&tmp)) {
|
|
bh = BH_ENTRY(tmp.prev);
|
|
get_bh(bh);
|
|
mapping = bh->b_assoc_map;
|
|
__remove_assoc_queue(bh);
|
|
/* Avoid race with mark_buffer_dirty_inode() which does
|
|
* a lockless check and we rely on seeing the dirty bit */
|
|
smp_mb();
|
|
if (buffer_dirty(bh)) {
|
|
list_add(&bh->b_assoc_buffers,
|
|
&mapping->private_list);
|
|
bh->b_assoc_map = mapping;
|
|
}
|
|
spin_unlock(lock);
|
|
wait_on_buffer(bh);
|
|
if (!buffer_uptodate(bh))
|
|
err = -EIO;
|
|
brelse(bh);
|
|
spin_lock(lock);
|
|
}
|
|
|
|
spin_unlock(lock);
|
|
err2 = osync_buffers_list(lock, list);
|
|
if (err)
|
|
return err;
|
|
else
|
|
return err2;
|
|
}
|
|
|
|
/*
|
|
* Invalidate any and all dirty buffers on a given inode. We are
|
|
* probably unmounting the fs, but that doesn't mean we have already
|
|
* done a sync(). Just drop the buffers from the inode list.
|
|
*
|
|
* NOTE: we take the inode's blockdev's mapping's private_lock. Which
|
|
* assumes that all the buffers are against the blockdev. Not true
|
|
* for reiserfs.
|
|
*/
|
|
void invalidate_inode_buffers(struct inode *inode)
|
|
{
|
|
if (inode_has_buffers(inode)) {
|
|
struct address_space *mapping = &inode->i_data;
|
|
struct list_head *list = &mapping->private_list;
|
|
struct address_space *buffer_mapping = mapping->private_data;
|
|
|
|
spin_lock(&buffer_mapping->private_lock);
|
|
while (!list_empty(list))
|
|
__remove_assoc_queue(BH_ENTRY(list->next));
|
|
spin_unlock(&buffer_mapping->private_lock);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(invalidate_inode_buffers);
|
|
|
|
/*
|
|
* Remove any clean buffers from the inode's buffer list. This is called
|
|
* when we're trying to free the inode itself. Those buffers can pin it.
|
|
*
|
|
* Returns true if all buffers were removed.
|
|
*/
|
|
int remove_inode_buffers(struct inode *inode)
|
|
{
|
|
int ret = 1;
|
|
|
|
if (inode_has_buffers(inode)) {
|
|
struct address_space *mapping = &inode->i_data;
|
|
struct list_head *list = &mapping->private_list;
|
|
struct address_space *buffer_mapping = mapping->private_data;
|
|
|
|
spin_lock(&buffer_mapping->private_lock);
|
|
while (!list_empty(list)) {
|
|
struct buffer_head *bh = BH_ENTRY(list->next);
|
|
if (buffer_dirty(bh)) {
|
|
ret = 0;
|
|
break;
|
|
}
|
|
__remove_assoc_queue(bh);
|
|
}
|
|
spin_unlock(&buffer_mapping->private_lock);
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
/*
|
|
* Create the appropriate buffers when given a page for data area and
|
|
* the size of each buffer.. Use the bh->b_this_page linked list to
|
|
* follow the buffers created. Return NULL if unable to create more
|
|
* buffers.
|
|
*
|
|
* The retry flag is used to differentiate async IO (paging, swapping)
|
|
* which may not fail from ordinary buffer allocations.
|
|
*/
|
|
struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size,
|
|
bool retry)
|
|
{
|
|
struct buffer_head *bh, *head;
|
|
gfp_t gfp = GFP_NOFS | __GFP_ACCOUNT;
|
|
long offset;
|
|
struct mem_cgroup *memcg;
|
|
|
|
if (retry)
|
|
gfp |= __GFP_NOFAIL;
|
|
|
|
memcg = get_mem_cgroup_from_page(page);
|
|
memalloc_use_memcg(memcg);
|
|
|
|
head = NULL;
|
|
offset = PAGE_SIZE;
|
|
while ((offset -= size) >= 0) {
|
|
bh = alloc_buffer_head(gfp);
|
|
if (!bh)
|
|
goto no_grow;
|
|
|
|
bh->b_this_page = head;
|
|
bh->b_blocknr = -1;
|
|
head = bh;
|
|
|
|
bh->b_size = size;
|
|
|
|
/* Link the buffer to its page */
|
|
set_bh_page(bh, page, offset);
|
|
}
|
|
out:
|
|
memalloc_unuse_memcg();
|
|
mem_cgroup_put(memcg);
|
|
return head;
|
|
/*
|
|
* In case anything failed, we just free everything we got.
|
|
*/
|
|
no_grow:
|
|
if (head) {
|
|
do {
|
|
bh = head;
|
|
head = head->b_this_page;
|
|
free_buffer_head(bh);
|
|
} while (head);
|
|
}
|
|
|
|
goto out;
|
|
}
|
|
EXPORT_SYMBOL_GPL(alloc_page_buffers);
|
|
|
|
static inline void
|
|
link_dev_buffers(struct page *page, struct buffer_head *head)
|
|
{
|
|
struct buffer_head *bh, *tail;
|
|
|
|
bh = head;
|
|
do {
|
|
tail = bh;
|
|
bh = bh->b_this_page;
|
|
} while (bh);
|
|
tail->b_this_page = head;
|
|
attach_page_buffers(page, head);
|
|
}
|
|
|
|
static sector_t blkdev_max_block(struct block_device *bdev, unsigned int size)
|
|
{
|
|
sector_t retval = ~((sector_t)0);
|
|
loff_t sz = i_size_read(bdev->bd_inode);
|
|
|
|
if (sz) {
|
|
unsigned int sizebits = blksize_bits(size);
|
|
retval = (sz >> sizebits);
|
|
}
|
|
return retval;
|
|
}
|
|
|
|
/*
|
|
* Initialise the state of a blockdev page's buffers.
|
|
*/
|
|
static sector_t
|
|
init_page_buffers(struct page *page, struct block_device *bdev,
|
|
sector_t block, int size)
|
|
{
|
|
struct buffer_head *head = page_buffers(page);
|
|
struct buffer_head *bh = head;
|
|
int uptodate = PageUptodate(page);
|
|
sector_t end_block = blkdev_max_block(I_BDEV(bdev->bd_inode), size);
|
|
|
|
do {
|
|
if (!buffer_mapped(bh)) {
|
|
bh->b_end_io = NULL;
|
|
bh->b_private = NULL;
|
|
bh->b_bdev = bdev;
|
|
bh->b_blocknr = block;
|
|
if (uptodate)
|
|
set_buffer_uptodate(bh);
|
|
if (block < end_block)
|
|
set_buffer_mapped(bh);
|
|
}
|
|
block++;
|
|
bh = bh->b_this_page;
|
|
} while (bh != head);
|
|
|
|
/*
|
|
* Caller needs to validate requested block against end of device.
|
|
*/
|
|
return end_block;
|
|
}
|
|
|
|
/*
|
|
* Create the page-cache page that contains the requested block.
|
|
*
|
|
* This is used purely for blockdev mappings.
|
|
*/
|
|
static int
|
|
grow_dev_page(struct block_device *bdev, sector_t block,
|
|
pgoff_t index, int size, int sizebits, gfp_t gfp)
|
|
{
|
|
struct inode *inode = bdev->bd_inode;
|
|
struct page *page;
|
|
struct buffer_head *bh;
|
|
sector_t end_block;
|
|
int ret = 0; /* Will call free_more_memory() */
|
|
gfp_t gfp_mask;
|
|
|
|
gfp_mask = mapping_gfp_constraint(inode->i_mapping, ~__GFP_FS) | gfp;
|
|
|
|
/*
|
|
* XXX: __getblk_slow() can not really deal with failure and
|
|
* will endlessly loop on improvised global reclaim. Prefer
|
|
* looping in the allocator rather than here, at least that
|
|
* code knows what it's doing.
|
|
*/
|
|
gfp_mask |= __GFP_NOFAIL;
|
|
|
|
page = find_or_create_page(inode->i_mapping, index, gfp_mask);
|
|
|
|
BUG_ON(!PageLocked(page));
|
|
|
|
if (page_has_buffers(page)) {
|
|
bh = page_buffers(page);
|
|
if (bh->b_size == size) {
|
|
end_block = init_page_buffers(page, bdev,
|
|
(sector_t)index << sizebits,
|
|
size);
|
|
goto done;
|
|
}
|
|
if (!try_to_free_buffers(page))
|
|
goto failed;
|
|
}
|
|
|
|
/*
|
|
* Allocate some buffers for this page
|
|
*/
|
|
bh = alloc_page_buffers(page, size, true);
|
|
|
|
/*
|
|
* Link the page to the buffers and initialise them. Take the
|
|
* lock to be atomic wrt __find_get_block(), which does not
|
|
* run under the page lock.
|
|
*/
|
|
spin_lock(&inode->i_mapping->private_lock);
|
|
link_dev_buffers(page, bh);
|
|
end_block = init_page_buffers(page, bdev, (sector_t)index << sizebits,
|
|
size);
|
|
spin_unlock(&inode->i_mapping->private_lock);
|
|
done:
|
|
ret = (block < end_block) ? 1 : -ENXIO;
|
|
failed:
|
|
unlock_page(page);
|
|
put_page(page);
|
|
return ret;
|
|
}
|
|
|
|
/*
|
|
* Create buffers for the specified block device block's page. If
|
|
* that page was dirty, the buffers are set dirty also.
|
|
*/
|
|
static int
|
|
grow_buffers(struct block_device *bdev, sector_t block, int size, gfp_t gfp)
|
|
{
|
|
pgoff_t index;
|
|
int sizebits;
|
|
|
|
sizebits = -1;
|
|
do {
|
|
sizebits++;
|
|
} while ((size << sizebits) < PAGE_SIZE);
|
|
|
|
index = block >> sizebits;
|
|
|
|
/*
|
|
* Check for a block which wants to lie outside our maximum possible
|
|
* pagecache index. (this comparison is done using sector_t types).
|
|
*/
|
|
if (unlikely(index != block >> sizebits)) {
|
|
printk(KERN_ERR "%s: requested out-of-range block %llu for "
|
|
"device %pg\n",
|
|
__func__, (unsigned long long)block,
|
|
bdev);
|
|
return -EIO;
|
|
}
|
|
|
|
/* Create a page with the proper size buffers.. */
|
|
return grow_dev_page(bdev, block, index, size, sizebits, gfp);
|
|
}
|
|
|
|
static struct buffer_head *
|
|
__getblk_slow(struct block_device *bdev, sector_t block,
|
|
unsigned size, gfp_t gfp)
|
|
{
|
|
/* Size must be multiple of hard sectorsize */
|
|
if (unlikely(size & (bdev_logical_block_size(bdev)-1) ||
|
|
(size < 512 || size > PAGE_SIZE))) {
|
|
printk(KERN_ERR "getblk(): invalid block size %d requested\n",
|
|
size);
|
|
printk(KERN_ERR "logical block size: %d\n",
|
|
bdev_logical_block_size(bdev));
|
|
|
|
dump_stack();
|
|
return NULL;
|
|
}
|
|
|
|
for (;;) {
|
|
struct buffer_head *bh;
|
|
int ret;
|
|
|
|
bh = __find_get_block(bdev, block, size);
|
|
if (bh)
|
|
return bh;
|
|
|
|
ret = grow_buffers(bdev, block, size, gfp);
|
|
if (ret < 0)
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
/*
|
|
* The relationship between dirty buffers and dirty pages:
|
|
*
|
|
* Whenever a page has any dirty buffers, the page's dirty bit is set, and
|
|
* the page is tagged dirty in the page cache.
|
|
*
|
|
* At all times, the dirtiness of the buffers represents the dirtiness of
|
|
* subsections of the page. If the page has buffers, the page dirty bit is
|
|
* merely a hint about the true dirty state.
|
|
*
|
|
* When a page is set dirty in its entirety, all its buffers are marked dirty
|
|
* (if the page has buffers).
|
|
*
|
|
* When a buffer is marked dirty, its page is dirtied, but the page's other
|
|
* buffers are not.
|
|
*
|
|
* Also. When blockdev buffers are explicitly read with bread(), they
|
|
* individually become uptodate. But their backing page remains not
|
|
* uptodate - even if all of its buffers are uptodate. A subsequent
|
|
* block_read_full_page() against that page will discover all the uptodate
|
|
* buffers, will set the page uptodate and will perform no I/O.
|
|
*/
|
|
|
|
/**
|
|
* mark_buffer_dirty - mark a buffer_head as needing writeout
|
|
* @bh: the buffer_head to mark dirty
|
|
*
|
|
* mark_buffer_dirty() will set the dirty bit against the buffer, then set
|
|
* its backing page dirty, then tag the page as dirty in the page cache
|
|
* and then attach the address_space's inode to its superblock's dirty
|
|
* inode list.
|
|
*
|
|
* mark_buffer_dirty() is atomic. It takes bh->b_page->mapping->private_lock,
|
|
* i_pages lock and mapping->host->i_lock.
|
|
*/
|
|
void mark_buffer_dirty(struct buffer_head *bh)
|
|
{
|
|
WARN_ON_ONCE(!buffer_uptodate(bh));
|
|
|
|
trace_block_dirty_buffer(bh);
|
|
|
|
/*
|
|
* Very *carefully* optimize the it-is-already-dirty case.
|
|
*
|
|
* Don't let the final "is it dirty" escape to before we
|
|
* perhaps modified the buffer.
|
|
*/
|
|
if (buffer_dirty(bh)) {
|
|
smp_mb();
|
|
if (buffer_dirty(bh))
|
|
return;
|
|
}
|
|
|
|
if (!test_set_buffer_dirty(bh)) {
|
|
struct page *page = bh->b_page;
|
|
struct address_space *mapping = NULL;
|
|
|
|
lock_page_memcg(page);
|
|
if (!TestSetPageDirty(page)) {
|
|
mapping = page_mapping(page);
|
|
if (mapping)
|
|
__set_page_dirty(page, mapping, 0);
|
|
}
|
|
unlock_page_memcg(page);
|
|
if (mapping)
|
|
__mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(mark_buffer_dirty);
|
|
|
|
void mark_buffer_write_io_error(struct buffer_head *bh)
|
|
{
|
|
set_buffer_write_io_error(bh);
|
|
/* FIXME: do we need to set this in both places? */
|
|
if (bh->b_page && bh->b_page->mapping)
|
|
mapping_set_error(bh->b_page->mapping, -EIO);
|
|
if (bh->b_assoc_map)
|
|
mapping_set_error(bh->b_assoc_map, -EIO);
|
|
}
|
|
EXPORT_SYMBOL(mark_buffer_write_io_error);
|
|
|
|
/*
|
|
* Decrement a buffer_head's reference count. If all buffers against a page
|
|
* have zero reference count, are clean and unlocked, and if the page is clean
|
|
* and unlocked then try_to_free_buffers() may strip the buffers from the page
|
|
* in preparation for freeing it (sometimes, rarely, buffers are removed from
|
|
* a page but it ends up not being freed, and buffers may later be reattached).
|
|
*/
|
|
void __brelse(struct buffer_head * buf)
|
|
{
|
|
if (atomic_read(&buf->b_count)) {
|
|
put_bh(buf);
|
|
return;
|
|
}
|
|
WARN(1, KERN_ERR "VFS: brelse: Trying to free free buffer\n");
|
|
}
|
|
EXPORT_SYMBOL(__brelse);
|
|
|
|
/*
|
|
* bforget() is like brelse(), except it discards any
|
|
* potentially dirty data.
|
|
*/
|
|
void __bforget(struct buffer_head *bh)
|
|
{
|
|
clear_buffer_dirty(bh);
|
|
if (bh->b_assoc_map) {
|
|
struct address_space *buffer_mapping = bh->b_page->mapping;
|
|
|
|
spin_lock(&buffer_mapping->private_lock);
|
|
list_del_init(&bh->b_assoc_buffers);
|
|
bh->b_assoc_map = NULL;
|
|
spin_unlock(&buffer_mapping->private_lock);
|
|
}
|
|
__brelse(bh);
|
|
}
|
|
EXPORT_SYMBOL(__bforget);
|
|
|
|
static struct buffer_head *__bread_slow(struct buffer_head *bh)
|
|
{
|
|
lock_buffer(bh);
|
|
if (buffer_uptodate(bh)) {
|
|
unlock_buffer(bh);
|
|
return bh;
|
|
} else {
|
|
get_bh(bh);
|
|
bh->b_end_io = end_buffer_read_sync;
|
|
submit_bh(REQ_OP_READ, 0, bh);
|
|
wait_on_buffer(bh);
|
|
if (buffer_uptodate(bh))
|
|
return bh;
|
|
}
|
|
brelse(bh);
|
|
return NULL;
|
|
}
|
|
|
|
/*
|
|
* Per-cpu buffer LRU implementation. To reduce the cost of __find_get_block().
|
|
* The bhs[] array is sorted - newest buffer is at bhs[0]. Buffers have their
|
|
* refcount elevated by one when they're in an LRU. A buffer can only appear
|
|
* once in a particular CPU's LRU. A single buffer can be present in multiple
|
|
* CPU's LRUs at the same time.
|
|
*
|
|
* This is a transparent caching front-end to sb_bread(), sb_getblk() and
|
|
* sb_find_get_block().
|
|
*
|
|
* The LRUs themselves only need locking against invalidate_bh_lrus. We use
|
|
* a local interrupt disable for that.
|
|
*/
|
|
|
|
#define BH_LRU_SIZE 16
|
|
|
|
struct bh_lru {
|
|
struct buffer_head *bhs[BH_LRU_SIZE];
|
|
};
|
|
|
|
static DEFINE_PER_CPU(struct bh_lru, bh_lrus) = {{ NULL }};
|
|
|
|
#ifdef CONFIG_SMP
|
|
#define bh_lru_lock() local_irq_disable()
|
|
#define bh_lru_unlock() local_irq_enable()
|
|
#else
|
|
#define bh_lru_lock() preempt_disable()
|
|
#define bh_lru_unlock() preempt_enable()
|
|
#endif
|
|
|
|
static inline void check_irqs_on(void)
|
|
{
|
|
#ifdef irqs_disabled
|
|
BUG_ON(irqs_disabled());
|
|
#endif
|
|
}
|
|
|
|
/*
|
|
* Install a buffer_head into this cpu's LRU. If not already in the LRU, it is
|
|
* inserted at the front, and the buffer_head at the back if any is evicted.
|
|
* Or, if already in the LRU it is moved to the front.
|
|
*/
|
|
static void bh_lru_install(struct buffer_head *bh)
|
|
{
|
|
struct buffer_head *evictee = bh;
|
|
struct bh_lru *b;
|
|
int i;
|
|
|
|
check_irqs_on();
|
|
bh_lru_lock();
|
|
|
|
b = this_cpu_ptr(&bh_lrus);
|
|
for (i = 0; i < BH_LRU_SIZE; i++) {
|
|
swap(evictee, b->bhs[i]);
|
|
if (evictee == bh) {
|
|
bh_lru_unlock();
|
|
return;
|
|
}
|
|
}
|
|
|
|
get_bh(bh);
|
|
bh_lru_unlock();
|
|
brelse(evictee);
|
|
}
|
|
|
|
/*
|
|
* Look up the bh in this cpu's LRU. If it's there, move it to the head.
|
|
*/
|
|
static struct buffer_head *
|
|
lookup_bh_lru(struct block_device *bdev, sector_t block, unsigned size)
|
|
{
|
|
struct buffer_head *ret = NULL;
|
|
unsigned int i;
|
|
|
|
check_irqs_on();
|
|
bh_lru_lock();
|
|
for (i = 0; i < BH_LRU_SIZE; i++) {
|
|
struct buffer_head *bh = __this_cpu_read(bh_lrus.bhs[i]);
|
|
|
|
if (bh && bh->b_blocknr == block && bh->b_bdev == bdev &&
|
|
bh->b_size == size) {
|
|
if (i) {
|
|
while (i) {
|
|
__this_cpu_write(bh_lrus.bhs[i],
|
|
__this_cpu_read(bh_lrus.bhs[i - 1]));
|
|
i--;
|
|
}
|
|
__this_cpu_write(bh_lrus.bhs[0], bh);
|
|
}
|
|
get_bh(bh);
|
|
ret = bh;
|
|
break;
|
|
}
|
|
}
|
|
bh_lru_unlock();
|
|
return ret;
|
|
}
|
|
|
|
/*
|
|
* Perform a pagecache lookup for the matching buffer. If it's there, refresh
|
|
* it in the LRU and mark it as accessed. If it is not present then return
|
|
* NULL
|
|
*/
|
|
struct buffer_head *
|
|
__find_get_block(struct block_device *bdev, sector_t block, unsigned size)
|
|
{
|
|
struct buffer_head *bh = lookup_bh_lru(bdev, block, size);
|
|
|
|
if (bh == NULL) {
|
|
/* __find_get_block_slow will mark the page accessed */
|
|
bh = __find_get_block_slow(bdev, block);
|
|
if (bh)
|
|
bh_lru_install(bh);
|
|
} else
|
|
touch_buffer(bh);
|
|
|
|
return bh;
|
|
}
|
|
EXPORT_SYMBOL(__find_get_block);
|
|
|
|
/*
|
|
* __getblk_gfp() will locate (and, if necessary, create) the buffer_head
|
|
* which corresponds to the passed block_device, block and size. The
|
|
* returned buffer has its reference count incremented.
|
|
*
|
|
* __getblk_gfp() will lock up the machine if grow_dev_page's
|
|
* try_to_free_buffers() attempt is failing. FIXME, perhaps?
|
|
*/
|
|
struct buffer_head *
|
|
__getblk_gfp(struct block_device *bdev, sector_t block,
|
|
unsigned size, gfp_t gfp)
|
|
{
|
|
struct buffer_head *bh = __find_get_block(bdev, block, size);
|
|
|
|
might_sleep();
|
|
if (bh == NULL)
|
|
bh = __getblk_slow(bdev, block, size, gfp);
|
|
return bh;
|
|
}
|
|
EXPORT_SYMBOL(__getblk_gfp);
|
|
|
|
/*
|
|
* Do async read-ahead on a buffer..
|
|
*/
|
|
void __breadahead(struct block_device *bdev, sector_t block, unsigned size)
|
|
{
|
|
struct buffer_head *bh = __getblk(bdev, block, size);
|
|
if (likely(bh)) {
|
|
ll_rw_block(REQ_OP_READ, REQ_RAHEAD, 1, &bh);
|
|
brelse(bh);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(__breadahead);
|
|
|
|
/**
|
|
* __bread_gfp() - reads a specified block and returns the bh
|
|
* @bdev: the block_device to read from
|
|
* @block: number of block
|
|
* @size: size (in bytes) to read
|
|
* @gfp: page allocation flag
|
|
*
|
|
* Reads a specified block, and returns buffer head that contains it.
|
|
* The page cache can be allocated from non-movable area
|
|
* not to prevent page migration if you set gfp to zero.
|
|
* It returns NULL if the block was unreadable.
|
|
*/
|
|
struct buffer_head *
|
|
__bread_gfp(struct block_device *bdev, sector_t block,
|
|
unsigned size, gfp_t gfp)
|
|
{
|
|
struct buffer_head *bh = __getblk_gfp(bdev, block, size, gfp);
|
|
|
|
if (likely(bh) && !buffer_uptodate(bh))
|
|
bh = __bread_slow(bh);
|
|
return bh;
|
|
}
|
|
EXPORT_SYMBOL(__bread_gfp);
|
|
|
|
/*
|
|
* invalidate_bh_lrus() is called rarely - but not only at unmount.
|
|
* This doesn't race because it runs in each cpu either in irq
|
|
* or with preempt disabled.
|
|
*/
|
|
static void invalidate_bh_lru(void *arg)
|
|
{
|
|
struct bh_lru *b = &get_cpu_var(bh_lrus);
|
|
int i;
|
|
|
|
for (i = 0; i < BH_LRU_SIZE; i++) {
|
|
brelse(b->bhs[i]);
|
|
b->bhs[i] = NULL;
|
|
}
|
|
put_cpu_var(bh_lrus);
|
|
}
|
|
|
|
static bool has_bh_in_lru(int cpu, void *dummy)
|
|
{
|
|
struct bh_lru *b = per_cpu_ptr(&bh_lrus, cpu);
|
|
int i;
|
|
|
|
for (i = 0; i < BH_LRU_SIZE; i++) {
|
|
if (b->bhs[i])
|
|
return 1;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static void __evict_bh_lru(void *arg)
|
|
{
|
|
struct bh_lru *b = &get_cpu_var(bh_lrus);
|
|
struct buffer_head *bh = arg;
|
|
int i;
|
|
|
|
for (i = 0; i < BH_LRU_SIZE; i++) {
|
|
if (b->bhs[i] == bh) {
|
|
brelse(b->bhs[i]);
|
|
b->bhs[i] = NULL;
|
|
goto out;
|
|
}
|
|
}
|
|
out:
|
|
put_cpu_var(bh_lrus);
|
|
}
|
|
|
|
static bool bh_exists_in_lru(int cpu, void *arg)
|
|
{
|
|
struct bh_lru *b = per_cpu_ptr(&bh_lrus, cpu);
|
|
struct buffer_head *bh = arg;
|
|
int i;
|
|
|
|
for (i = 0; i < BH_LRU_SIZE; i++) {
|
|
if (b->bhs[i] == bh)
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
void invalidate_bh_lrus(void)
|
|
{
|
|
on_each_cpu_cond(has_bh_in_lru, invalidate_bh_lru, NULL, 1, GFP_KERNEL);
|
|
}
|
|
EXPORT_SYMBOL_GPL(invalidate_bh_lrus);
|
|
|
|
static void evict_bh_lrus(struct buffer_head *bh)
|
|
{
|
|
on_each_cpu_cond(bh_exists_in_lru, __evict_bh_lru, bh, 1, GFP_ATOMIC);
|
|
}
|
|
|
|
void set_bh_page(struct buffer_head *bh,
|
|
struct page *page, unsigned long offset)
|
|
{
|
|
bh->b_page = page;
|
|
BUG_ON(offset >= PAGE_SIZE);
|
|
if (PageHighMem(page))
|
|
/*
|
|
* This catches illegal uses and preserves the offset:
|
|
*/
|
|
bh->b_data = (char *)(0 + offset);
|
|
else
|
|
bh->b_data = page_address(page) + offset;
|
|
}
|
|
EXPORT_SYMBOL(set_bh_page);
|
|
|
|
/*
|
|
* Called when truncating a buffer on a page completely.
|
|
*/
|
|
|
|
/* Bits that are cleared during an invalidate */
|
|
#define BUFFER_FLAGS_DISCARD \
|
|
(1 << BH_Mapped | 1 << BH_New | 1 << BH_Req | \
|
|
1 << BH_Delay | 1 << BH_Unwritten)
|
|
|
|
static void discard_buffer(struct buffer_head * bh)
|
|
{
|
|
unsigned long b_state, b_state_old;
|
|
|
|
lock_buffer(bh);
|
|
clear_buffer_dirty(bh);
|
|
bh->b_bdev = NULL;
|
|
b_state = bh->b_state;
|
|
for (;;) {
|
|
b_state_old = cmpxchg(&bh->b_state, b_state,
|
|
(b_state & ~BUFFER_FLAGS_DISCARD));
|
|
if (b_state_old == b_state)
|
|
break;
|
|
b_state = b_state_old;
|
|
}
|
|
unlock_buffer(bh);
|
|
}
|
|
|
|
/**
|
|
* block_invalidatepage - invalidate part or all of a buffer-backed page
|
|
*
|
|
* @page: the page which is affected
|
|
* @offset: start of the range to invalidate
|
|
* @length: length of the range to invalidate
|
|
*
|
|
* block_invalidatepage() is called when all or part of the page has become
|
|
* invalidated by a truncate operation.
|
|
*
|
|
* block_invalidatepage() does not have to release all buffers, but it must
|
|
* ensure that no dirty buffer is left outside @offset and that no I/O
|
|
* is underway against any of the blocks which are outside the truncation
|
|
* point. Because the caller is about to free (and possibly reuse) those
|
|
* blocks on-disk.
|
|
*/
|
|
void block_invalidatepage(struct page *page, unsigned int offset,
|
|
unsigned int length)
|
|
{
|
|
struct buffer_head *head, *bh, *next;
|
|
unsigned int curr_off = 0;
|
|
unsigned int stop = length + offset;
|
|
|
|
BUG_ON(!PageLocked(page));
|
|
if (!page_has_buffers(page))
|
|
goto out;
|
|
|
|
/*
|
|
* Check for overflow
|
|
*/
|
|
BUG_ON(stop > PAGE_SIZE || stop < length);
|
|
|
|
head = page_buffers(page);
|
|
bh = head;
|
|
do {
|
|
unsigned int next_off = curr_off + bh->b_size;
|
|
next = bh->b_this_page;
|
|
|
|
/*
|
|
* Are we still fully in range ?
|
|
*/
|
|
if (next_off > stop)
|
|
goto out;
|
|
|
|
/*
|
|
* is this block fully invalidated?
|
|
*/
|
|
if (offset <= curr_off)
|
|
discard_buffer(bh);
|
|
curr_off = next_off;
|
|
bh = next;
|
|
} while (bh != head);
|
|
|
|
/*
|
|
* We release buffers only if the entire page is being invalidated.
|
|
* The get_block cached value has been unconditionally invalidated,
|
|
* so real IO is not possible anymore.
|
|
*/
|
|
if (length == PAGE_SIZE)
|
|
try_to_release_page(page, 0);
|
|
out:
|
|
return;
|
|
}
|
|
EXPORT_SYMBOL(block_invalidatepage);
|
|
|
|
|
|
/*
|
|
* We attach and possibly dirty the buffers atomically wrt
|
|
* __set_page_dirty_buffers() via private_lock. try_to_free_buffers
|
|
* is already excluded via the page lock.
|
|
*/
|
|
void create_empty_buffers(struct page *page,
|
|
unsigned long blocksize, unsigned long b_state)
|
|
{
|
|
struct buffer_head *bh, *head, *tail;
|
|
|
|
head = alloc_page_buffers(page, blocksize, true);
|
|
bh = head;
|
|
do {
|
|
bh->b_state |= b_state;
|
|
tail = bh;
|
|
bh = bh->b_this_page;
|
|
} while (bh);
|
|
tail->b_this_page = head;
|
|
|
|
spin_lock(&page->mapping->private_lock);
|
|
if (PageUptodate(page) || PageDirty(page)) {
|
|
bh = head;
|
|
do {
|
|
if (PageDirty(page))
|
|
set_buffer_dirty(bh);
|
|
if (PageUptodate(page))
|
|
set_buffer_uptodate(bh);
|
|
bh = bh->b_this_page;
|
|
} while (bh != head);
|
|
}
|
|
attach_page_buffers(page, head);
|
|
spin_unlock(&page->mapping->private_lock);
|
|
}
|
|
EXPORT_SYMBOL(create_empty_buffers);
|
|
|
|
/**
|
|
* clean_bdev_aliases: clean a range of buffers in block device
|
|
* @bdev: Block device to clean buffers in
|
|
* @block: Start of a range of blocks to clean
|
|
* @len: Number of blocks to clean
|
|
*
|
|
* We are taking a range of blocks for data and we don't want writeback of any
|
|
* buffer-cache aliases starting from return from this function and until the
|
|
* moment when something will explicitly mark the buffer dirty (hopefully that
|
|
* will not happen until we will free that block ;-) We don't even need to mark
|
|
* it not-uptodate - nobody can expect anything from a newly allocated buffer
|
|
* anyway. We used to use unmap_buffer() for such invalidation, but that was
|
|
* wrong. We definitely don't want to mark the alias unmapped, for example - it
|
|
* would confuse anyone who might pick it with bread() afterwards...
|
|
*
|
|
* Also.. Note that bforget() doesn't lock the buffer. So there can be
|
|
* writeout I/O going on against recently-freed buffers. We don't wait on that
|
|
* I/O in bforget() - it's more efficient to wait on the I/O only if we really
|
|
* need to. That happens here.
|
|
*/
|
|
void clean_bdev_aliases(struct block_device *bdev, sector_t block, sector_t len)
|
|
{
|
|
struct inode *bd_inode = bdev->bd_inode;
|
|
struct address_space *bd_mapping = bd_inode->i_mapping;
|
|
struct pagevec pvec;
|
|
pgoff_t index = block >> (PAGE_SHIFT - bd_inode->i_blkbits);
|
|
pgoff_t end;
|
|
int i, count;
|
|
struct buffer_head *bh;
|
|
struct buffer_head *head;
|
|
|
|
end = (block + len - 1) >> (PAGE_SHIFT - bd_inode->i_blkbits);
|
|
pagevec_init(&pvec);
|
|
while (pagevec_lookup_range(&pvec, bd_mapping, &index, end)) {
|
|
count = pagevec_count(&pvec);
|
|
for (i = 0; i < count; i++) {
|
|
struct page *page = pvec.pages[i];
|
|
|
|
if (!page_has_buffers(page))
|
|
continue;
|
|
/*
|
|
* We use page lock instead of bd_mapping->private_lock
|
|
* to pin buffers here since we can afford to sleep and
|
|
* it scales better than a global spinlock lock.
|
|
*/
|
|
lock_page(page);
|
|
/* Recheck when the page is locked which pins bhs */
|
|
if (!page_has_buffers(page))
|
|
goto unlock_page;
|
|
head = page_buffers(page);
|
|
bh = head;
|
|
do {
|
|
if (!buffer_mapped(bh) || (bh->b_blocknr < block))
|
|
goto next;
|
|
if (bh->b_blocknr >= block + len)
|
|
break;
|
|
clear_buffer_dirty(bh);
|
|
wait_on_buffer(bh);
|
|
clear_buffer_req(bh);
|
|
next:
|
|
bh = bh->b_this_page;
|
|
} while (bh != head);
|
|
unlock_page:
|
|
unlock_page(page);
|
|
}
|
|
pagevec_release(&pvec);
|
|
cond_resched();
|
|
/* End of range already reached? */
|
|
if (index > end || !index)
|
|
break;
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(clean_bdev_aliases);
|
|
|
|
/*
|
|
* Size is a power-of-two in the range 512..PAGE_SIZE,
|
|
* and the case we care about most is PAGE_SIZE.
|
|
*
|
|
* So this *could* possibly be written with those
|
|
* constraints in mind (relevant mostly if some
|
|
* architecture has a slow bit-scan instruction)
|
|
*/
|
|
static inline int block_size_bits(unsigned int blocksize)
|
|
{
|
|
return ilog2(blocksize);
|
|
}
|
|
|
|
static struct buffer_head *create_page_buffers(struct page *page, struct inode *inode, unsigned int b_state)
|
|
{
|
|
BUG_ON(!PageLocked(page));
|
|
|
|
if (!page_has_buffers(page))
|
|
create_empty_buffers(page, 1 << READ_ONCE(inode->i_blkbits),
|
|
b_state);
|
|
return page_buffers(page);
|
|
}
|
|
|
|
/*
|
|
* NOTE! All mapped/uptodate combinations are valid:
|
|
*
|
|
* Mapped Uptodate Meaning
|
|
*
|
|
* No No "unknown" - must do get_block()
|
|
* No Yes "hole" - zero-filled
|
|
* Yes No "allocated" - allocated on disk, not read in
|
|
* Yes Yes "valid" - allocated and up-to-date in memory.
|
|
*
|
|
* "Dirty" is valid only with the last case (mapped+uptodate).
|
|
*/
|
|
|
|
/*
|
|
* While block_write_full_page is writing back the dirty buffers under
|
|
* the page lock, whoever dirtied the buffers may decide to clean them
|
|
* again at any time. We handle that by only looking at the buffer
|
|
* state inside lock_buffer().
|
|
*
|
|
* If block_write_full_page() is called for regular writeback
|
|
* (wbc->sync_mode == WB_SYNC_NONE) then it will redirty a page which has a
|
|
* locked buffer. This only can happen if someone has written the buffer
|
|
* directly, with submit_bh(). At the address_space level PageWriteback
|
|
* prevents this contention from occurring.
|
|
*
|
|
* If block_write_full_page() is called with wbc->sync_mode ==
|
|
* WB_SYNC_ALL, the writes are posted using REQ_SYNC; this
|
|
* causes the writes to be flagged as synchronous writes.
|
|
*/
|
|
int __block_write_full_page(struct inode *inode, struct page *page,
|
|
get_block_t *get_block, struct writeback_control *wbc,
|
|
bh_end_io_t *handler)
|
|
{
|
|
int err;
|
|
sector_t block;
|
|
sector_t last_block;
|
|
struct buffer_head *bh, *head;
|
|
unsigned int blocksize, bbits;
|
|
int nr_underway = 0;
|
|
int write_flags = wbc_to_write_flags(wbc);
|
|
|
|
head = create_page_buffers(page, inode,
|
|
(1 << BH_Dirty)|(1 << BH_Uptodate));
|
|
|
|
/*
|
|
* Be very careful. We have no exclusion from __set_page_dirty_buffers
|
|
* here, and the (potentially unmapped) buffers may become dirty at
|
|
* any time. If a buffer becomes dirty here after we've inspected it
|
|
* then we just miss that fact, and the page stays dirty.
|
|
*
|
|
* Buffers outside i_size may be dirtied by __set_page_dirty_buffers;
|
|
* handle that here by just cleaning them.
|
|
*/
|
|
|
|
bh = head;
|
|
blocksize = bh->b_size;
|
|
bbits = block_size_bits(blocksize);
|
|
|
|
block = (sector_t)page->index << (PAGE_SHIFT - bbits);
|
|
last_block = (i_size_read(inode) - 1) >> bbits;
|
|
|
|
/*
|
|
* Get all the dirty buffers mapped to disk addresses and
|
|
* handle any aliases from the underlying blockdev's mapping.
|
|
*/
|
|
do {
|
|
if (block > last_block) {
|
|
/*
|
|
* mapped buffers outside i_size will occur, because
|
|
* this page can be outside i_size when there is a
|
|
* truncate in progress.
|
|
*/
|
|
/*
|
|
* The buffer was zeroed by block_write_full_page()
|
|
*/
|
|
clear_buffer_dirty(bh);
|
|
set_buffer_uptodate(bh);
|
|
} else if ((!buffer_mapped(bh) || buffer_delay(bh)) &&
|
|
buffer_dirty(bh)) {
|
|
WARN_ON(bh->b_size != blocksize);
|
|
err = get_block(inode, block, bh, 1);
|
|
if (err)
|
|
goto recover;
|
|
clear_buffer_delay(bh);
|
|
if (buffer_new(bh)) {
|
|
/* blockdev mappings never come here */
|
|
clear_buffer_new(bh);
|
|
clean_bdev_bh_alias(bh);
|
|
}
|
|
}
|
|
bh = bh->b_this_page;
|
|
block++;
|
|
} while (bh != head);
|
|
|
|
do {
|
|
if (!buffer_mapped(bh))
|
|
continue;
|
|
/*
|
|
* If it's a fully non-blocking write attempt and we cannot
|
|
* lock the buffer then redirty the page. Note that this can
|
|
* potentially cause a busy-wait loop from writeback threads
|
|
* and kswapd activity, but those code paths have their own
|
|
* higher-level throttling.
|
|
*/
|
|
if (wbc->sync_mode != WB_SYNC_NONE) {
|
|
lock_buffer(bh);
|
|
} else if (!trylock_buffer(bh)) {
|
|
redirty_page_for_writepage(wbc, page);
|
|
continue;
|
|
}
|
|
if (test_clear_buffer_dirty(bh)) {
|
|
mark_buffer_async_write_endio(bh, handler);
|
|
} else {
|
|
unlock_buffer(bh);
|
|
}
|
|
} while ((bh = bh->b_this_page) != head);
|
|
|
|
/*
|
|
* The page and its buffers are protected by PageWriteback(), so we can
|
|
* drop the bh refcounts early.
|
|
*/
|
|
BUG_ON(PageWriteback(page));
|
|
set_page_writeback(page);
|
|
|
|
do {
|
|
struct buffer_head *next = bh->b_this_page;
|
|
if (buffer_async_write(bh)) {
|
|
submit_bh_wbc(REQ_OP_WRITE, write_flags, bh,
|
|
inode->i_write_hint, wbc);
|
|
nr_underway++;
|
|
}
|
|
bh = next;
|
|
} while (bh != head);
|
|
unlock_page(page);
|
|
|
|
err = 0;
|
|
done:
|
|
if (nr_underway == 0) {
|
|
/*
|
|
* The page was marked dirty, but the buffers were
|
|
* clean. Someone wrote them back by hand with
|
|
* ll_rw_block/submit_bh. A rare case.
|
|
*/
|
|
end_page_writeback(page);
|
|
|
|
/*
|
|
* The page and buffer_heads can be released at any time from
|
|
* here on.
|
|
*/
|
|
}
|
|
return err;
|
|
|
|
recover:
|
|
/*
|
|
* ENOSPC, or some other error. We may already have added some
|
|
* blocks to the file, so we need to write these out to avoid
|
|
* exposing stale data.
|
|
* The page is currently locked and not marked for writeback
|
|
*/
|
|
bh = head;
|
|
/* Recovery: lock and submit the mapped buffers */
|
|
do {
|
|
if (buffer_mapped(bh) && buffer_dirty(bh) &&
|
|
!buffer_delay(bh)) {
|
|
lock_buffer(bh);
|
|
mark_buffer_async_write_endio(bh, handler);
|
|
} else {
|
|
/*
|
|
* The buffer may have been set dirty during
|
|
* attachment to a dirty page.
|
|
*/
|
|
clear_buffer_dirty(bh);
|
|
}
|
|
} while ((bh = bh->b_this_page) != head);
|
|
SetPageError(page);
|
|
BUG_ON(PageWriteback(page));
|
|
mapping_set_error(page->mapping, err);
|
|
set_page_writeback(page);
|
|
do {
|
|
struct buffer_head *next = bh->b_this_page;
|
|
if (buffer_async_write(bh)) {
|
|
clear_buffer_dirty(bh);
|
|
submit_bh_wbc(REQ_OP_WRITE, write_flags, bh,
|
|
inode->i_write_hint, wbc);
|
|
nr_underway++;
|
|
}
|
|
bh = next;
|
|
} while (bh != head);
|
|
unlock_page(page);
|
|
goto done;
|
|
}
|
|
EXPORT_SYMBOL(__block_write_full_page);
|
|
|
|
/*
|
|
* If a page has any new buffers, zero them out here, and mark them uptodate
|
|
* and dirty so they'll be written out (in order to prevent uninitialised
|
|
* block data from leaking). And clear the new bit.
|
|
*/
|
|
void page_zero_new_buffers(struct page *page, unsigned from, unsigned to)
|
|
{
|
|
unsigned int block_start, block_end;
|
|
struct buffer_head *head, *bh;
|
|
|
|
BUG_ON(!PageLocked(page));
|
|
if (!page_has_buffers(page))
|
|
return;
|
|
|
|
bh = head = page_buffers(page);
|
|
block_start = 0;
|
|
do {
|
|
block_end = block_start + bh->b_size;
|
|
|
|
if (buffer_new(bh)) {
|
|
if (block_end > from && block_start < to) {
|
|
if (!PageUptodate(page)) {
|
|
unsigned start, size;
|
|
|
|
start = max(from, block_start);
|
|
size = min(to, block_end) - start;
|
|
|
|
zero_user(page, start, size);
|
|
set_buffer_uptodate(bh);
|
|
}
|
|
|
|
clear_buffer_new(bh);
|
|
mark_buffer_dirty(bh);
|
|
}
|
|
}
|
|
|
|
block_start = block_end;
|
|
bh = bh->b_this_page;
|
|
} while (bh != head);
|
|
}
|
|
EXPORT_SYMBOL(page_zero_new_buffers);
|
|
|
|
static void
|
|
iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh,
|
|
struct iomap *iomap)
|
|
{
|
|
loff_t offset = block << inode->i_blkbits;
|
|
|
|
bh->b_bdev = iomap->bdev;
|
|
|
|
/*
|
|
* Block points to offset in file we need to map, iomap contains
|
|
* the offset at which the map starts. If the map ends before the
|
|
* current block, then do not map the buffer and let the caller
|
|
* handle it.
|
|
*/
|
|
BUG_ON(offset >= iomap->offset + iomap->length);
|
|
|
|
switch (iomap->type) {
|
|
case IOMAP_HOLE:
|
|
/*
|
|
* If the buffer is not up to date or beyond the current EOF,
|
|
* we need to mark it as new to ensure sub-block zeroing is
|
|
* executed if necessary.
|
|
*/
|
|
if (!buffer_uptodate(bh) ||
|
|
(offset >= i_size_read(inode)))
|
|
set_buffer_new(bh);
|
|
break;
|
|
case IOMAP_DELALLOC:
|
|
if (!buffer_uptodate(bh) ||
|
|
(offset >= i_size_read(inode)))
|
|
set_buffer_new(bh);
|
|
set_buffer_uptodate(bh);
|
|
set_buffer_mapped(bh);
|
|
set_buffer_delay(bh);
|
|
break;
|
|
case IOMAP_UNWRITTEN:
|
|
/*
|
|
* For unwritten regions, we always need to ensure that regions
|
|
* in the block we are not writing to are zeroed. Mark the
|
|
* buffer as new to ensure this.
|
|
*/
|
|
set_buffer_new(bh);
|
|
set_buffer_unwritten(bh);
|
|
/* FALLTHRU */
|
|
case IOMAP_MAPPED:
|
|
if ((iomap->flags & IOMAP_F_NEW) ||
|
|
offset >= i_size_read(inode))
|
|
set_buffer_new(bh);
|
|
bh->b_blocknr = (iomap->addr + offset - iomap->offset) >>
|
|
inode->i_blkbits;
|
|
set_buffer_mapped(bh);
|
|
break;
|
|
}
|
|
}
|
|
|
|
int __block_write_begin_int(struct page *page, loff_t pos, unsigned len,
|
|
get_block_t *get_block, struct iomap *iomap)
|
|
{
|
|
unsigned from = pos & (PAGE_SIZE - 1);
|
|
unsigned to = from + len;
|
|
struct inode *inode = page->mapping->host;
|
|
unsigned block_start, block_end;
|
|
sector_t block;
|
|
int err = 0;
|
|
unsigned blocksize, bbits;
|
|
struct buffer_head *bh, *head, *wait[2], **wait_bh=wait;
|
|
|
|
BUG_ON(!PageLocked(page));
|
|
BUG_ON(from > PAGE_SIZE);
|
|
BUG_ON(to > PAGE_SIZE);
|
|
BUG_ON(from > to);
|
|
|
|
head = create_page_buffers(page, inode, 0);
|
|
blocksize = head->b_size;
|
|
bbits = block_size_bits(blocksize);
|
|
|
|
block = (sector_t)page->index << (PAGE_SHIFT - bbits);
|
|
|
|
for(bh = head, block_start = 0; bh != head || !block_start;
|
|
block++, block_start=block_end, bh = bh->b_this_page) {
|
|
block_end = block_start + blocksize;
|
|
if (block_end <= from || block_start >= to) {
|
|
if (PageUptodate(page)) {
|
|
if (!buffer_uptodate(bh))
|
|
set_buffer_uptodate(bh);
|
|
}
|
|
continue;
|
|
}
|
|
if (buffer_new(bh))
|
|
clear_buffer_new(bh);
|
|
if (!buffer_mapped(bh)) {
|
|
WARN_ON(bh->b_size != blocksize);
|
|
if (get_block) {
|
|
err = get_block(inode, block, bh, 1);
|
|
if (err)
|
|
break;
|
|
} else {
|
|
iomap_to_bh(inode, block, bh, iomap);
|
|
}
|
|
|
|
if (buffer_new(bh)) {
|
|
clean_bdev_bh_alias(bh);
|
|
if (PageUptodate(page)) {
|
|
clear_buffer_new(bh);
|
|
set_buffer_uptodate(bh);
|
|
mark_buffer_dirty(bh);
|
|
continue;
|
|
}
|
|
if (block_end > to || block_start < from)
|
|
zero_user_segments(page,
|
|
to, block_end,
|
|
block_start, from);
|
|
continue;
|
|
}
|
|
}
|
|
if (PageUptodate(page)) {
|
|
if (!buffer_uptodate(bh))
|
|
set_buffer_uptodate(bh);
|
|
continue;
|
|
}
|
|
if (!buffer_uptodate(bh) && !buffer_delay(bh) &&
|
|
!buffer_unwritten(bh) &&
|
|
(block_start < from || block_end > to)) {
|
|
ll_rw_block(REQ_OP_READ, 0, 1, &bh);
|
|
*wait_bh++=bh;
|
|
}
|
|
}
|
|
/*
|
|
* If we issued read requests - let them complete.
|
|
*/
|
|
while(wait_bh > wait) {
|
|
wait_on_buffer(*--wait_bh);
|
|
if (!buffer_uptodate(*wait_bh))
|
|
err = -EIO;
|
|
}
|
|
if (unlikely(err))
|
|
page_zero_new_buffers(page, from, to);
|
|
return err;
|
|
}
|
|
|
|
int __block_write_begin(struct page *page, loff_t pos, unsigned len,
|
|
get_block_t *get_block)
|
|
{
|
|
return __block_write_begin_int(page, pos, len, get_block, NULL);
|
|
}
|
|
EXPORT_SYMBOL(__block_write_begin);
|
|
|
|
static int __block_commit_write(struct inode *inode, struct page *page,
|
|
unsigned from, unsigned to)
|
|
{
|
|
unsigned block_start, block_end;
|
|
int partial = 0;
|
|
unsigned blocksize;
|
|
struct buffer_head *bh, *head;
|
|
|
|
bh = head = page_buffers(page);
|
|
blocksize = bh->b_size;
|
|
|
|
block_start = 0;
|
|
do {
|
|
block_end = block_start + blocksize;
|
|
if (block_end <= from || block_start >= to) {
|
|
if (!buffer_uptodate(bh))
|
|
partial = 1;
|
|
} else {
|
|
set_buffer_uptodate(bh);
|
|
mark_buffer_dirty(bh);
|
|
}
|
|
clear_buffer_new(bh);
|
|
|
|
block_start = block_end;
|
|
bh = bh->b_this_page;
|
|
} while (bh != head);
|
|
|
|
/*
|
|
* If this is a partial write which happened to make all buffers
|
|
* uptodate then we can optimize away a bogus readpage() for
|
|
* the next read(). Here we 'discover' whether the page went
|
|
* uptodate as a result of this (potentially partial) write.
|
|
*/
|
|
if (!partial)
|
|
SetPageUptodate(page);
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* block_write_begin takes care of the basic task of block allocation and
|
|
* bringing partial write blocks uptodate first.
|
|
*
|
|
* The filesystem needs to handle block truncation upon failure.
|
|
*/
|
|
int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len,
|
|
unsigned flags, struct page **pagep, get_block_t *get_block)
|
|
{
|
|
pgoff_t index = pos >> PAGE_SHIFT;
|
|
struct page *page;
|
|
int status;
|
|
|
|
page = grab_cache_page_write_begin(mapping, index, flags);
|
|
if (!page)
|
|
return -ENOMEM;
|
|
|
|
status = __block_write_begin(page, pos, len, get_block);
|
|
if (unlikely(status)) {
|
|
unlock_page(page);
|
|
put_page(page);
|
|
page = NULL;
|
|
}
|
|
|
|
*pagep = page;
|
|
return status;
|
|
}
|
|
EXPORT_SYMBOL(block_write_begin);
|
|
|
|
int block_write_end(struct file *file, struct address_space *mapping,
|
|
loff_t pos, unsigned len, unsigned copied,
|
|
struct page *page, void *fsdata)
|
|
{
|
|
struct inode *inode = mapping->host;
|
|
unsigned start;
|
|
|
|
start = pos & (PAGE_SIZE - 1);
|
|
|
|
if (unlikely(copied < len)) {
|
|
/*
|
|
* The buffers that were written will now be uptodate, so we
|
|
* don't have to worry about a readpage reading them and
|
|
* overwriting a partial write. However if we have encountered
|
|
* a short write and only partially written into a buffer, it
|
|
* will not be marked uptodate, so a readpage might come in and
|
|
* destroy our partial write.
|
|
*
|
|
* Do the simplest thing, and just treat any short write to a
|
|
* non uptodate page as a zero-length write, and force the
|
|
* caller to redo the whole thing.
|
|
*/
|
|
if (!PageUptodate(page))
|
|
copied = 0;
|
|
|
|
page_zero_new_buffers(page, start+copied, start+len);
|
|
}
|
|
flush_dcache_page(page);
|
|
|
|
/* This could be a short (even 0-length) commit */
|
|
__block_commit_write(inode, page, start, start+copied);
|
|
|
|
return copied;
|
|
}
|
|
EXPORT_SYMBOL(block_write_end);
|
|
|
|
int generic_write_end(struct file *file, struct address_space *mapping,
|
|
loff_t pos, unsigned len, unsigned copied,
|
|
struct page *page, void *fsdata)
|
|
{
|
|
struct inode *inode = mapping->host;
|
|
loff_t old_size = inode->i_size;
|
|
bool i_size_changed = false;
|
|
|
|
copied = block_write_end(file, mapping, pos, len, copied, page, fsdata);
|
|
|
|
/*
|
|
* No need to use i_size_read() here, the i_size cannot change under us
|
|
* because we hold i_rwsem.
|
|
*
|
|
* But it's important to update i_size while still holding page lock:
|
|
* page writeout could otherwise come in and zero beyond i_size.
|
|
*/
|
|
if (pos + copied > inode->i_size) {
|
|
i_size_write(inode, pos + copied);
|
|
i_size_changed = true;
|
|
}
|
|
|
|
unlock_page(page);
|
|
put_page(page);
|
|
|
|
if (old_size < pos)
|
|
pagecache_isize_extended(inode, old_size, pos);
|
|
/*
|
|
* Don't mark the inode dirty under page lock. First, it unnecessarily
|
|
* makes the holding time of page lock longer. Second, it forces lock
|
|
* ordering of page lock and transaction start for journaling
|
|
* filesystems.
|
|
*/
|
|
if (i_size_changed)
|
|
mark_inode_dirty(inode);
|
|
return copied;
|
|
}
|
|
EXPORT_SYMBOL(generic_write_end);
|
|
|
|
/*
|
|
* block_is_partially_uptodate checks whether buffers within a page are
|
|
* uptodate or not.
|
|
*
|
|
* Returns true if all buffers which correspond to a file portion
|
|
* we want to read are uptodate.
|
|
*/
|
|
int block_is_partially_uptodate(struct page *page, unsigned long from,
|
|
unsigned long count)
|
|
{
|
|
unsigned block_start, block_end, blocksize;
|
|
unsigned to;
|
|
struct buffer_head *bh, *head;
|
|
int ret = 1;
|
|
|
|
if (!page_has_buffers(page))
|
|
return 0;
|
|
|
|
head = page_buffers(page);
|
|
blocksize = head->b_size;
|
|
to = min_t(unsigned, PAGE_SIZE - from, count);
|
|
to = from + to;
|
|
if (from < blocksize && to > PAGE_SIZE - blocksize)
|
|
return 0;
|
|
|
|
bh = head;
|
|
block_start = 0;
|
|
do {
|
|
block_end = block_start + blocksize;
|
|
if (block_end > from && block_start < to) {
|
|
if (!buffer_uptodate(bh)) {
|
|
ret = 0;
|
|
break;
|
|
}
|
|
if (block_end >= to)
|
|
break;
|
|
}
|
|
block_start = block_end;
|
|
bh = bh->b_this_page;
|
|
} while (bh != head);
|
|
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL(block_is_partially_uptodate);
|
|
|
|
/*
|
|
* Generic "read page" function for block devices that have the normal
|
|
* get_block functionality. This is most of the block device filesystems.
|
|
* Reads the page asynchronously --- the unlock_buffer() and
|
|
* set/clear_buffer_uptodate() functions propagate buffer state into the
|
|
* page struct once IO has completed.
|
|
*/
|
|
int block_read_full_page(struct page *page, get_block_t *get_block)
|
|
{
|
|
struct inode *inode = page->mapping->host;
|
|
sector_t iblock, lblock;
|
|
struct buffer_head *bh, *head, *arr[MAX_BUF_PER_PAGE];
|
|
unsigned int blocksize, bbits;
|
|
int nr, i;
|
|
int fully_mapped = 1;
|
|
|
|
head = create_page_buffers(page, inode, 0);
|
|
blocksize = head->b_size;
|
|
bbits = block_size_bits(blocksize);
|
|
|
|
iblock = (sector_t)page->index << (PAGE_SHIFT - bbits);
|
|
lblock = (i_size_read(inode)+blocksize-1) >> bbits;
|
|
bh = head;
|
|
nr = 0;
|
|
i = 0;
|
|
|
|
do {
|
|
if (buffer_uptodate(bh))
|
|
continue;
|
|
|
|
if (!buffer_mapped(bh)) {
|
|
int err = 0;
|
|
|
|
fully_mapped = 0;
|
|
if (iblock < lblock) {
|
|
WARN_ON(bh->b_size != blocksize);
|
|
err = get_block(inode, iblock, bh, 0);
|
|
if (err)
|
|
SetPageError(page);
|
|
}
|
|
if (!buffer_mapped(bh)) {
|
|
zero_user(page, i * blocksize, blocksize);
|
|
if (!err)
|
|
set_buffer_uptodate(bh);
|
|
continue;
|
|
}
|
|
/*
|
|
* get_block() might have updated the buffer
|
|
* synchronously
|
|
*/
|
|
if (buffer_uptodate(bh))
|
|
continue;
|
|
}
|
|
arr[nr++] = bh;
|
|
} while (i++, iblock++, (bh = bh->b_this_page) != head);
|
|
|
|
if (fully_mapped)
|
|
SetPageMappedToDisk(page);
|
|
|
|
if (!nr) {
|
|
/*
|
|
* All buffers are uptodate - we can set the page uptodate
|
|
* as well. But not if get_block() returned an error.
|
|
*/
|
|
if (!PageError(page))
|
|
SetPageUptodate(page);
|
|
unlock_page(page);
|
|
return 0;
|
|
}
|
|
|
|
/* Stage two: lock the buffers */
|
|
for (i = 0; i < nr; i++) {
|
|
bh = arr[i];
|
|
lock_buffer(bh);
|
|
mark_buffer_async_read(bh);
|
|
}
|
|
|
|
/*
|
|
* Stage 3: start the IO. Check for uptodateness
|
|
* inside the buffer lock in case another process reading
|
|
* the underlying blockdev brought it uptodate (the sct fix).
|
|
*/
|
|
for (i = 0; i < nr; i++) {
|
|
bh = arr[i];
|
|
if (buffer_uptodate(bh))
|
|
end_buffer_async_read(bh, 1);
|
|
else
|
|
submit_bh(REQ_OP_READ, 0, bh);
|
|
}
|
|
return 0;
|
|
}
|
|
EXPORT_SYMBOL(block_read_full_page);
|
|
|
|
/* utility function for filesystems that need to do work on expanding
|
|
* truncates. Uses filesystem pagecache writes to allow the filesystem to
|
|
* deal with the hole.
|
|
*/
|
|
int generic_cont_expand_simple(struct inode *inode, loff_t size)
|
|
{
|
|
struct address_space *mapping = inode->i_mapping;
|
|
struct page *page;
|
|
void *fsdata;
|
|
int err;
|
|
|
|
err = inode_newsize_ok(inode, size);
|
|
if (err)
|
|
goto out;
|
|
|
|
err = pagecache_write_begin(NULL, mapping, size, 0,
|
|
AOP_FLAG_CONT_EXPAND, &page, &fsdata);
|
|
if (err)
|
|
goto out;
|
|
|
|
err = pagecache_write_end(NULL, mapping, size, 0, 0, page, fsdata);
|
|
BUG_ON(err > 0);
|
|
|
|
out:
|
|
return err;
|
|
}
|
|
EXPORT_SYMBOL(generic_cont_expand_simple);
|
|
|
|
static int cont_expand_zero(struct file *file, struct address_space *mapping,
|
|
loff_t pos, loff_t *bytes)
|
|
{
|
|
struct inode *inode = mapping->host;
|
|
unsigned int blocksize = i_blocksize(inode);
|
|
struct page *page;
|
|
void *fsdata;
|
|
pgoff_t index, curidx;
|
|
loff_t curpos;
|
|
unsigned zerofrom, offset, len;
|
|
int err = 0;
|
|
|
|
index = pos >> PAGE_SHIFT;
|
|
offset = pos & ~PAGE_MASK;
|
|
|
|
while (index > (curidx = (curpos = *bytes)>>PAGE_SHIFT)) {
|
|
zerofrom = curpos & ~PAGE_MASK;
|
|
if (zerofrom & (blocksize-1)) {
|
|
*bytes |= (blocksize-1);
|
|
(*bytes)++;
|
|
}
|
|
len = PAGE_SIZE - zerofrom;
|
|
|
|
err = pagecache_write_begin(file, mapping, curpos, len, 0,
|
|
&page, &fsdata);
|
|
if (err)
|
|
goto out;
|
|
zero_user(page, zerofrom, len);
|
|
err = pagecache_write_end(file, mapping, curpos, len, len,
|
|
page, fsdata);
|
|
if (err < 0)
|
|
goto out;
|
|
BUG_ON(err != len);
|
|
err = 0;
|
|
|
|
balance_dirty_pages_ratelimited(mapping);
|
|
|
|
if (fatal_signal_pending(current)) {
|
|
err = -EINTR;
|
|
goto out;
|
|
}
|
|
}
|
|
|
|
/* page covers the boundary, find the boundary offset */
|
|
if (index == curidx) {
|
|
zerofrom = curpos & ~PAGE_MASK;
|
|
/* if we will expand the thing last block will be filled */
|
|
if (offset <= zerofrom) {
|
|
goto out;
|
|
}
|
|
if (zerofrom & (blocksize-1)) {
|
|
*bytes |= (blocksize-1);
|
|
(*bytes)++;
|
|
}
|
|
len = offset - zerofrom;
|
|
|
|
err = pagecache_write_begin(file, mapping, curpos, len, 0,
|
|
&page, &fsdata);
|
|
if (err)
|
|
goto out;
|
|
zero_user(page, zerofrom, len);
|
|
err = pagecache_write_end(file, mapping, curpos, len, len,
|
|
page, fsdata);
|
|
if (err < 0)
|
|
goto out;
|
|
BUG_ON(err != len);
|
|
err = 0;
|
|
}
|
|
out:
|
|
return err;
|
|
}
|
|
|
|
/*
|
|
* For moronic filesystems that do not allow holes in file.
|
|
* We may have to extend the file.
|
|
*/
|
|
int cont_write_begin(struct file *file, struct address_space *mapping,
|
|
loff_t pos, unsigned len, unsigned flags,
|
|
struct page **pagep, void **fsdata,
|
|
get_block_t *get_block, loff_t *bytes)
|
|
{
|
|
struct inode *inode = mapping->host;
|
|
unsigned int blocksize = i_blocksize(inode);
|
|
unsigned int zerofrom;
|
|
int err;
|
|
|
|
err = cont_expand_zero(file, mapping, pos, bytes);
|
|
if (err)
|
|
return err;
|
|
|
|
zerofrom = *bytes & ~PAGE_MASK;
|
|
if (pos+len > *bytes && zerofrom & (blocksize-1)) {
|
|
*bytes |= (blocksize-1);
|
|
(*bytes)++;
|
|
}
|
|
|
|
return block_write_begin(mapping, pos, len, flags, pagep, get_block);
|
|
}
|
|
EXPORT_SYMBOL(cont_write_begin);
|
|
|
|
int block_commit_write(struct page *page, unsigned from, unsigned to)
|
|
{
|
|
struct inode *inode = page->mapping->host;
|
|
__block_commit_write(inode,page,from,to);
|
|
return 0;
|
|
}
|
|
EXPORT_SYMBOL(block_commit_write);
|
|
|
|
/*
|
|
* block_page_mkwrite() is not allowed to change the file size as it gets
|
|
* called from a page fault handler when a page is first dirtied. Hence we must
|
|
* be careful to check for EOF conditions here. We set the page up correctly
|
|
* for a written page which means we get ENOSPC checking when writing into
|
|
* holes and correct delalloc and unwritten extent mapping on filesystems that
|
|
* support these features.
|
|
*
|
|
* We are not allowed to take the i_mutex here so we have to play games to
|
|
* protect against truncate races as the page could now be beyond EOF. Because
|
|
* truncate writes the inode size before removing pages, once we have the
|
|
* page lock we can determine safely if the page is beyond EOF. If it is not
|
|
* beyond EOF, then the page is guaranteed safe against truncation until we
|
|
* unlock the page.
|
|
*
|
|
* Direct callers of this function should protect against filesystem freezing
|
|
* using sb_start_pagefault() - sb_end_pagefault() functions.
|
|
*/
|
|
int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
|
|
get_block_t get_block)
|
|
{
|
|
struct page *page = vmf->page;
|
|
struct inode *inode = file_inode(vma->vm_file);
|
|
unsigned long end;
|
|
loff_t size;
|
|
int ret;
|
|
|
|
lock_page(page);
|
|
size = i_size_read(inode);
|
|
if ((page->mapping != inode->i_mapping) ||
|
|
(page_offset(page) > size)) {
|
|
/* We overload EFAULT to mean page got truncated */
|
|
ret = -EFAULT;
|
|
goto out_unlock;
|
|
}
|
|
|
|
/* page is wholly or partially inside EOF */
|
|
if (((page->index + 1) << PAGE_SHIFT) > size)
|
|
end = size & ~PAGE_MASK;
|
|
else
|
|
end = PAGE_SIZE;
|
|
|
|
ret = __block_write_begin(page, 0, end, get_block);
|
|
if (!ret)
|
|
ret = block_commit_write(page, 0, end);
|
|
|
|
if (unlikely(ret < 0))
|
|
goto out_unlock;
|
|
set_page_dirty(page);
|
|
wait_for_stable_page(page);
|
|
return 0;
|
|
out_unlock:
|
|
unlock_page(page);
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL(block_page_mkwrite);
|
|
|
|
/*
|
|
* nobh_write_begin()'s prereads are special: the buffer_heads are freed
|
|
* immediately, while under the page lock. So it needs a special end_io
|
|
* handler which does not touch the bh after unlocking it.
|
|
*/
|
|
static void end_buffer_read_nobh(struct buffer_head *bh, int uptodate)
|
|
{
|
|
__end_buffer_read_notouch(bh, uptodate);
|
|
}
|
|
|
|
/*
|
|
* Attach the singly-linked list of buffers created by nobh_write_begin, to
|
|
* the page (converting it to circular linked list and taking care of page
|
|
* dirty races).
|
|
*/
|
|
static void attach_nobh_buffers(struct page *page, struct buffer_head *head)
|
|
{
|
|
struct buffer_head *bh;
|
|
|
|
BUG_ON(!PageLocked(page));
|
|
|
|
spin_lock(&page->mapping->private_lock);
|
|
bh = head;
|
|
do {
|
|
if (PageDirty(page))
|
|
set_buffer_dirty(bh);
|
|
if (!bh->b_this_page)
|
|
bh->b_this_page = head;
|
|
bh = bh->b_this_page;
|
|
} while (bh != head);
|
|
attach_page_buffers(page, head);
|
|
spin_unlock(&page->mapping->private_lock);
|
|
}
|
|
|
|
/*
|
|
* On entry, the page is fully not uptodate.
|
|
* On exit the page is fully uptodate in the areas outside (from,to)
|
|
* The filesystem needs to handle block truncation upon failure.
|
|
*/
|
|
int nobh_write_begin(struct address_space *mapping,
|
|
loff_t pos, unsigned len, unsigned flags,
|
|
struct page **pagep, void **fsdata,
|
|
get_block_t *get_block)
|
|
{
|
|
struct inode *inode = mapping->host;
|
|
const unsigned blkbits = inode->i_blkbits;
|
|
const unsigned blocksize = 1 << blkbits;
|
|
struct buffer_head *head, *bh;
|
|
struct page *page;
|
|
pgoff_t index;
|
|
unsigned from, to;
|
|
unsigned block_in_page;
|
|
unsigned block_start, block_end;
|
|
sector_t block_in_file;
|
|
int nr_reads = 0;
|
|
int ret = 0;
|
|
int is_mapped_to_disk = 1;
|
|
|
|
index = pos >> PAGE_SHIFT;
|
|
from = pos & (PAGE_SIZE - 1);
|
|
to = from + len;
|
|
|
|
page = grab_cache_page_write_begin(mapping, index, flags);
|
|
if (!page)
|
|
return -ENOMEM;
|
|
*pagep = page;
|
|
*fsdata = NULL;
|
|
|
|
if (page_has_buffers(page)) {
|
|
ret = __block_write_begin(page, pos, len, get_block);
|
|
if (unlikely(ret))
|
|
goto out_release;
|
|
return ret;
|
|
}
|
|
|
|
if (PageMappedToDisk(page))
|
|
return 0;
|
|
|
|
/*
|
|
* Allocate buffers so that we can keep track of state, and potentially
|
|
* attach them to the page if an error occurs. In the common case of
|
|
* no error, they will just be freed again without ever being attached
|
|
* to the page (which is all OK, because we're under the page lock).
|
|
*
|
|
* Be careful: the buffer linked list is a NULL terminated one, rather
|
|
* than the circular one we're used to.
|
|
*/
|
|
head = alloc_page_buffers(page, blocksize, false);
|
|
if (!head) {
|
|
ret = -ENOMEM;
|
|
goto out_release;
|
|
}
|
|
|
|
block_in_file = (sector_t)page->index << (PAGE_SHIFT - blkbits);
|
|
|
|
/*
|
|
* We loop across all blocks in the page, whether or not they are
|
|
* part of the affected region. This is so we can discover if the
|
|
* page is fully mapped-to-disk.
|
|
*/
|
|
for (block_start = 0, block_in_page = 0, bh = head;
|
|
block_start < PAGE_SIZE;
|
|
block_in_page++, block_start += blocksize, bh = bh->b_this_page) {
|
|
int create;
|
|
|
|
block_end = block_start + blocksize;
|
|
bh->b_state = 0;
|
|
create = 1;
|
|
if (block_start >= to)
|
|
create = 0;
|
|
ret = get_block(inode, block_in_file + block_in_page,
|
|
bh, create);
|
|
if (ret)
|
|
goto failed;
|
|
if (!buffer_mapped(bh))
|
|
is_mapped_to_disk = 0;
|
|
if (buffer_new(bh))
|
|
clean_bdev_bh_alias(bh);
|
|
if (PageUptodate(page)) {
|
|
set_buffer_uptodate(bh);
|
|
continue;
|
|
}
|
|
if (buffer_new(bh) || !buffer_mapped(bh)) {
|
|
zero_user_segments(page, block_start, from,
|
|
to, block_end);
|
|
continue;
|
|
}
|
|
if (buffer_uptodate(bh))
|
|
continue; /* reiserfs does this */
|
|
if (block_start < from || block_end > to) {
|
|
lock_buffer(bh);
|
|
bh->b_end_io = end_buffer_read_nobh;
|
|
submit_bh(REQ_OP_READ, 0, bh);
|
|
nr_reads++;
|
|
}
|
|
}
|
|
|
|
if (nr_reads) {
|
|
/*
|
|
* The page is locked, so these buffers are protected from
|
|
* any VM or truncate activity. Hence we don't need to care
|
|
* for the buffer_head refcounts.
|
|
*/
|
|
for (bh = head; bh; bh = bh->b_this_page) {
|
|
wait_on_buffer(bh);
|
|
if (!buffer_uptodate(bh))
|
|
ret = -EIO;
|
|
}
|
|
if (ret)
|
|
goto failed;
|
|
}
|
|
|
|
if (is_mapped_to_disk)
|
|
SetPageMappedToDisk(page);
|
|
|
|
*fsdata = head; /* to be released by nobh_write_end */
|
|
|
|
return 0;
|
|
|
|
failed:
|
|
BUG_ON(!ret);
|
|
/*
|
|
* Error recovery is a bit difficult. We need to zero out blocks that
|
|
* were newly allocated, and dirty them to ensure they get written out.
|
|
* Buffers need to be attached to the page at this point, otherwise
|
|
* the handling of potential IO errors during writeout would be hard
|
|
* (could try doing synchronous writeout, but what if that fails too?)
|
|
*/
|
|
attach_nobh_buffers(page, head);
|
|
page_zero_new_buffers(page, from, to);
|
|
|
|
out_release:
|
|
unlock_page(page);
|
|
put_page(page);
|
|
*pagep = NULL;
|
|
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL(nobh_write_begin);
|
|
|
|
int nobh_write_end(struct file *file, struct address_space *mapping,
|
|
loff_t pos, unsigned len, unsigned copied,
|
|
struct page *page, void *fsdata)
|
|
{
|
|
struct inode *inode = page->mapping->host;
|
|
struct buffer_head *head = fsdata;
|
|
struct buffer_head *bh;
|
|
BUG_ON(fsdata != NULL && page_has_buffers(page));
|
|
|
|
if (unlikely(copied < len) && head)
|
|
attach_nobh_buffers(page, head);
|
|
if (page_has_buffers(page))
|
|
return generic_write_end(file, mapping, pos, len,
|
|
copied, page, fsdata);
|
|
|
|
SetPageUptodate(page);
|
|
set_page_dirty(page);
|
|
if (pos+copied > inode->i_size) {
|
|
i_size_write(inode, pos+copied);
|
|
mark_inode_dirty(inode);
|
|
}
|
|
|
|
unlock_page(page);
|
|
put_page(page);
|
|
|
|
while (head) {
|
|
bh = head;
|
|
head = head->b_this_page;
|
|
free_buffer_head(bh);
|
|
}
|
|
|
|
return copied;
|
|
}
|
|
EXPORT_SYMBOL(nobh_write_end);
|
|
|
|
/*
|
|
* nobh_writepage() - based on block_full_write_page() except
|
|
* that it tries to operate without attaching bufferheads to
|
|
* the page.
|
|
*/
|
|
int nobh_writepage(struct page *page, get_block_t *get_block,
|
|
struct writeback_control *wbc)
|
|
{
|
|
struct inode * const inode = page->mapping->host;
|
|
loff_t i_size = i_size_read(inode);
|
|
const pgoff_t end_index = i_size >> PAGE_SHIFT;
|
|
unsigned offset;
|
|
int ret;
|
|
|
|
/* Is the page fully inside i_size? */
|
|
if (page->index < end_index)
|
|
goto out;
|
|
|
|
/* Is the page fully outside i_size? (truncate in progress) */
|
|
offset = i_size & (PAGE_SIZE-1);
|
|
if (page->index >= end_index+1 || !offset) {
|
|
/*
|
|
* The page may have dirty, unmapped buffers. For example,
|
|
* they may have been added in ext3_writepage(). Make them
|
|
* freeable here, so the page does not leak.
|
|
*/
|
|
#if 0
|
|
/* Not really sure about this - do we need this ? */
|
|
if (page->mapping->a_ops->invalidatepage)
|
|
page->mapping->a_ops->invalidatepage(page, offset);
|
|
#endif
|
|
unlock_page(page);
|
|
return 0; /* don't care */
|
|
}
|
|
|
|
/*
|
|
* The page straddles i_size. It must be zeroed out on each and every
|
|
* writepage invocation because it may be mmapped. "A file is mapped
|
|
* in multiples of the page size. For a file that is not a multiple of
|
|
* the page size, the remaining memory is zeroed when mapped, and
|
|
* writes to that region are not written out to the file."
|
|
*/
|
|
zero_user_segment(page, offset, PAGE_SIZE);
|
|
out:
|
|
ret = mpage_writepage(page, get_block, wbc);
|
|
if (ret == -EAGAIN)
|
|
ret = __block_write_full_page(inode, page, get_block, wbc,
|
|
end_buffer_async_write);
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL(nobh_writepage);
|
|
|
|
int nobh_truncate_page(struct address_space *mapping,
|
|
loff_t from, get_block_t *get_block)
|
|
{
|
|
pgoff_t index = from >> PAGE_SHIFT;
|
|
unsigned offset = from & (PAGE_SIZE-1);
|
|
unsigned blocksize;
|
|
sector_t iblock;
|
|
unsigned length, pos;
|
|
struct inode *inode = mapping->host;
|
|
struct page *page;
|
|
struct buffer_head map_bh;
|
|
int err;
|
|
|
|
blocksize = i_blocksize(inode);
|
|
length = offset & (blocksize - 1);
|
|
|
|
/* Block boundary? Nothing to do */
|
|
if (!length)
|
|
return 0;
|
|
|
|
length = blocksize - length;
|
|
iblock = (sector_t)index << (PAGE_SHIFT - inode->i_blkbits);
|
|
|
|
page = grab_cache_page(mapping, index);
|
|
err = -ENOMEM;
|
|
if (!page)
|
|
goto out;
|
|
|
|
if (page_has_buffers(page)) {
|
|
has_buffers:
|
|
unlock_page(page);
|
|
put_page(page);
|
|
return block_truncate_page(mapping, from, get_block);
|
|
}
|
|
|
|
/* Find the buffer that contains "offset" */
|
|
pos = blocksize;
|
|
while (offset >= pos) {
|
|
iblock++;
|
|
pos += blocksize;
|
|
}
|
|
|
|
map_bh.b_size = blocksize;
|
|
map_bh.b_state = 0;
|
|
err = get_block(inode, iblock, &map_bh, 0);
|
|
if (err)
|
|
goto unlock;
|
|
/* unmapped? It's a hole - nothing to do */
|
|
if (!buffer_mapped(&map_bh))
|
|
goto unlock;
|
|
|
|
/* Ok, it's mapped. Make sure it's up-to-date */
|
|
if (!PageUptodate(page)) {
|
|
err = mapping->a_ops->readpage(NULL, page);
|
|
if (err) {
|
|
put_page(page);
|
|
goto out;
|
|
}
|
|
lock_page(page);
|
|
if (!PageUptodate(page)) {
|
|
err = -EIO;
|
|
goto unlock;
|
|
}
|
|
if (page_has_buffers(page))
|
|
goto has_buffers;
|
|
}
|
|
zero_user(page, offset, length);
|
|
set_page_dirty(page);
|
|
err = 0;
|
|
|
|
unlock:
|
|
unlock_page(page);
|
|
put_page(page);
|
|
out:
|
|
return err;
|
|
}
|
|
EXPORT_SYMBOL(nobh_truncate_page);
|
|
|
|
int block_truncate_page(struct address_space *mapping,
|
|
loff_t from, get_block_t *get_block)
|
|
{
|
|
pgoff_t index = from >> PAGE_SHIFT;
|
|
unsigned offset = from & (PAGE_SIZE-1);
|
|
unsigned blocksize;
|
|
sector_t iblock;
|
|
unsigned length, pos;
|
|
struct inode *inode = mapping->host;
|
|
struct page *page;
|
|
struct buffer_head *bh;
|
|
int err;
|
|
|
|
blocksize = i_blocksize(inode);
|
|
length = offset & (blocksize - 1);
|
|
|
|
/* Block boundary? Nothing to do */
|
|
if (!length)
|
|
return 0;
|
|
|
|
length = blocksize - length;
|
|
iblock = (sector_t)index << (PAGE_SHIFT - inode->i_blkbits);
|
|
|
|
page = grab_cache_page(mapping, index);
|
|
err = -ENOMEM;
|
|
if (!page)
|
|
goto out;
|
|
|
|
if (!page_has_buffers(page))
|
|
create_empty_buffers(page, blocksize, 0);
|
|
|
|
/* Find the buffer that contains "offset" */
|
|
bh = page_buffers(page);
|
|
pos = blocksize;
|
|
while (offset >= pos) {
|
|
bh = bh->b_this_page;
|
|
iblock++;
|
|
pos += blocksize;
|
|
}
|
|
|
|
err = 0;
|
|
if (!buffer_mapped(bh)) {
|
|
WARN_ON(bh->b_size != blocksize);
|
|
err = get_block(inode, iblock, bh, 0);
|
|
if (err)
|
|
goto unlock;
|
|
/* unmapped? It's a hole - nothing to do */
|
|
if (!buffer_mapped(bh))
|
|
goto unlock;
|
|
}
|
|
|
|
/* Ok, it's mapped. Make sure it's up-to-date */
|
|
if (PageUptodate(page))
|
|
set_buffer_uptodate(bh);
|
|
|
|
if (!buffer_uptodate(bh) && !buffer_delay(bh) && !buffer_unwritten(bh)) {
|
|
err = -EIO;
|
|
ll_rw_block(REQ_OP_READ, 0, 1, &bh);
|
|
wait_on_buffer(bh);
|
|
/* Uhhuh. Read error. Complain and punt. */
|
|
if (!buffer_uptodate(bh))
|
|
goto unlock;
|
|
}
|
|
|
|
zero_user(page, offset, length);
|
|
mark_buffer_dirty(bh);
|
|
err = 0;
|
|
|
|
unlock:
|
|
unlock_page(page);
|
|
put_page(page);
|
|
out:
|
|
return err;
|
|
}
|
|
EXPORT_SYMBOL(block_truncate_page);
|
|
|
|
/*
|
|
* The generic ->writepage function for buffer-backed address_spaces
|
|
*/
|
|
int block_write_full_page(struct page *page, get_block_t *get_block,
|
|
struct writeback_control *wbc)
|
|
{
|
|
struct inode * const inode = page->mapping->host;
|
|
loff_t i_size = i_size_read(inode);
|
|
const pgoff_t end_index = i_size >> PAGE_SHIFT;
|
|
unsigned offset;
|
|
|
|
/* Is the page fully inside i_size? */
|
|
if (page->index < end_index)
|
|
return __block_write_full_page(inode, page, get_block, wbc,
|
|
end_buffer_async_write);
|
|
|
|
/* Is the page fully outside i_size? (truncate in progress) */
|
|
offset = i_size & (PAGE_SIZE-1);
|
|
if (page->index >= end_index+1 || !offset) {
|
|
/*
|
|
* The page may have dirty, unmapped buffers. For example,
|
|
* they may have been added in ext3_writepage(). Make them
|
|
* freeable here, so the page does not leak.
|
|
*/
|
|
do_invalidatepage(page, 0, PAGE_SIZE);
|
|
unlock_page(page);
|
|
return 0; /* don't care */
|
|
}
|
|
|
|
/*
|
|
* The page straddles i_size. It must be zeroed out on each and every
|
|
* writepage invocation because it may be mmapped. "A file is mapped
|
|
* in multiples of the page size. For a file that is not a multiple of
|
|
* the page size, the remaining memory is zeroed when mapped, and
|
|
* writes to that region are not written out to the file."
|
|
*/
|
|
zero_user_segment(page, offset, PAGE_SIZE);
|
|
return __block_write_full_page(inode, page, get_block, wbc,
|
|
end_buffer_async_write);
|
|
}
|
|
EXPORT_SYMBOL(block_write_full_page);
|
|
|
|
sector_t generic_block_bmap(struct address_space *mapping, sector_t block,
|
|
get_block_t *get_block)
|
|
{
|
|
struct inode *inode = mapping->host;
|
|
struct buffer_head tmp = {
|
|
.b_size = i_blocksize(inode),
|
|
};
|
|
|
|
get_block(inode, block, &tmp, 0);
|
|
return tmp.b_blocknr;
|
|
}
|
|
EXPORT_SYMBOL(generic_block_bmap);
|
|
|
|
static void end_bio_bh_io_sync(struct bio *bio)
|
|
{
|
|
struct buffer_head *bh = bio->bi_private;
|
|
|
|
if (unlikely(bio_flagged(bio, BIO_QUIET)))
|
|
set_bit(BH_Quiet, &bh->b_state);
|
|
|
|
bh->b_end_io(bh, !bio->bi_status);
|
|
bio_put(bio);
|
|
}
|
|
|
|
/*
|
|
* This allows us to do IO even on the odd last sectors
|
|
* of a device, even if the block size is some multiple
|
|
* of the physical sector size.
|
|
*
|
|
* We'll just truncate the bio to the size of the device,
|
|
* and clear the end of the buffer head manually.
|
|
*
|
|
* Truly out-of-range accesses will turn into actual IO
|
|
* errors, this only handles the "we need to be able to
|
|
* do IO at the final sector" case.
|
|
*/
|
|
void guard_bio_eod(struct bio *bio)
|
|
{
|
|
sector_t maxsector;
|
|
struct hd_struct *part;
|
|
|
|
rcu_read_lock();
|
|
part = __disk_get_part(bio->bi_disk, bio->bi_partno);
|
|
if (part)
|
|
maxsector = part_nr_sects_read(part);
|
|
else
|
|
maxsector = get_capacity(bio->bi_disk);
|
|
rcu_read_unlock();
|
|
|
|
if (!maxsector)
|
|
return;
|
|
|
|
/*
|
|
* If the *whole* IO is past the end of the device,
|
|
* let it through, and the IO layer will turn it into
|
|
* an EIO.
|
|
*/
|
|
if (unlikely(bio->bi_iter.bi_sector >= maxsector))
|
|
return;
|
|
|
|
maxsector -= bio->bi_iter.bi_sector;
|
|
if (likely((bio->bi_iter.bi_size >> 9) <= maxsector))
|
|
return;
|
|
|
|
bio_truncate(bio, maxsector << 9);
|
|
}
|
|
|
|
static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
|
|
enum rw_hint write_hint, struct writeback_control *wbc)
|
|
{
|
|
struct bio *bio;
|
|
|
|
BUG_ON(!buffer_locked(bh));
|
|
BUG_ON(!buffer_mapped(bh));
|
|
BUG_ON(!bh->b_end_io);
|
|
BUG_ON(buffer_delay(bh));
|
|
BUG_ON(buffer_unwritten(bh));
|
|
|
|
/*
|
|
* Only clear out a write error when rewriting
|
|
*/
|
|
if (test_set_buffer_req(bh) && (op == REQ_OP_WRITE))
|
|
clear_buffer_write_io_error(bh);
|
|
|
|
/*
|
|
* from here on down, it's all bio -- do the initial mapping,
|
|
* submit_bio -> generic_make_request may further map this bio around
|
|
*/
|
|
bio = bio_alloc(GFP_NOIO, 1);
|
|
|
|
fscrypt_set_bio_crypt_ctx_bh(bio, bh, GFP_NOIO);
|
|
|
|
bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9);
|
|
bio_set_dev(bio, bh->b_bdev);
|
|
bio->bi_write_hint = write_hint;
|
|
|
|
bio_add_page(bio, bh->b_page, bh->b_size, bh_offset(bh));
|
|
BUG_ON(bio->bi_iter.bi_size != bh->b_size);
|
|
|
|
bio->bi_end_io = end_bio_bh_io_sync;
|
|
bio->bi_private = bh;
|
|
|
|
if (buffer_meta(bh))
|
|
op_flags |= REQ_META;
|
|
if (buffer_prio(bh))
|
|
op_flags |= REQ_PRIO;
|
|
bio_set_op_attrs(bio, op, op_flags);
|
|
|
|
/* Take care of bh's that straddle the end of the device */
|
|
guard_bio_eod(bio);
|
|
|
|
if (wbc) {
|
|
wbc_init_bio(wbc, bio);
|
|
wbc_account_cgroup_owner(wbc, bh->b_page, bh->b_size);
|
|
}
|
|
|
|
submit_bio(bio);
|
|
return 0;
|
|
}
|
|
|
|
int submit_bh(int op, int op_flags, struct buffer_head *bh)
|
|
{
|
|
return submit_bh_wbc(op, op_flags, bh, 0, NULL);
|
|
}
|
|
EXPORT_SYMBOL(submit_bh);
|
|
|
|
/**
|
|
* ll_rw_block: low-level access to block devices (DEPRECATED)
|
|
* @op: whether to %READ or %WRITE
|
|
* @op_flags: req_flag_bits
|
|
* @nr: number of &struct buffer_heads in the array
|
|
* @bhs: array of pointers to &struct buffer_head
|
|
*
|
|
* ll_rw_block() takes an array of pointers to &struct buffer_heads, and
|
|
* requests an I/O operation on them, either a %REQ_OP_READ or a %REQ_OP_WRITE.
|
|
* @op_flags contains flags modifying the detailed I/O behavior, most notably
|
|
* %REQ_RAHEAD.
|
|
*
|
|
* This function drops any buffer that it cannot get a lock on (with the
|
|
* BH_Lock state bit), any buffer that appears to be clean when doing a write
|
|
* request, and any buffer that appears to be up-to-date when doing read
|
|
* request. Further it marks as clean buffers that are processed for
|
|
* writing (the buffer cache won't assume that they are actually clean
|
|
* until the buffer gets unlocked).
|
|
*
|
|
* ll_rw_block sets b_end_io to simple completion handler that marks
|
|
* the buffer up-to-date (if appropriate), unlocks the buffer and wakes
|
|
* any waiters.
|
|
*
|
|
* All of the buffers must be for the same device, and must also be a
|
|
* multiple of the current approved size for the device.
|
|
*/
|
|
void ll_rw_block(int op, int op_flags, int nr, struct buffer_head *bhs[])
|
|
{
|
|
int i;
|
|
|
|
for (i = 0; i < nr; i++) {
|
|
struct buffer_head *bh = bhs[i];
|
|
|
|
if (!trylock_buffer(bh))
|
|
continue;
|
|
if (op == WRITE) {
|
|
if (test_clear_buffer_dirty(bh)) {
|
|
bh->b_end_io = end_buffer_write_sync;
|
|
get_bh(bh);
|
|
submit_bh(op, op_flags, bh);
|
|
continue;
|
|
}
|
|
} else {
|
|
if (!buffer_uptodate(bh)) {
|
|
bh->b_end_io = end_buffer_read_sync;
|
|
get_bh(bh);
|
|
submit_bh(op, op_flags, bh);
|
|
continue;
|
|
}
|
|
}
|
|
unlock_buffer(bh);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(ll_rw_block);
|
|
|
|
void write_dirty_buffer(struct buffer_head *bh, int op_flags)
|
|
{
|
|
lock_buffer(bh);
|
|
if (!test_clear_buffer_dirty(bh)) {
|
|
unlock_buffer(bh);
|
|
return;
|
|
}
|
|
bh->b_end_io = end_buffer_write_sync;
|
|
get_bh(bh);
|
|
submit_bh(REQ_OP_WRITE, op_flags, bh);
|
|
}
|
|
EXPORT_SYMBOL(write_dirty_buffer);
|
|
|
|
/*
|
|
* For a data-integrity writeout, we need to wait upon any in-progress I/O
|
|
* and then start new I/O and then wait upon it. The caller must have a ref on
|
|
* the buffer_head.
|
|
*/
|
|
int __sync_dirty_buffer(struct buffer_head *bh, int op_flags)
|
|
{
|
|
int ret = 0;
|
|
|
|
WARN_ON(atomic_read(&bh->b_count) < 1);
|
|
lock_buffer(bh);
|
|
if (test_clear_buffer_dirty(bh)) {
|
|
get_bh(bh);
|
|
bh->b_end_io = end_buffer_write_sync;
|
|
ret = submit_bh(REQ_OP_WRITE, op_flags, bh);
|
|
wait_on_buffer(bh);
|
|
if (!ret && !buffer_uptodate(bh))
|
|
ret = -EIO;
|
|
} else {
|
|
unlock_buffer(bh);
|
|
}
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL(__sync_dirty_buffer);
|
|
|
|
int sync_dirty_buffer(struct buffer_head *bh)
|
|
{
|
|
return __sync_dirty_buffer(bh, REQ_SYNC);
|
|
}
|
|
EXPORT_SYMBOL(sync_dirty_buffer);
|
|
|
|
/*
|
|
* try_to_free_buffers() checks if all the buffers on this particular page
|
|
* are unused, and releases them if so.
|
|
*
|
|
* Exclusion against try_to_free_buffers may be obtained by either
|
|
* locking the page or by holding its mapping's private_lock.
|
|
*
|
|
* If the page is dirty but all the buffers are clean then we need to
|
|
* be sure to mark the page clean as well. This is because the page
|
|
* may be against a block device, and a later reattachment of buffers
|
|
* to a dirty page will set *all* buffers dirty. Which would corrupt
|
|
* filesystem data on the same device.
|
|
*
|
|
* The same applies to regular filesystem pages: if all the buffers are
|
|
* clean then we set the page clean and proceed. To do that, we require
|
|
* total exclusion from __set_page_dirty_buffers(). That is obtained with
|
|
* private_lock.
|
|
*
|
|
* try_to_free_buffers() is non-blocking.
|
|
*/
|
|
static inline int buffer_busy(struct buffer_head *bh)
|
|
{
|
|
return atomic_read(&bh->b_count) |
|
|
(bh->b_state & ((1 << BH_Dirty) | (1 << BH_Lock)));
|
|
}
|
|
|
|
static int
|
|
drop_buffers(struct page *page, struct buffer_head **buffers_to_free)
|
|
{
|
|
struct buffer_head *head = page_buffers(page);
|
|
struct buffer_head *bh;
|
|
|
|
bh = head;
|
|
do {
|
|
if (buffer_busy(bh)) {
|
|
/*
|
|
* Check if the busy failure was due to an
|
|
* outstanding LRU reference
|
|
*/
|
|
evict_bh_lrus(bh);
|
|
if (buffer_busy(bh))
|
|
goto failed;
|
|
}
|
|
bh = bh->b_this_page;
|
|
} while (bh != head);
|
|
|
|
do {
|
|
struct buffer_head *next = bh->b_this_page;
|
|
|
|
if (bh->b_assoc_map)
|
|
__remove_assoc_queue(bh);
|
|
bh = next;
|
|
} while (bh != head);
|
|
*buffers_to_free = head;
|
|
__clear_page_buffers(page);
|
|
return 1;
|
|
failed:
|
|
return 0;
|
|
}
|
|
|
|
int try_to_free_buffers(struct page *page)
|
|
{
|
|
struct address_space * const mapping = page->mapping;
|
|
struct buffer_head *buffers_to_free = NULL;
|
|
int ret = 0;
|
|
|
|
BUG_ON(!PageLocked(page));
|
|
if (PageWriteback(page))
|
|
return 0;
|
|
|
|
if (mapping == NULL) { /* can this still happen? */
|
|
ret = drop_buffers(page, &buffers_to_free);
|
|
goto out;
|
|
}
|
|
|
|
spin_lock(&mapping->private_lock);
|
|
ret = drop_buffers(page, &buffers_to_free);
|
|
|
|
/*
|
|
* If the filesystem writes its buffers by hand (eg ext3)
|
|
* then we can have clean buffers against a dirty page. We
|
|
* clean the page here; otherwise the VM will never notice
|
|
* that the filesystem did any IO at all.
|
|
*
|
|
* Also, during truncate, discard_buffer will have marked all
|
|
* the page's buffers clean. We discover that here and clean
|
|
* the page also.
|
|
*
|
|
* private_lock must be held over this entire operation in order
|
|
* to synchronise against __set_page_dirty_buffers and prevent the
|
|
* dirty bit from being lost.
|
|
*/
|
|
if (ret)
|
|
cancel_dirty_page(page);
|
|
spin_unlock(&mapping->private_lock);
|
|
out:
|
|
if (buffers_to_free) {
|
|
struct buffer_head *bh = buffers_to_free;
|
|
|
|
do {
|
|
struct buffer_head *next = bh->b_this_page;
|
|
free_buffer_head(bh);
|
|
bh = next;
|
|
} while (bh != buffers_to_free);
|
|
}
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL(try_to_free_buffers);
|
|
|
|
/*
|
|
* There are no bdflush tunables left. But distributions are
|
|
* still running obsolete flush daemons, so we terminate them here.
|
|
*
|
|
* Use of bdflush() is deprecated and will be removed in a future kernel.
|
|
* The `flush-X' kernel threads fully replace bdflush daemons and this call.
|
|
*/
|
|
SYSCALL_DEFINE2(bdflush, int, func, long, data)
|
|
{
|
|
static int msg_count;
|
|
|
|
if (!capable(CAP_SYS_ADMIN))
|
|
return -EPERM;
|
|
|
|
if (msg_count < 5) {
|
|
msg_count++;
|
|
printk(KERN_INFO
|
|
"warning: process `%s' used the obsolete bdflush"
|
|
" system call\n", current->comm);
|
|
printk(KERN_INFO "Fix your initscripts?\n");
|
|
}
|
|
|
|
if (func == 1)
|
|
do_exit(0);
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* Buffer-head allocation
|
|
*/
|
|
static struct kmem_cache *bh_cachep __read_mostly;
|
|
|
|
/*
|
|
* Once the number of bh's in the machine exceeds this level, we start
|
|
* stripping them in writeback.
|
|
*/
|
|
static unsigned long max_buffer_heads;
|
|
|
|
int buffer_heads_over_limit;
|
|
|
|
struct bh_accounting {
|
|
int nr; /* Number of live bh's */
|
|
int ratelimit; /* Limit cacheline bouncing */
|
|
};
|
|
|
|
static DEFINE_PER_CPU(struct bh_accounting, bh_accounting) = {0, 0};
|
|
|
|
static void recalc_bh_state(void)
|
|
{
|
|
int i;
|
|
int tot = 0;
|
|
|
|
if (__this_cpu_inc_return(bh_accounting.ratelimit) - 1 < 4096)
|
|
return;
|
|
__this_cpu_write(bh_accounting.ratelimit, 0);
|
|
for_each_online_cpu(i)
|
|
tot += per_cpu(bh_accounting, i).nr;
|
|
buffer_heads_over_limit = (tot > max_buffer_heads);
|
|
}
|
|
|
|
struct buffer_head *alloc_buffer_head(gfp_t gfp_flags)
|
|
{
|
|
struct buffer_head *ret = kmem_cache_zalloc(bh_cachep, gfp_flags);
|
|
if (ret) {
|
|
INIT_LIST_HEAD(&ret->b_assoc_buffers);
|
|
preempt_disable();
|
|
__this_cpu_inc(bh_accounting.nr);
|
|
recalc_bh_state();
|
|
preempt_enable();
|
|
}
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL(alloc_buffer_head);
|
|
|
|
void free_buffer_head(struct buffer_head *bh)
|
|
{
|
|
BUG_ON(!list_empty(&bh->b_assoc_buffers));
|
|
kmem_cache_free(bh_cachep, bh);
|
|
preempt_disable();
|
|
__this_cpu_dec(bh_accounting.nr);
|
|
recalc_bh_state();
|
|
preempt_enable();
|
|
}
|
|
EXPORT_SYMBOL(free_buffer_head);
|
|
|
|
static int buffer_exit_cpu_dead(unsigned int cpu)
|
|
{
|
|
int i;
|
|
struct bh_lru *b = &per_cpu(bh_lrus, cpu);
|
|
|
|
for (i = 0; i < BH_LRU_SIZE; i++) {
|
|
brelse(b->bhs[i]);
|
|
b->bhs[i] = NULL;
|
|
}
|
|
this_cpu_add(bh_accounting.nr, per_cpu(bh_accounting, cpu).nr);
|
|
per_cpu(bh_accounting, cpu).nr = 0;
|
|
return 0;
|
|
}
|
|
|
|
/**
|
|
* bh_uptodate_or_lock - Test whether the buffer is uptodate
|
|
* @bh: struct buffer_head
|
|
*
|
|
* Return true if the buffer is up-to-date and false,
|
|
* with the buffer locked, if not.
|
|
*/
|
|
int bh_uptodate_or_lock(struct buffer_head *bh)
|
|
{
|
|
if (!buffer_uptodate(bh)) {
|
|
lock_buffer(bh);
|
|
if (!buffer_uptodate(bh))
|
|
return 0;
|
|
unlock_buffer(bh);
|
|
}
|
|
return 1;
|
|
}
|
|
EXPORT_SYMBOL(bh_uptodate_or_lock);
|
|
|
|
/**
|
|
* bh_submit_read - Submit a locked buffer for reading
|
|
* @bh: struct buffer_head
|
|
*
|
|
* Returns zero on success and -EIO on error.
|
|
*/
|
|
int bh_submit_read(struct buffer_head *bh)
|
|
{
|
|
BUG_ON(!buffer_locked(bh));
|
|
|
|
if (buffer_uptodate(bh)) {
|
|
unlock_buffer(bh);
|
|
return 0;
|
|
}
|
|
|
|
get_bh(bh);
|
|
bh->b_end_io = end_buffer_read_sync;
|
|
submit_bh(REQ_OP_READ, 0, bh);
|
|
wait_on_buffer(bh);
|
|
if (buffer_uptodate(bh))
|
|
return 0;
|
|
return -EIO;
|
|
}
|
|
EXPORT_SYMBOL(bh_submit_read);
|
|
|
|
void __init buffer_init(void)
|
|
{
|
|
unsigned long nrpages;
|
|
int ret;
|
|
|
|
bh_cachep = kmem_cache_create("buffer_head",
|
|
sizeof(struct buffer_head), 0,
|
|
(SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|
|
|
SLAB_MEM_SPREAD),
|
|
NULL);
|
|
|
|
/*
|
|
* Limit the bh occupancy to 10% of ZONE_NORMAL
|
|
*/
|
|
nrpages = (nr_free_buffer_pages() * 10) / 100;
|
|
max_buffer_heads = nrpages * (PAGE_SIZE / sizeof(struct buffer_head));
|
|
ret = cpuhp_setup_state_nocalls(CPUHP_FS_BUFF_DEAD, "fs/buffer:dead",
|
|
NULL, buffer_exit_cpu_dead);
|
|
WARN_ON(ret < 0);
|
|
}
|