a13ec5ea86
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl9QtnYACgkQONu9yGCS aT6d3hAA0SGXTk13kxCTzOTOh7hhZJSI6a+JL64Cj/o8IkaoaCFMjLevcuYMAWh1 LARaLjPy7MNm1fAy6LPaQcLwRax2Ocwyl27x3U3IrM4/Fos/r0wkn4Ek6IJVBD0H FqF4VHRoLt0IUhOTdsdGqv4YHRhE/l8dFHXVencTVE8dAB5QUUpI8XwKruk8HlOD L2h1gF6x8yV18lt3I6kIA3+n9ImMSNO65OxwXUTgu0cZoyk35byj1bbgu8mkZPkk s7Y5oBS5CorhBYFP+D6Av5e9LOP4jzvwPqCeLLCIa5idM277afyt6dKnwBcdK4w/ Y10AIlGeji0xaAD4Xv2SnjiY6lFtA5DF8gg8zLsjdjgPyELrZOdNOxJPhckL8Fbj u9oeWerJPBgI1bEtaWUihRSo31dedp8VAi87aRdwMkNIdBrXLo9tdv+waWTm8YPi 0kbG+p/Cp7Z8SqG6dEJsLxnes2Spd5RohRsYET/L3adl5B/IdYVxuHF0Lc2U/5AM +7FvisuqjeDS0o8ZpAP8F0wpvqDIhD+5Iy2NkT3/HcgzyYYd9q4+L5szoARN4Dzn pIm/Y9UyvXxgYNUSvVl5H1hn4JJR0WuxgiBYoUrZGc5w5Ey5f8M9hOM90lfu6MWO YWbLVEIui+jW9pkV4SmO71zkR+OI6u1I2YSTYGyTvXnyD+YL44w= =416Q -----END PGP SIGNATURE----- Merge 4.19.143 into android-4.19-stable Changes in 4.19.143 powerpc/64s: Don't init FSCR_DSCR in __init_FSCR() gre6: Fix reception with IP6_TNL_F_RCV_DSCP_COPY net: Fix potential wrong skb->protocol in skb_vlan_untag() net: qrtr: fix usage of idr in port assignment to socket net/smc: Prevent kernel-infoleak in __smc_diag_dump() tipc: fix uninit skb->data in tipc_nl_compat_dumpit() net: ena: Make missed_tx stat incremental ipvlan: fix device features ALSA: pci: delete repeated words in comments ASoC: img: Fix a reference count leak in img_i2s_in_set_fmt ASoC: img-parallel-out: Fix a reference count leak ASoC: tegra: Fix reference count leaks. mfd: intel-lpss: Add Intel Emmitsburg PCH PCI IDs arm64: dts: qcom: msm8916: Pull down PDM GPIOs during sleep powerpc/xive: Ignore kmemleak false positives media: pci: ttpci: av7110: fix possible buffer overflow caused by bad DMA value in debiirq() blktrace: ensure our debugfs dir exists scsi: target: tcmu: Fix crash on ARM during cmd completion iommu/iova: Don't BUG on invalid PFNs drm/amdkfd: Fix reference count leaks. drm/radeon: fix multiple reference count leak drm/amdgpu: fix ref count leak in amdgpu_driver_open_kms drm/amd/display: fix ref count leak in amdgpu_drm_ioctl drm/amdgpu: fix ref count leak in amdgpu_display_crtc_set_config drm/amdgpu/display: fix ref count leak when pm_runtime_get_sync fails scsi: lpfc: Fix shost refcount mismatch when deleting vport xfs: Don't allow logging of XFS_ISTALE inodes selftests/powerpc: Purge extra count_pmc() calls of ebb selftests f2fs: fix error path in do_recover_data() omapfb: fix multiple reference count leaks due to pm_runtime_get_sync PCI: Fix pci_create_slot() reference count leak ARM: dts: ls1021a: output PPS signal on FIPER2 rtlwifi: rtl8192cu: Prevent leaking urb mips/vdso: Fix resource leaks in genvdso.c cec-api: prevent leaking memory through hole in structure HID: quirks: add NOGET quirk for Logitech GROUP f2fs: fix use-after-free issue drm/nouveau/drm/noveau: fix reference count leak in nouveau_fbcon_open drm/nouveau: fix reference count leak in nv50_disp_atomic_commit drm/nouveau: Fix reference count leak in nouveau_connector_detect locking/lockdep: Fix overflow in presentation of average lock-time btrfs: file: reserve qgroup space after the hole punch range is locked scsi: iscsi: Do not put host in iscsi_set_flashnode_param() ceph: fix potential mdsc use-after-free crash scsi: fcoe: Memory leak fix in fcoe_sysfs_fcf_del() EDAC/ie31200: Fallback if host bridge device is already initialized KVM: arm64: Fix symbol dependency in __hyp_call_panic_nvhe powerpc/spufs: add CONFIG_COREDUMP dependency USB: sisusbvga: Fix a potential UB casued by left shifting a negative value efi: provide empty efi_enter_virtual_mode implementation Revert "ath10k: fix DMA related firmware crashes on multiple devices" media: gpio-ir-tx: improve precision of transmitted signal due to scheduling drm/msm/adreno: fix updating ring fence nvme-fc: Fix wrong return value in __nvme_fc_init_request() null_blk: fix passing of REQ_FUA flag in null_handle_rq i2c: rcar: in slave mode, clear NACK earlier usb: gadget: f_tcm: Fix some resource leaks in some error paths jbd2: make sure jh have b_transaction set in refile/unfile_buffer ext4: don't BUG on inconsistent journal feature ext4: handle read only external journal device jbd2: abort journal if free a async write error metadata buffer ext4: handle option set by mount flags correctly ext4: handle error of ext4_setup_system_zone() on remount ext4: correctly restore system zone info when remount fails fs: prevent BUG_ON in submit_bh_wbc() spi: stm32: fix stm32_spi_prepare_mbr in case of odd clk_rate s390/cio: add cond_resched() in the slow_eval_known_fn() loop ASoC: wm8994: Avoid attempts to read unreadable registers scsi: fcoe: Fix I/O path allocation scsi: ufs: Fix possible infinite loop in ufshcd_hold scsi: ufs: Improve interrupt handling for shared interrupts scsi: ufs: Clean up completed request without interrupt notification scsi: qla2xxx: Check if FW supports MQ before enabling scsi: qla2xxx: Fix null pointer access during disconnect from subsystem Revert "scsi: qla2xxx: Fix crash on qla2x00_mailbox_command" macvlan: validate setting of multiple remote source MAC addresses net: gianfar: Add of_node_put() before goto statement powerpc/perf: Fix soft lockups due to missed interrupt accounting block: loop: set discard granularity and alignment for block device backed loop HID: i2c-hid: Always sleep 60ms after I2C_HID_PWR_ON commands blk-mq: order adding requests to hctx->dispatch and checking SCHED_RESTART btrfs: reset compression level for lzo on remount btrfs: fix space cache memory leak after transaction abort fbcon: prevent user font height or width change from causing potential out-of-bounds access USB: lvtest: return proper error code in probe vt: defer kfree() of vc_screenbuf in vc_do_resize() vt_ioctl: change VT_RESIZEX ioctl to check for error return from vc_resize() serial: samsung: Removes the IRQ not found warning serial: pl011: Fix oops on -EPROBE_DEFER serial: pl011: Don't leak amba_ports entry on driver register error serial: 8250_exar: Fix number of ports for Commtech PCIe cards serial: 8250: change lock order in serial8250_do_startup() writeback: Protect inode->i_io_list with inode->i_lock writeback: Avoid skipping inode writeback writeback: Fix sync livelock due to b_dirty_time processing XEN uses irqdesc::irq_data_common::handler_data to store a per interrupt XEN data pointer which contains XEN specific information. usb: host: xhci: fix ep context print mismatch in debugfs xhci: Do warm-reset when both CAS and XDEV_RESUME are set xhci: Always restore EP_SOFT_CLEAR_TOGGLE even if ep reset failed PM: sleep: core: Fix the handling of pending runtime resume requests device property: Fix the secondary firmware node handling in set_primary_fwnode() genirq/matrix: Deal with the sillyness of for_each_cpu() on UP irqchip/stm32-exti: Avoid losing interrupts due to clearing pending bits by mistake drm/amdgpu: Fix buffer overflow in INFO ioctl drm/amd/pm: correct Vega10 swctf limit setting drm/amd/pm: correct Vega12 swctf limit setting USB: yurex: Fix bad gfp argument usb: uas: Add quirk for PNY Pro Elite USB: quirks: Add no-lpm quirk for another Raydium touchscreen USB: quirks: Ignore duplicate endpoint on Sound Devices MixPre-D USB: Ignore UAS for JMicron JMS567 ATA/ATAPI Bridge usb: host: ohci-exynos: Fix error handling in exynos_ohci_probe() USB: gadget: u_f: add overflow checks to VLA macros USB: gadget: f_ncm: add bounds checks to ncm_unwrap_ntb() USB: gadget: u_f: Unbreak offset calculation in VLAs USB: cdc-acm: rework notification_buffer resizing usb: storage: Add unusual_uas entry for Sony PSZ drives btrfs: check the right error variable in btrfs_del_dir_entries_in_log usb: dwc3: gadget: Don't setup more than requested usb: dwc3: gadget: Fix handling ZLP usb: dwc3: gadget: Handle ZLP for sg requests tpm: Unify the mismatching TPM space buffer sizes HID: hiddev: Fix slab-out-of-bounds write in hiddev_ioctl_usage() ALSA: usb-audio: Update documentation comment for MS2109 quirk Linux 4.19.143 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I8b6e29eda77bd69df30132842cf28019c8e7c1a3
157 lines
4.2 KiB
C
157 lines
4.2 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright (c) 2000,2005 Silicon Graphics, Inc.
|
|
* All Rights Reserved.
|
|
*/
|
|
#include "xfs.h"
|
|
#include "xfs_fs.h"
|
|
#include "xfs_shared.h"
|
|
#include "xfs_format.h"
|
|
#include "xfs_log_format.h"
|
|
#include "xfs_trans_resv.h"
|
|
#include "xfs_mount.h"
|
|
#include "xfs_inode.h"
|
|
#include "xfs_trans.h"
|
|
#include "xfs_trans_priv.h"
|
|
#include "xfs_inode_item.h"
|
|
#include "xfs_trace.h"
|
|
|
|
#include <linux/iversion.h>
|
|
|
|
/*
|
|
* Add a locked inode to the transaction.
|
|
*
|
|
* The inode must be locked, and it cannot be associated with any transaction.
|
|
* If lock_flags is non-zero the inode will be unlocked on transaction commit.
|
|
*/
|
|
void
|
|
xfs_trans_ijoin(
|
|
struct xfs_trans *tp,
|
|
struct xfs_inode *ip,
|
|
uint lock_flags)
|
|
{
|
|
xfs_inode_log_item_t *iip;
|
|
|
|
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
|
|
if (ip->i_itemp == NULL)
|
|
xfs_inode_item_init(ip, ip->i_mount);
|
|
iip = ip->i_itemp;
|
|
|
|
ASSERT(iip->ili_lock_flags == 0);
|
|
iip->ili_lock_flags = lock_flags;
|
|
ASSERT(!xfs_iflags_test(ip, XFS_ISTALE));
|
|
|
|
/*
|
|
* Get a log_item_desc to point at the new item.
|
|
*/
|
|
xfs_trans_add_item(tp, &iip->ili_item);
|
|
}
|
|
|
|
/*
|
|
* Transactional inode timestamp update. Requires the inode to be locked and
|
|
* joined to the transaction supplied. Relies on the transaction subsystem to
|
|
* track dirty state and update/writeback the inode accordingly.
|
|
*/
|
|
void
|
|
xfs_trans_ichgtime(
|
|
struct xfs_trans *tp,
|
|
struct xfs_inode *ip,
|
|
int flags)
|
|
{
|
|
struct inode *inode = VFS_I(ip);
|
|
struct timespec64 tv;
|
|
|
|
ASSERT(tp);
|
|
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
|
|
|
|
tv = current_time(inode);
|
|
|
|
if (flags & XFS_ICHGTIME_MOD)
|
|
inode->i_mtime = tv;
|
|
if (flags & XFS_ICHGTIME_CHG)
|
|
inode->i_ctime = tv;
|
|
}
|
|
|
|
/*
|
|
* This is called to mark the fields indicated in fieldmask as needing
|
|
* to be logged when the transaction is committed. The inode must
|
|
* already be associated with the given transaction.
|
|
*
|
|
* The values for fieldmask are defined in xfs_inode_item.h. We always
|
|
* log all of the core inode if any of it has changed, and we always log
|
|
* all of the inline data/extents/b-tree root if any of them has changed.
|
|
*/
|
|
void
|
|
xfs_trans_log_inode(
|
|
xfs_trans_t *tp,
|
|
xfs_inode_t *ip,
|
|
uint flags)
|
|
{
|
|
struct inode *inode = VFS_I(ip);
|
|
|
|
ASSERT(ip->i_itemp != NULL);
|
|
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
|
|
ASSERT(!xfs_iflags_test(ip, XFS_ISTALE));
|
|
|
|
/*
|
|
* Don't bother with i_lock for the I_DIRTY_TIME check here, as races
|
|
* don't matter - we either will need an extra transaction in 24 hours
|
|
* to log the timestamps, or will clear already cleared fields in the
|
|
* worst case.
|
|
*/
|
|
if (inode->i_state & I_DIRTY_TIME) {
|
|
spin_lock(&inode->i_lock);
|
|
inode->i_state &= ~I_DIRTY_TIME;
|
|
spin_unlock(&inode->i_lock);
|
|
}
|
|
|
|
/*
|
|
* Record the specific change for fdatasync optimisation. This
|
|
* allows fdatasync to skip log forces for inodes that are only
|
|
* timestamp dirty. We do this before the change count so that
|
|
* the core being logged in this case does not impact on fdatasync
|
|
* behaviour.
|
|
*/
|
|
ip->i_itemp->ili_fsync_fields |= flags;
|
|
|
|
/*
|
|
* First time we log the inode in a transaction, bump the inode change
|
|
* counter if it is configured for this to occur. While we have the
|
|
* inode locked exclusively for metadata modification, we can usually
|
|
* avoid setting XFS_ILOG_CORE if no one has queried the value since
|
|
* the last time it was incremented. If we have XFS_ILOG_CORE already
|
|
* set however, then go ahead and bump the i_version counter
|
|
* unconditionally.
|
|
*/
|
|
if (!test_and_set_bit(XFS_LI_DIRTY, &ip->i_itemp->ili_item.li_flags) &&
|
|
IS_I_VERSION(VFS_I(ip))) {
|
|
if (inode_maybe_inc_iversion(VFS_I(ip), flags & XFS_ILOG_CORE))
|
|
flags |= XFS_ILOG_CORE;
|
|
}
|
|
|
|
tp->t_flags |= XFS_TRANS_DIRTY;
|
|
|
|
/*
|
|
* Always OR in the bits from the ili_last_fields field.
|
|
* This is to coordinate with the xfs_iflush() and xfs_iflush_done()
|
|
* routines in the eventual clearing of the ili_fields bits.
|
|
* See the big comment in xfs_iflush() for an explanation of
|
|
* this coordination mechanism.
|
|
*/
|
|
flags |= ip->i_itemp->ili_last_fields;
|
|
ip->i_itemp->ili_fields |= flags;
|
|
}
|
|
|
|
int
|
|
xfs_trans_roll_inode(
|
|
struct xfs_trans **tpp,
|
|
struct xfs_inode *ip)
|
|
{
|
|
int error;
|
|
|
|
xfs_trans_log_inode(*tpp, ip, XFS_ILOG_CORE);
|
|
error = xfs_trans_roll(tpp);
|
|
if (!error)
|
|
xfs_trans_ijoin(*tpp, ip, 0);
|
|
return error;
|
|
}
|