Merge android11-5.4.52 (c7725ae) into msm-5.4

* refs/heads/tmp-c7725ae:
  Linux 5.4.52
  s390/maccess: add no DAT mode to kernel_write
  s390: Change s390_kernel_write() return type to match memcpy()
  pwm: jz4740: Fix build failure
  perf scripts python: exported-sql-viewer.py: Fix unexpanded 'Find' result
  perf scripts python: exported-sql-viewer.py: Fix zero id in call tree 'Find' result
  perf scripts python: exported-sql-viewer.py: Fix zero id in call graph 'Find' result
  perf scripts python: export-to-postgresql.py: Fix struct.pack() int argument
  dm writecache: reject asynchronous pmem devices
  blk-mq: consider non-idle request as "inflight" in blk_mq_rq_inflight()
  s390/mm: fix huge pte soft dirty copying
  s390/setup: init jump labels before command line parsing
  ARC: elf: use right ELF_ARCH
  ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE
  mmc: meson-gx: limit segments to 1 when dram-access-quirk is needed
  dm: use noio when sending kobject event
  drm/amdgpu: don't do soft recovery if gpu_recovery=0
  drm/radeon: fix double free
  btrfs: fix double put of block group with nocow
  btrfs: fix fatal extent_buffer readahead vs releasepage race
  Revert "ath9k: Fix general protection fault in ath9k_hif_usb_rx_cb"
  bpf: Check correct cred for CAP_SYSLOG in bpf_dump_raw_ok()
  kprobes: Do not expose probe addresses to non-CAP_SYSLOG
  module: Do not expose section addresses to non-CAP_SYSLOG
  module: Refactor section attr into bin attribute
  kallsyms: Refactor kallsyms_show_value() to take cred
  KVM: arm64: Fix kvm_reset_vcpu() return code being incorrect with SVE
  KVM: x86: Mark CR4.TSD as being possibly owned by the guest
  KVM: x86: Inject #GP if guest attempts to toggle CR4.LA57 in 64-bit mode
  KVM: x86: bit 8 of non-leaf PDPEs is not reserved
  KVM: arm64: Annotate hyp NMI-related functions as __always_inline
  KVM: arm64: Stop clobbering x0 for HVC_SOFT_RESTART
  KVM: arm64: Fix definition of PAGE_HYP_DEVICE
  ALSA: hda/realtek: Enable headset mic of Acer Veriton N4660G with ALC269VC
  ALSA: hda/realtek: Enable headset mic of Acer C20-820 with ALC269VC
  ALSA: hda/realtek - Enable audio jacks of Acer vCopperbox with ALC269VC
  ALSA: hda/realtek - Fix Lenovo Thinkpad X1 Carbon 7th quirk subdevice id
  ALSA: usb-audio: Add implicit feedback quirk for RTX6001
  ALSA: usb-audio: add quirk for MacroSilicon MS2109
  ALSA: hda - let hs_mic be picked ahead of hp_mic
  ALSA: opl3: fix infoleak in opl3
  IB/hfi1: Do not destroy link_wq when the device is shut down
  IB/hfi1: Do not destroy hfi1_wq when the device is shut down
  mlxsw: pci: Fix use-after-free in case of failed devlink reload
  mlxsw: spectrum_router: Remove inappropriate usage of WARN_ON()
  net: macb: fix call to pm_runtime in the suspend/resume functions
  net: macb: mark device wake capable when "magic-packet" property present
  net: macb: fix wakeup test in runtime suspend/resume routines
  bnxt_en: fix NULL dereference in case SR-IOV configuration fails
  net/mlx5e: Fix 50G per lane indication
  net/mlx5: Fix eeprom support for SFP module
  qed: Populate nvm-file attributes while reading nvm config partition.
  IB/mlx5: Fix 50G per lane indication
  cxgb4: fix all-mask IP address comparison
  nbd: Fix memory leak in nbd_add_socket
  arm64: kgdb: Fix single-step exception handling oops
  RDMA/siw: Fix reporting vendor_part_id
  ALSA: compress: fix partial_drain completion state
  net: hns3: fix use-after-free when doing self test
  net: hns3: add a missing uninit debugfs when unload driver
  smsc95xx: avoid memory leak in smsc95xx_bind
  smsc95xx: check return value of smsc95xx_reset
  perf intel-pt: Fix PEBS sample for XMM registers
  perf intel-pt: Fix recording PEBS-via-PT with registers
  perf report TUI: Fix segmentation fault in perf_evsel__hists_browse()
  netfilter: conntrack: refetch conntrack after nf_conntrack_update()
  net: dsa: microchip: set the correct number of ports
  IB/sa: Resolv use-after-free in ib_nl_make_request()
  net: cxgb4: fix return error value in t4_prep_fw
  net: mvneta: fix use of state->speed
  netfilter: ipset: call ip_set_free() instead of kfree()
  bpf, sockmap: RCU dereferenced psock may be used outside RCU block
  bpf, sockmap: RCU splat with redirect and strparser error or TLS
  drm/mediatek: Check plane visibility in atomic_update
  nl80211: don't return err unconditionally in nl80211_start_ap()
  gpio: pca953x: Fix GPIO resource leak on Intel Galileo Gen 2
  gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2
  net: qrtr: Fix an out of bounds read qrtr_endpoint_post()
  sched/core: Check cpus_mask, not cpus_ptr in __set_cpus_allowed_ptr(), to fix mask corruption
  x86/entry: Increase entry_stack size to a full page
  nvme-rdma: assign completion vector correctly
  block: release bip in a right way in error path
  usb: dwc3: pci: Fix reference count leak in dwc3_pci_resume_work
  scsi: mptscsih: Fix read sense data size
  ARM: imx6: add missing put_device() call in imx6q_suspend_init()
  cifs: update ctime and mtime during truncate
  s390/kasan: fix early pgm check handler execution
  drm: panel-orientation-quirks: Use generic orientation-data for Acer S1003
  drm: panel-orientation-quirks: Add quirk for Asus T101HA panel
  iommu/vt-d: Don't apply gfx quirks to untrusted devices
  powerpc/kvm/book3s64: Fix kernel crash with nested kvm & DEBUG_VIRTUAL
  ibmvnic: continue to init in CRQ reset returns H_CLOSED
  i40e: protect ring accesses with READ- and WRITE_ONCE
  ixgbe: protect ring accesses with READ- and WRITE_ONCE
  net: ethernet: mvneta: Add 2500BaseX support for SoCs without comphy
  net: ethernet: mvneta: Fix Serdes configuration for SoCs without comphy
  spi: spidev: fix a potential use-after-free in spidev_release()
  spi: spidev: fix a race between spidev_release and spidev_remove
  ALSA: hda: Intel: add missing PCI IDs for ICL-H, TGL-H and EKL
  ASoC: SOF: Intel: add PCI ID for CometLake-S
  drm: mcde: Fix display initialization problem
  gpu: host1x: Detach driver on unregister
  drm/tegra: hub: Do not enable orphaned window group
  drm/ttm: Fix dma_fence refcnt leak when adding move fence
  ARM: dts: omap4-droid4: Fix spi configuration and increase rate
  perf/x86/rapl: Fix RAPL config variable bug
  perf/x86/rapl: Move RAPL support to common x86 code
  regmap: fix alignment issue
  spi: spi-fsl-dspi: Fix lockup if device is removed during SPI transfer
  spi: spi-fsl-dspi: Adding shutdown hook
  KVM: s390: reduce number of IO pins to 1
  ANDROID: ABI: add already existing symbols of ufs_* to unisoc
  ANDROID: ABI: add nf_* symbols to unisoc
  ANDROID: GKI: update abi xml file
  ANDROID: GKI: build in more Bluetooth drivers
  ANDROID: GKI: update abi xml file
  ANDROID: GKI: Enable CONFIG_BT_HIDP as it is needed by some platforms
  ANDROID: GKI: add CONFIG_BT to x86 gki_defconfig
  ANDROID: GKI: update abi definitions
  ANDROID: mm: add vendor padding for SPECULATIVE_PAGE_FAULTS
  ANDROID: GKI: enable usb storage drivers
  ANDROID: fscrypt: fix DUN contiguity with inline encryption + IV_INO_LBLK_32 policies
  ANDROID: GKI: set CONFIG_STATIC_USERMODEHELPER_PATH
  ANDROID: sound: usb: Add vendor's hooking interface
  UPSTREAM: slimbus: core: Set fwnode for a device when setting of_node
  ANDROID: f2fs: add back compress inode check
  ANDROID: abi: update abi dump for CONFIG_KPROBES
  ANDROID: gki_defconfig: Enable Kprobes
  ANDROID: Correct branch name after rename
  ANDROID: GKI: update ABI due to power supply changes
  UPSTREAM: power: supply: core: add POWER_SUPPLY_HEALTH_CALIBRATION_REQUIRED
  UPSTREAM: power: supply: core: add manufacture date properties
  UPSTREAM: power: supply: core: add capacity error margin property
  UPSTREAM: power: supply: core: Add type property to uevent env
  UPSTREAM: power: supply: core: Add a macro that maps enum properties to text values
  UPSTREAM: power: supply: core: Use designated initializer for property text arrays
  UPSTREAM: power: supply: core: Cleanup power supply sysfs attribute list
  UPSTREAM: power: supply: core: reduce power_supply_show_usb_type() parameters
  ANDROID: fix copyright notice
  ANDROID: add support for vendor hooks
  ANDROID: GKI: update abi definitions
  Linux 5.4.51
  efi: Make it possible to disable efivar_ssdt entirely
  dm zoned: assign max_io_len correctly
  x86/resctrl: Fix memory bandwidth counter width for AMD
  mm, compaction: make capture control handling safe wrt interrupts
  mm, compaction: fully assume capture is not NULL in compact_zone_order()
  irqchip/gic: Atomically update affinity
  dma-buf: Move dma_buf_release() from fops to dentry_ops
  drm/amdgpu/atomfirmware: fix vram_info fetching for renoir
  drm/amdgpu: use %u rather than %d for sclk/mclk
  drm/amd/display: Only revalidate bandwidth on medium and fast updates
  MIPS: Add missing EHB in mtc0 -> mfc0 sequence for DSPen
  MIPS: lantiq: xway: sysctrl: fix the GPHY clock alias names
  cifs: Fix the target file was deleted when rename failed.
  SMB3: Honor 'handletimeout' flag for multiuser mounts
  SMB3: Honor lease disabling for multiuser mounts
  SMB3: Honor persistent/resilient handle flags for multiuser mounts
  SMB3: Honor 'seal' flag for multiuser mounts
  Revert "ALSA: usb-audio: Improve frames size computation"
  nfsd: apply umask on fs without ACL support
  spi: spi-fsl-dspi: Fix external abort on interrupt in resume or exit paths
  i2c: mlxcpld: check correct size of maximum RECV_LEN packet
  i2c: algo-pca: Add 0x78 as SCL stuck low status for PCA9665
  samples/vfs: avoid warning in statx override
  nvme: fix a crash in nvme_mpath_add_disk
  nvme: fix identify error status silent ignore
  SMB3: Honor 'posix' flag for multiuser mounts
  virtio-blk: free vblk-vqs in error path of virtblk_probe()
  drm: sun4i: hdmi: Remove extra HPD polling
  nfsd: fix nfsdfs inode reference count leak
  nfsd4: fix nfsdfs reference count loop
  thermal/drivers/rcar_gen3: Fix undefined temperature if negative
  thermal/drivers/mediatek: Fix bank number settings on mt8183
  hwmon: (acpi_power_meter) Fix potential memory leak in acpi_power_meter_add()
  hwmon: (max6697) Make sure the OVERT mask is set correctly
  cxgb4: fix SGE queue dump destination buffer context
  cxgb4: use correct type for all-mask IP address comparison
  cxgb4: fix endian conversions for L4 ports in filters
  cxgb4: parse TC-U32 key values and masks natively
  cxgb4: use unaligned conversion for fetching timestamp
  RDMA/counter: Query a counter before release
  rxrpc: Fix afs large storage transmission performance drop
  drm/msm/dpu: fix error return code in dpu_encoder_init
  crypto: af_alg - fix use-after-free in af_alg_accept() due to bh_lock_sock()
  tpm: Fix TIS locality timeout problems
  selftests: tpm: Use /bin/sh instead of /bin/bash
  kgdb: Avoid suspicious RCU usage warning
  nvme-multipath: fix bogus request queue reference put
  nvme-multipath: fix deadlock due to head->lock
  nvme-multipath: fix deadlock between ana_work and scan_work
  nvme-multipath: set bdi capabilities once
  s390/debug: avoid kernel warning on too large number of pages
  tools lib traceevent: Handle __attribute__((user)) in field names
  tools lib traceevent: Add append() function helper for appending strings
  usb: usbtest: fix missing kfree(dev->buf) in usbtest_disconnect
  rxrpc: Fix race between incoming ACK parser and retransmitter
  mm/slub: fix stack overruns with SLUB_STATS
  mm/slub.c: fix corrupted freechain in deactivate_slab()
  sched/debug: Make sd->flags sysctl read-only
  usbnet: smsc95xx: Fix use-after-free after removal
  EDAC/amd64: Read back the scrub rate PCI register on F15h
  mm: fix swap cache node allocation mask
  io_uring: make sure async workqueue is canceled on exit
  ANDROID: update the ABI representation after ion sysfs changes
  ANDROID: add ion_stat tracepoint to common kernel
  ANDROID: staging: android: ion: Expose total heap and pool sizes via sysfs
  ANDROID: Update ABI representation for libabigail update
  ANDROID: Update the ABI representation
  ANDROID: GKI: Incremental fs: move MODULE_IMPORT_NS() line
  ANDROID: GKI: set vfs-only exports into their own namespace
  ANDROID: gki: build-in DMA_VIRTUAL_CHANNELS
  ANDROID: GKI: make VIDEOBUF2_DMA_CONTIG under GKI_HIDDEN_MEDIA_CONFIGS
  ANDROID: PM: sleep: export device_pm_callback_start/end trace event
  ANDROID: fix copyright notice
  ANDROID: GKI: add android_vendor.h
  ANDROID: GKI: enable CONFIG_V4L_PLATFORM_DRIVERS
  ANDROID: GKI: enable CONFIG_TYPEC_TCPM
  ANDROID: GKI: support CONFIG_INPUT_TOUCHSCREEN
  ANDROID: GKI: move abi files to android/
  ANDROID: GKI: drop unneeded "_whitelist" off of symbol filenames
  ANDROID: GKI: modules should not run programs
  UPSTREAM: net: bpf: Make bpf_ktime_get_ns() available to non GPL programs
  UPSTREAM: bpf: Add gso_size to __sk_buff
  UPSTREAM: usb: musb: mediatek: add reset FADDR to zero in reset interrupt handle
  ANDROID: ABI/Whitelist: update symbols of incrementalfs.ko and sprd_*.ko to unisoc whitelist
  ANDROID: GKI: update abi definition now that EHCI driver is built in
  ANDROID: GKI: support CONFIG_USB_EHCI_HCD_PLATFORM
  ANDROID: GKI: support CONFIG_USB_EHCI_HCD
  ANDROID: Update kabi for db845c (keeping up with ufs-qcom zig-zag)
  ANDROID: GKI: scripts: Makefile: update the lz4 command (#2)

Conflicts:
	android/abi_gki_aarch64_qcom
	drivers/dma-buf/dma-buf.c
	kernel/trace/power-traces.c

Change-Id: I9993aff20a659ab20af5f890f1f789cd4ef19246
Signed-off-by: Blagovest Kolenichev <[email protected]>
This commit is contained in:
Blagovest Kolenichev 2020-07-27 01:03:51 -07:00
commit fac8c789d8
237 changed files with 77348 additions and 78814 deletions

View file

@ -6,6 +6,8 @@
# Rewritten to use lists instead of if-statements.
#
ccflags-y += -DANDROID_GKI_VFS_EXPORT_ONLY=VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver
obj-y := open.o read_write.o file_table.o super.o \
char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \
ioctl.o readdir.o select.o dcache.o inode.o \

View file

@ -5025,25 +5025,28 @@ struct extent_buffer *alloc_dummy_extent_buffer(struct btrfs_fs_info *fs_info,
static void check_buffer_tree_ref(struct extent_buffer *eb)
{
int refs;
/* the ref bit is tricky. We have to make sure it is set
* if we have the buffer dirty. Otherwise the
* code to free a buffer can end up dropping a dirty
* page
/*
* The TREE_REF bit is first set when the extent_buffer is added
* to the radix tree. It is also reset, if unset, when a new reference
* is created by find_extent_buffer.
*
* Once the ref bit is set, it won't go away while the
* buffer is dirty or in writeback, and it also won't
* go away while we have the reference count on the
* eb bumped.
* It is only cleared in two cases: freeing the last non-tree
* reference to the extent_buffer when its STALE bit is set or
* calling releasepage when the tree reference is the only reference.
*
* We can't just set the ref bit without bumping the
* ref on the eb because free_extent_buffer might
* see the ref bit and try to clear it. If this happens
* free_extent_buffer might end up dropping our original
* ref by mistake and freeing the page before we are able
* to add one more ref.
* In both cases, care is taken to ensure that the extent_buffer's
* pages are not under io. However, releasepage can be concurrently
* called with creating new references, which is prone to race
* conditions between the calls to check_buffer_tree_ref in those
* codepaths and clearing TREE_REF in try_release_extent_buffer.
*
* So bump the ref count first, then set the bit. If someone
* beat us to it, drop the ref we added.
* The actual lifetime of the extent_buffer in the radix tree is
* adequately protected by the refcount, but the TREE_REF bit and
* its corresponding reference are not. To protect against this
* class of races, we call check_buffer_tree_ref from the codepaths
* which trigger io after they set eb->io_pages. Note that once io is
* initiated, TREE_REF can no longer be cleared, so that is the
* moment at which any such race is best fixed.
*/
refs = atomic_read(&eb->refs);
if (refs >= 2 && test_bit(EXTENT_BUFFER_TREE_REF, &eb->bflags))
@ -5493,6 +5496,11 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num)
clear_bit(EXTENT_BUFFER_READ_ERR, &eb->bflags);
eb->read_mirror = 0;
atomic_set(&eb->io_pages, num_reads);
/*
* It is possible for releasepage to clear the TREE_REF bit before we
* set io_pages. See check_buffer_tree_ref for a more detailed comment.
*/
check_buffer_tree_ref(eb);
for (i = 0; i < num_pages; i++) {
page = eb->pages[i];

View file

@ -1657,12 +1657,8 @@ out_check:
ret = fallback_to_cow(inode, locked_page, cow_start,
found_key.offset - 1,
page_started, nr_written);
if (ret) {
if (nocow)
btrfs_dec_nocow_writers(fs_info,
disk_bytenr);
if (ret)
goto error;
}
cow_start = (u64)-1;
}
@ -1678,9 +1674,6 @@ out_check:
ram_bytes, BTRFS_COMPRESS_NONE,
BTRFS_ORDERED_PREALLOC);
if (IS_ERR(em)) {
if (nocow)
btrfs_dec_nocow_writers(fs_info,
disk_bytenr);
ret = PTR_ERR(em);
goto error;
}

View file

@ -5281,9 +5281,15 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
vol_info->nocase = master_tcon->nocase;
vol_info->nohandlecache = master_tcon->nohandlecache;
vol_info->local_lease = master_tcon->local_lease;
vol_info->no_lease = master_tcon->no_lease;
vol_info->resilient = master_tcon->use_resilient;
vol_info->persistent = master_tcon->use_persistent;
vol_info->handle_timeout = master_tcon->handle_timeout;
vol_info->no_linux_ext = !master_tcon->unix_ext;
vol_info->linux_ext = master_tcon->posix_extensions;
vol_info->sectype = master_tcon->ses->sectype;
vol_info->sign = master_tcon->ses->sign;
vol_info->seal = master_tcon->seal;
rc = cifs_set_vol_auth(vol_info, master_tcon->ses);
if (rc) {
@ -5309,10 +5315,6 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
goto out;
}
/* if new SMB3.11 POSIX extensions are supported do not remap / and \ */
if (tcon->posix_extensions)
cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_POSIX_PATHS;
if (cap_unix(ses))
reset_cifs_unix_caps(0, tcon, NULL, vol_info);

View file

@ -1791,6 +1791,7 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry,
FILE_UNIX_BASIC_INFO *info_buf_target;
unsigned int xid;
int rc, tmprc;
bool new_target = d_really_is_negative(target_dentry);
if (flags & ~RENAME_NOREPLACE)
return -EINVAL;
@ -1867,8 +1868,13 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry,
*/
unlink_target:
/* Try unlinking the target dentry if it's not negative */
if (d_really_is_positive(target_dentry) && (rc == -EACCES || rc == -EEXIST)) {
/*
* If the target dentry was created during the rename, try
* unlinking it if it's not negative
*/
if (new_target &&
d_really_is_positive(target_dentry) &&
(rc == -EACCES || rc == -EEXIST)) {
if (d_is_dir(target_dentry))
tmprc = cifs_rmdir(target_dir, target_dentry);
else
@ -2264,6 +2270,15 @@ set_size_out:
if (rc == 0) {
cifsInode->server_eof = attrs->ia_size;
cifs_setsize(inode, attrs->ia_size);
/*
* The man page of truncate says if the size changed,
* then the st_ctime and st_mtime fields for the file
* are updated.
*/
attrs->ia_ctime = attrs->ia_mtime = current_time(inode);
attrs->ia_valid |= ATTR_CTIME | ATTR_MTIME;
cifs_truncate_page(inode->i_mapping, inode->i_size);
}

View file

@ -77,7 +77,8 @@ static int fscrypt_zeroout_range_inlinecrypt(const struct inode *inode,
lblk += blocks_this_page;
pblk += blocks_this_page;
len -= blocks_this_page;
} while (++i != BIO_MAX_PAGES && len != 0);
} while (++i != BIO_MAX_PAGES && len != 0 &&
fscrypt_mergeable_bio(bio, inode, lblk));
err = submit_bio_wait(bio);
if (err)

View file

@ -88,6 +88,19 @@ int fscrypt_select_encryption_impl(struct fscrypt_info *ci,
!sb->s_cop->inline_crypt_enabled(sb))
return 0;
/*
* When a page contains multiple logically contiguous filesystem blocks,
* some filesystem code only calls fscrypt_mergeable_bio() for the first
* block in the page. This is fine for most of fscrypt's IV generation
* strategies, where contiguous blocks imply contiguous IVs. But it
* doesn't work with IV_INO_LBLK_32. For now, simply exclude
* IV_INO_LBLK_32 with blocksize != PAGE_SIZE from inline encryption.
*/
if ((fscrypt_policy_flags(&ci->ci_policy) &
FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32) &&
sb->s_blocksize != PAGE_SIZE)
return 0;
/*
* The needed encryption settings must be supported either by
* blk-crypto-fallback, or by hardware on all the filesystem's devices.
@ -441,7 +454,6 @@ EXPORT_SYMBOL_GPL(fscrypt_mergeable_bio_bh);
bool fscrypt_dio_supported(struct kiocb *iocb, struct iov_iter *iter)
{
const struct inode *inode = file_inode(iocb->ki_filp);
const struct fscrypt_info *ci = inode->i_crypt_info;
const unsigned int blocksize = i_blocksize(inode);
/* If the file is unencrypted, no veto from us. */
@ -459,15 +471,6 @@ bool fscrypt_dio_supported(struct kiocb *iocb, struct iov_iter *iter)
if (!IS_ALIGNED(iocb->ki_pos | iov_iter_alignment(iter), blocksize))
return false;
/*
* With IV_INO_LBLK_32 and sub-page blocks, the DUN can wrap around in
* the middle of a page. This isn't handled by the direct I/O code yet.
*/
if (blocksize != PAGE_SIZE &&
(fscrypt_policy_flags(&ci->ci_policy) &
FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32))
return false;
return true;
}
EXPORT_SYMBOL_GPL(fscrypt_dio_supported);
@ -482,8 +485,6 @@ EXPORT_SYMBOL_GPL(fscrypt_dio_supported);
* targeting @pos, in order to avoid crossing a data unit number (DUN)
* discontinuity. This is only needed for certain IV generation methods.
*
* This assumes block_size == PAGE_SIZE; see fscrypt_dio_supported().
*
* Return: the actual number of pages that can be submitted
*/
int fscrypt_limit_dio_pages(const struct inode *inode, loff_t pos, int nr_pages)
@ -501,6 +502,10 @@ int fscrypt_limit_dio_pages(const struct inode *inode, loff_t pos, int nr_pages)
FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32))
return nr_pages;
/*
* fscrypt_select_encryption_impl() ensures that block_size == PAGE_SIZE
* when using FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32.
*/
if (WARN_ON_ONCE(i_blocksize(inode) != PAGE_SIZE))
return 1;

