stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Filipe Manana <fdmanana@suse.com>,
	Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>
Subject: [PATCH 4.14 122/199] btrfs: check commit root generation in should_ignore_root
Date: Wed, 22 Apr 2020 11:57:28 +0200	[thread overview]
Message-ID: <20200422095109.746774152@linuxfoundation.org> (raw)
In-Reply-To: <20200422095057.806111593@linuxfoundation.org>

From: Josef Bacik <josef@toxicpanda.com>

commit 4d4225fc228e46948486d8b8207955f0c031b92e upstream.

Previously we would set the reloc root's last snapshot to transid - 1.
However there was a problem with doing this, and we changed it to
setting the last snapshot to the generation of the commit node of the fs
root.

This however broke should_ignore_root().  The assumption is that if we
are in a generation newer than when the reloc root was created, then we
would find the reloc root through normal backref lookups, and thus can
ignore any fs roots we find with an old enough reloc root.

Now that the last snapshot could be considerably further in the past
than before, we'd end up incorrectly ignoring an fs root.  Thus we'd
find no nodes for the bytenr we were searching for, and we'd fail to
relocate anything.  We'd loop through the relocate code again and see
that there were still used space in that block group, attempt to
relocate those bytenr's again, fail in the same way, and just loop like
this forever.  This is tricky in that we have to not modify the fs root
at all during this time, so we need to have a block group that has data
in this fs root that is not shared by any other root, which is why this
has been difficult to reproduce.