View file

@ -4093,6 +4093,8 @@ static inline bool f2fs_force_buffered_io(struct inode *inode,
return true;
if (fsverity_active(inode))
return true;
if (f2fs_compressed_file(inode))
return true;
if (f2fs_is_multi_device(sbi))
return true;
/*

View file

@ -99,5 +99,6 @@ module_init(init_incfs_module);
module_exit(cleanup_incfs_module);
MODULE_LICENSE("GPL v2");
MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver);
MODULE_AUTHOR("Eugene Zemtsov <[email protected]>");
MODULE_DESCRIPTION("Incremental File System");

View file

@ -267,6 +267,9 @@ struct io_ring_ctx {
#if defined(CONFIG_UNIX)
struct socket *ring_sock;
#endif
struct list_head task_list;
spinlock_t task_lock;
};
struct sqe_submit {
@ -331,14 +334,18 @@ struct io_kiocb {
#define REQ_F_ISREG 2048 /* regular file */
#define REQ_F_MUST_PUNT 4096 /* must be punted even for NONBLOCK */
#define REQ_F_TIMEOUT_NOSEQ 8192 /* no timeout sequence */
#define REQ_F_CANCEL 16384 /* cancel request */
unsigned long fsize;
u64 user_data;
u32 result;
u32 sequence;
struct task_struct *task;
struct fs_struct *fs;
struct work_struct work;
struct task_struct *work_task;
struct list_head task_list;
};
#define IO_PLUG_THRESHOLD 2
@ -425,6 +432,8 @@ static struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p)
INIT_LIST_HEAD(&ctx->cancel_list);
INIT_LIST_HEAD(&ctx->defer_list);
INIT_LIST_HEAD(&ctx->timeout_list);
INIT_LIST_HEAD(&ctx->task_list);
spin_lock_init(&ctx->task_lock);
return ctx;
}
@ -492,6 +501,7 @@ static void __io_commit_cqring(struct io_ring_ctx *ctx)
static inline void io_queue_async_work(struct io_ring_ctx *ctx,
struct io_kiocb *req)
{
unsigned long flags;
int rw = 0;
if (req->submit.sqe) {
@ -503,6 +513,13 @@ static inline void io_queue_async_work(struct io_ring_ctx *ctx,
}
}
req->task = current;
spin_lock_irqsave(&ctx->task_lock, flags);
list_add(&req->task_list, &ctx->task_list);
req->work_task = NULL;
spin_unlock_irqrestore(&ctx->task_lock, flags);
queue_work(ctx->sqo_wq[rw], &req->work);
}
@ -2201,6 +2218,8 @@ static void io_sq_wq_submit_work(struct work_struct *work)
old_cred = override_creds(ctx->creds);
async_list = io_async_list_from_sqe(ctx, req->submit.sqe);
allow_kernel_signal(SIGINT);
restart:
do {
struct sqe_submit *s = &req->submit;
@ -2232,6 +2251,12 @@ restart:
}
if (!ret) {
req->work_task = current;
if (req->flags & REQ_F_CANCEL) {
ret = -ECANCELED;
goto end_req;
}
s->has_user = cur_mm != NULL;
s->needs_lock = true;
do {
@ -2246,6 +2271,12 @@ restart:
break;
cond_resched();
} while (1);
end_req:
if (!list_empty(&req->task_list)) {
spin_lock_irq(&ctx->task_lock);
list_del_init(&req->task_list);
spin_unlock_irq(&ctx->task_lock);
}
}
/* drop submission reference */
@ -2311,6 +2342,7 @@ restart:
}
out:
disallow_signal(SIGINT);
if (cur_mm) {
set_fs(old_fs);
unuse_mm(cur_mm);
@ -3675,12 +3707,32 @@ static int io_uring_fasync(int fd, struct file *file, int on)
return fasync_helper(fd, file, on, &ctx->cq_fasync);
}
static void io_cancel_async_work(struct io_ring_ctx *ctx,
struct task_struct *task)
{
if (list_empty(&ctx->task_list))
return;
spin_lock_irq(&ctx->task_lock);
while (!list_empty(&ctx->task_list)) {
struct io_kiocb *req;
req = list_first_entry(&ctx->task_list, struct io_kiocb, task_list);
list_del_init(&req->task_list);
req->flags |= REQ_F_CANCEL;
if (req->work_task && (!task || req->task == task))
send_sig(SIGINT, req->work_task, 1);
}
spin_unlock_irq(&ctx->task_lock);
}
static void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx)
{
mutex_lock(&ctx->uring_lock);
percpu_ref_kill(&ctx->refs);
mutex_unlock(&ctx->uring_lock);
io_cancel_async_work(ctx, NULL);
io_kill_timeouts(ctx);
io_poll_remove_all(ctx);
io_iopoll_reap_events(ctx);
@ -3688,6 +3740,16 @@ static void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx)
io_ring_ctx_free(ctx);
}
static int io_uring_flush(struct file *file, void *data)
{
struct io_ring_ctx *ctx = file->private_data;
if (fatal_signal_pending(current) || (current->flags & PF_EXITING))
io_cancel_async_work(ctx, current);
return 0;
}
static int io_uring_release(struct inode *inode, struct file *file)
{
struct io_ring_ctx *ctx = file->private_data;
@ -3792,6 +3854,7 @@ out_fput:
static const struct file_operations io_uring_fops = {
.release = io_uring_release,
.flush = io_uring_flush,
.mmap = io_uring_mmap,
.poll = io_uring_poll,
.fasync = io_uring_fasync,

View file

@ -2509,7 +2509,7 @@ int kern_path(const char *name, unsigned int flags, struct path *path)
return filename_lookup(AT_FDCWD, getname_kernel(name),
flags, path, NULL);
}
EXPORT_SYMBOL(kern_path);
EXPORT_SYMBOL_NS(kern_path, ANDROID_GKI_VFS_EXPORT_ONLY);
/**
* vfs_path_lookup - lookup a file path relative to a dentry-vfsmount pair
@ -2989,7 +2989,7 @@ int vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
fsnotify_create(dir, dentry);
return error;
}
EXPORT_SYMBOL(vfs_create);
EXPORT_SYMBOL_NS(vfs_create, ANDROID_GKI_VFS_EXPORT_ONLY);
int vfs_mkobj(struct dentry *dentry, umode_t mode,
int (*f)(struct dentry *, umode_t, void *),
@ -3896,7 +3896,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
fsnotify_mkdir(dir, dentry);
return error;
}
EXPORT_SYMBOL(vfs_mkdir);
EXPORT_SYMBOL_NS(vfs_mkdir, ANDROID_GKI_VFS_EXPORT_ONLY);
long do_mkdirat(int dfd, const char __user *pathname, umode_t mode)
{
@ -3971,7 +3971,7 @@ out:
d_delete(dentry);
return error;
}
EXPORT_SYMBOL(vfs_rmdir);
EXPORT_SYMBOL_NS(vfs_rmdir, ANDROID_GKI_VFS_EXPORT_ONLY);
long do_rmdir(int dfd, const char __user *pathname)
{
@ -4094,7 +4094,7 @@ out:
return error;
}
EXPORT_SYMBOL(vfs_unlink);
EXPORT_SYMBOL_NS(vfs_unlink, ANDROID_GKI_VFS_EXPORT_ONLY);
/*
* Make sure that the actual truncation of the file will occur outside its
@ -4330,7 +4330,7 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
fsnotify_link(dir, inode, new_dentry);
return error;
}
EXPORT_SYMBOL(vfs_link);
EXPORT_SYMBOL_NS(vfs_link, ANDROID_GKI_VFS_EXPORT_ONLY);
/*
* Hardlinks are often used in delicate situations. We avoid
@ -4590,7 +4590,7 @@ out:
return error;
}
EXPORT_SYMBOL(vfs_rename);
EXPORT_SYMBOL_NS(vfs_rename, ANDROID_GKI_VFS_EXPORT_ONLY);
static int do_renameat2(int olddfd, const char __user *oldname, int newdfd,
const char __user *newname, unsigned int flags)

View file

@ -7705,9 +7705,14 @@ nfs4_state_start_net(struct net *net)
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
int ret;
ret = nfs4_state_create_net(net);
ret = get_nfsdfs(net);
if (ret)
return ret;
ret = nfs4_state_create_net(net);
if (ret) {
mntput(nn->nfsd_mnt);
return ret;
}
locks_start_grace(net, &nn->nfsd4_manager);
nfsd4_client_tracking_init(net);
if (nn->track_reclaim_completes && nn->reclaim_str_hashtbl_size == 0)
@ -7776,6 +7781,7 @@ nfs4_state_shutdown_net(struct net *net)
nfsd4_client_tracking_exit(net);
nfs4_state_destroy_net(net);
mntput(nn->nfsd_mnt);
}
void

View file

@ -1335,6 +1335,7 @@ void nfsd_client_rmdir(struct dentry *dentry)
WARN_ON_ONCE(ret);
fsnotify_rmdir(dir, dentry);
d_delete(dentry);
dput(dentry);
inode_unlock(dir);
}
@ -1424,6 +1425,18 @@ static struct file_system_type nfsd_fs_type = {
};
MODULE_ALIAS_FS("nfsd");
int get_nfsdfs(struct net *net)
{
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
struct vfsmount *mnt;
mnt = vfs_kern_mount(&nfsd_fs_type, SB_KERNMOUNT, "nfsd", NULL);
if (IS_ERR(mnt))
return PTR_ERR(mnt);
nn->nfsd_mnt = mnt;
return 0;
}
#ifdef CONFIG_PROC_FS
static int create_proc_exports_entry(void)
{
@ -1452,7 +1465,6 @@ unsigned int nfsd_net_id;
static __net_init int nfsd_init_net(struct net *net)
{
int retval;
struct vfsmount *mnt;
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
retval = nfsd_export_init(net);
@ -1479,16 +1491,8 @@ static __net_init int nfsd_init_net(struct net *net)
init_waitqueue_head(&nn->ntf_wq);
seqlock_init(&nn->boot_lock);
mnt = vfs_kern_mount(&nfsd_fs_type, SB_KERNMOUNT, "nfsd", NULL);
if (IS_ERR(mnt)) {
retval = PTR_ERR(mnt);
goto out_mount_err;
}
nn->nfsd_mnt = mnt;
return 0;
out_mount_err:
nfsd_reply_cache_shutdown(nn);
out_drc_error:
nfsd_idmap_shutdown(net);
out_idmap_error:
@ -1501,7 +1505,6 @@ static __net_exit void nfsd_exit_net(struct net *net)
{
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
mntput(nn->nfsd_mnt);
nfsd_reply_cache_shutdown(nn);
nfsd_idmap_shutdown(net);
nfsd_export_shutdown(net);

View file

@ -87,6 +87,8 @@ int nfsd_pool_stats_release(struct inode *, struct file *);
void nfsd_destroy(struct net *net);
int get_nfsdfs(struct net *);
struct nfsdfs_client {
struct kref cl_ref;
void (*cl_release)(struct kref *kref);
@ -97,6 +99,7 @@ struct dentry *nfsd_client_mkdir(struct nfsd_net *nn,
struct nfsdfs_client *ncl, u32 id, const struct tree_descr *);
void nfsd_client_rmdir(struct dentry *dentry);
#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
#ifdef CONFIG_NFSD_V2_ACL
extern const struct svc_version nfsd_acl_version2;

View file

@ -1184,6 +1184,9 @@ nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp,
iap->ia_mode = 0;
iap->ia_mode = (iap->ia_mode & S_IALLUGO) | type;
if (!IS_POSIXACL(dirp))
iap->ia_mode &= ~current_umask();
err = 0;
host_err = 0;
switch (type) {
@ -1416,6 +1419,9 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
goto out;
}
if (!IS_POSIXACL(dirp))
iap->ia_mode &= ~current_umask();
host_err = vfs_create(dirp, dchild, iap->ia_mode, true);
if (host_err < 0) {
fh_drop_write(fhp);

View file

@ -321,7 +321,7 @@ int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
file_end_write(file);
return ret;
}
EXPORT_SYMBOL_GPL(vfs_fallocate);
EXPORT_SYMBOL_NS_GPL(vfs_fallocate, ANDROID_GKI_VFS_EXPORT_ONLY);
int ksys_fallocate(int fd, int mode, loff_t offset, loff_t len)
{
@ -932,7 +932,7 @@ struct file *dentry_open(const struct path *path, int flags,
}
return f;
}
EXPORT_SYMBOL(dentry_open);
EXPORT_SYMBOL_NS(dentry_open, ANDROID_GKI_VFS_EXPORT_ONLY);
struct file *open_with_fake_path(const struct path *path, int flags,
struct inode *inode, const struct cred *cred)

View file

@ -441,7 +441,7 @@ ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos)
set_fs(old_fs);
return result;
}
EXPORT_SYMBOL(kernel_read);
EXPORT_SYMBOL_NS(kernel_read, ANDROID_GKI_VFS_EXPORT_ONLY);
ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
{
@ -537,7 +537,7 @@ ssize_t kernel_write(struct file *file, const void *buf, size_t count,
return res;
}
EXPORT_SYMBOL(kernel_write);
EXPORT_SYMBOL_NS(kernel_write, ANDROID_GKI_VFS_EXPORT_ONLY);
ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_t *pos)
{

View file

@ -117,7 +117,7 @@ int vfs_getattr(const struct path *path, struct kstat *stat,
return retval;
return vfs_getattr_nosec(path, stat, request_mask, query_flags);
}
EXPORT_SYMBOL(vfs_getattr);
EXPORT_SYMBOL_NS(vfs_getattr, ANDROID_GKI_VFS_EXPORT_ONLY);
/**
* vfs_statx_fd - Get the enhanced basic attributes by file descriptor

View file

@ -227,7 +227,7 @@ out:
inode_unlock(inode);
return error;
}
EXPORT_SYMBOL_GPL(vfs_setxattr);
EXPORT_SYMBOL_NS_GPL(vfs_setxattr, ANDROID_GKI_VFS_EXPORT_ONLY);
static ssize_t
xattr_getsecurity(struct inode *inode, const char *name, void *value,
@ -341,7 +341,7 @@ vfs_getxattr(struct dentry *dentry, const char *name, void *value, size_t size)
{
return __vfs_getxattr(dentry, dentry->d_inode, name, value, size, 0);
}
EXPORT_SYMBOL_GPL(vfs_getxattr);
EXPORT_SYMBOL_NS_GPL(vfs_getxattr, ANDROID_GKI_VFS_EXPORT_ONLY);
ssize_t
vfs_listxattr(struct dentry *dentry, char *list, size_t size)
@ -361,7 +361,7 @@ vfs_listxattr(struct dentry *dentry, char *list, size_t size)
}
return error;
}
EXPORT_SYMBOL_GPL(vfs_listxattr);
EXPORT_SYMBOL_NS_GPL(vfs_listxattr, ANDROID_GKI_VFS_EXPORT_ONLY);
int
__vfs_removexattr(struct dentry *dentry, const char *name)