Fixes: 054570a1dc94 ("Btrfs: fix relocation incorrectly dropping data references")
CC: stable@vger.kernel.org # 4.9+
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/btrfs/relocation.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -538,8 +538,8 @@ static int should_ignore_root(struct btr
 	if (!reloc_root)
 		return 0;
 
-	if (btrfs_root_last_snapshot(&reloc_root->root_item) ==
-	    root->fs_info->running_transaction->transid - 1)
+	if (btrfs_header_generation(reloc_root->commit_root) ==
+	    root->fs_info->running_transaction->transid)
 		return 0;
 	/*
 	 * if there is reloc tree and it was created in previous



  parent reply	other threads:[~2020-04-22 10:49 UTC|newest]

Thread overview: 132+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22  9:55 [PATCH 4.14 000/199] 4.14.177-rc1 review Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 001/199] bus: sunxi-rsb: Return correct data when mixing 16-bit and 8-bit reads Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 002/199] net: vxge: fix wrong __VA_ARGS__ usage Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 003/199] hinic: fix a bug of waitting for IO stopped Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 004/199] hinic: fix wrong para of wait_for_completion_timeout Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 005/199] cxgb4/ptp: pass the sign of offset delta in FW CMD Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 006/199] qlcnic: Fix bad kzalloc null test Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 007/199] i2c: st: fix missing struct parameter description Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 008/199] null_blk: Fix the null_add_dev() error path Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 009/199] null_blk: Handle null_add_dev() failures properly Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 010/199] null_blk: fix spurious IO errors after failed past-wp access Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 011/199] x86: Dont let pgprot_modify() change the page encryption bit Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 012/199] block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 013/199] irqchip/versatile-fpga: Handle chained IRQs properly Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 014/199] sched: Avoid scale real weight down to zero Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 015/199] selftests/x86/ptrace_syscall_32: Fix no-vDSO segfault Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 016/199] PCI/switchtec: Fix init_completion race condition with poll_wait() Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 017/199] libata: Remove extra scsi_host_put() in ata_scsi_add_hosts() Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 018/199] gfs2: Dont demote a glock until its revokes are written Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 019/199] x86/boot: Use unsigned comparison for addresses Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 020/199] efi/x86: Ignore the memory attributes table on i386 Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 021/199] genirq/irqdomain: Check pointer in irq_domain_alloc_irqs_hierarchy() Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 022/199] block: Fix use-after-free issue accessing struct io_cq Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 023/199] usb: dwc3: core: add support for disabling SS instances in park mode Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 024/199] irqchip/gic-v4: Provide irq_retrigger to avoid circular locking dependency Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 025/199] locking/lockdep: Avoid recursion in lockdep_count_{for,back}ward_deps() Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 026/199] block, bfq: fix use-after-free in bfq_idle_slice_timer_body Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 027/199] btrfs: remove a BUG_ON() from merge_reloc_roots() Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 028/199] btrfs: track reloc roots based on their commit root bytenr Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 029/199] uapi: rename ext2_swab() to swab() and share globally in swab.h Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 030/199] misc: rtsx: set correct pcr_ops for rts522A Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 031/199] slub: improve bit diffusion for freelist ptr obfuscation Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 032/199] ASoC: fix regwmask Greg Kroah-Hartman
2020-04-22  9:55 ` [PATCH 4.14 033/199] ASoC: dapm: connect virtual mux with default value Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 034/199] ASoC: dpcm: allow start or stop during pause for backend Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 035/199] ASoC: topology: use name_prefix for new kcontrol Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 036/199] usb: gadget: f_fs: Fix use after free issue as part of queue failure Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 037/199] usb: gadget: composite: Inform controller driver of self-powered Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 038/199] ALSA: usb-audio: Add mixer workaround for TRX40 and co Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 039/199] ALSA: hda: Add driver blacklist Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 040/199] ALSA: hda: Fix potential access overflow in beep helper Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 041/199] ALSA: ice1724: Fix invalid access for enumerated ctl items Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 042/199] ALSA: pcm: oss: Fix regression by buffer overflow fix Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 043/199] ALSA: doc: Document PC Beep Hidden Register on Realtek ALC256 Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 044/199] ALSA: hda/realtek - Set principled PC Beep configuration for ALC256 Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 045/199] media: ti-vpe: cal: fix disable_irqs to only the intended target Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 046/199] acpi/x86: ignore unspecified bit positions in the ACPI global lock field Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 047/199] thermal: devfreq_cooling: inline all stubs for CONFIG_DEVFREQ_THERMAL=n Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 048/199] nvme-fc: Revert "add module to ops template to allow module references" Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 049/199] PCI/ASPM: Clear the correct bits when enabling L1 substates Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 050/199] PCI: endpoint: Fix for concurrent memory allocation in OB address region Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 051/199] KEYS: reaching the keys quotas correctly Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 052/199] irqchip/versatile-fpga: Apply clear-mask earlier Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 053/199] MIPS: OCTEON: irq: Fix potential NULL pointer dereference Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 054/199] ath9k: Handle txpower changes even when TPC is disabled Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 055/199] signal: Extend exec_id to 64bits Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 056/199] x86/entry/32: Add missing ASM_CLAC to general_protection entry Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 057/199] KVM: nVMX: Properly handle userspace interrupt window request Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 058/199] KVM: s390: vsie: Fix region 1 ASCE sanity shadow address checks Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 059/199] KVM: s390: vsie: Fix delivery of addressing exceptions Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 060/199] KVM: x86: Allocate new rmap and large page tracking when moving memslot Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 061/199] KVM: VMX: Always VMCLEAR in-use VMCSes during crash with kexec support Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 062/199] KVM: VMX: fix crash cleanup when KVM wasnt used Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 063/199] CIFS: Fix bug which the return value by asynchronous read is error Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 064/199] btrfs: drop block from cache on error in relocation Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 065/199] crypto: mxs-dcp - fix scatterlist linearization for hash Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 066/199] ALSA: hda: Initialize power_state field properly Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 067/199] net: rtnl_configure_link: fix dev flags changes arg to __dev_notify_flags Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 068/199] powerpc/pseries: Drop pointless static qualifier in vpa_debugfs_init() Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 069/199] x86/speculation: Remove redundant arch_smt_update() invocation Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 070/199] tools: gpio: Fix out-of-tree build regression Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 071/199] mm: Use fixed constant in page_frag_alloc instead of size + 1 Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 072/199] dm verity fec: fix memory leak in verity_fec_dtr Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 073/199] scsi: zfcp: fix missing erp_lock in port recovery trigger for point-to-point Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 074/199] arm64: armv8_deprecated: Fix undef_hook mask for thumb setend Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 075/199] rtc: omap: Use define directive for PIN_CONFIG_ACTIVE_HIGH Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 076/199] NFS: Fix a page leak in nfs_destroy_unlinked_subrequests() Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 077/199] ext4: fix a data race at inode->i_blocks Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 078/199] fs/filesystems.c: downgrade user-reachable WARN_ONCE() to pr_warn_once() Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 079/199] ocfs2: no need try to truncate file beyond i_size Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 080/199] perf tools: Support Python 3.8+ in Makefile Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 081/199] s390/diag: fix display of diagnose call statistics Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 082/199] Input: i8042 - add Acer Aspire 5738z to nomux list Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 083/199] kmod: make request_module() return an error when autoloading is disabled Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 084/199] cpufreq: powernv: Fix use-after-free Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 085/199] hfsplus: fix crash and filesystem corruption when deleting files Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 086/199] libata: Return correct status in sata_pmp_eh_recover_pm() when ATA_DFLAG_DETACH is set Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 087/199] powerpc/powernv/idle: Restore AMR/UAMOR/AMOR after idle Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 088/199] powerpc/64/tm: Dont let userspace set regs->trap via sigreturn Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 089/199] powerpc/hash64/devmap: Use H_PAGE_THP_HUGE when setting up huge devmap PTE entries Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 090/199] powerpc/xive: Use XIVE_BAD_IRQ instead of zero to catch non configured IPIs Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 091/199] powerpc/kprobes: Ignore traps that happened in real mode Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 092/199] scsi: mpt3sas: Fix kernel panic observed on soft HBA unplug Greg Kroah-Hartman
2020-04-22  9:56 ` [PATCH 4.14 093/199] powerpc: Add attributes for setjmp/longjmp Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 094/199] powerpc: Make setjmp/longjmp signature standard Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 095/199] Btrfs: fix crash during unmount due to race with delayed inode workers Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 096/199] btrfs: use nofs allocations for running delayed items Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 097/199] dm zoned: remove duplicate nr_rnd_zones increase in dmz_init_zone() Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 098/199] crypto: caam - update xts sector size for large input length Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 099/199] drm/dp_mst: Fix clearing payload state on topology disable Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 100/199] drm: Remove PageReserved manipulation from drm_pci_alloc Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 101/199] ftrace/kprobe: Show the maxactive number on kprobe_events Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 102/199] ipmi: fix hung processes in __get_guid() Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 103/199] powerpc/fsl_booke: Avoid creating duplicate tlb1 entry Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 104/199] misc: echo: Remove unnecessary parentheses and simplify check for zero Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 105/199] mfd: dln2: Fix sanity checking for endpoints Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 106/199] amd-xgbe: Use __napi_schedule() in BH context Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 107/199] hsr: check protocol version in hsr_newlink() Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 108/199] net: ipv4: devinet: Fix crash when add/del multicast IP with autojoin Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 109/199] net: ipv6: do not consider routes via gateways for anycast address check Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 110/199] net: qrtr: send msgs from local of same id as broadcast Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 111/199] net: revert default NAPI poll timeout to 2 jiffies Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 112/199] net: stmmac: dwmac-sunxi: Provide TX and RX fifo sizes Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 113/199] scsi: ufs: Fix ufshcd_hold() caused scheduling while atomic Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 114/199] jbd2: improve comments about freeing data buffers whose page mapping is NULL Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 115/199] pwm: pca9685: Fix PWM/GPIO inter-operation Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 116/199] ext4: fix incorrect group count in ext4_fill_super error message Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 117/199] ext4: fix incorrect inodes per group in " Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 118/199] ASoC: Intel: mrfld: fix incorrect check on p->sink Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 119/199] ASoC: Intel: mrfld: return error codes when an error occurs Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 120/199] ALSA: usb-audio: Dont override ignore_ctl_error value from the map Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 121/199] tracing: Fix the race between registering snapshot event trigger and triggering snapshot operation Greg Kroah-Hartman
2020-04-22  9:57 ` Greg Kroah-Hartman [this message]
2020-04-22  9:57 ` [PATCH 4.14 123/199] mac80211_hwsim: Use kstrndup() in place of kasprintf() Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 124/199] ext4: do not zeroout extents beyond i_disksize Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 125/199] dm flakey: check for null arg_name in parse_features() Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 126/199] kvm: x86: Host feature SSBD doesnt imply guest feature SPEC_CTRL_SSBD Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 127/199] scsi: target: remove boilerplate code Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 128/199] scsi: target: fix hang when multiple threads try to destroy the same iscsi session Greg Kroah-Hartman
2020-04-22  9:57 ` [PATCH 4.14 129/199] x86/microcode/AMD: Increase microcode PATCH_MAX_SIZE Greg Kroah-Hartman
2020-04-23 10:20 ` [PATCH 4.14 000/199] 4.14.177-rc1 review Jon Hunter
2020-04-23 11:28 ` Naresh Kamboju

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200422095109.746774152@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=dsterba@suse.com \
    --cc=fdmanana@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).