From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cn.fujitsu.com ([59.151.112.132]:40683 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1750844AbbBZGQZ convert rfc822-to-8bit (ORCPT ); Thu, 26 Feb 2015 01:16:25 -0500 Message-ID: <54EEBA35.4080703@cn.fujitsu.com> Date: Thu, 26 Feb 2015 14:16:21 +0800 From: Qu Wenruo MIME-Version: 1.0 To: , Tomasz Chmielewski , Josef Bacik CC: linux-btrfs Subject: Re: WARNING: CPU: 1 PID: 2436 at fs/btrfs/qgroup.c:1414 btrfs_delayed_qgroup_accounting+0x9f1/0xa0b [btrfs]() References: <27573d37c7d634c3232820fa8464f235@admin.virtall.com> <109673fe6cda15800a731d1ee79d9175@admin.virtall.com> <20150213045648.GC25697@localhost.localdomain> <54ED8F72.7040603@cn.fujitsu.com> In-Reply-To: <54ED8F72.7040603@cn.fujitsu.com> Content-Type: text/plain; charset="utf-8"; format=flowed Sender: linux-btrfs-owner@vger.kernel.org List-ID: Oh, sorry, this problem is caused by other unmerged patches. Nothing to do with the original qgroup accouting codes. Sorry Thanks, Qu -------- Original Message -------- Subject: Re: WARNING: CPU: 1 PID: 2436 at fs/btrfs/qgroup.c:1414 btrfs_delayed_qgroup_accounting+0x9f1/0xa0b [btrfs]() From: Qu Wenruo To: , Tomasz Chmielewski , Josef Bacik Date: 2015年02月25日 17:01 > > -------- Original Message -------- > Subject: Re: WARNING: CPU: 1 PID: 2436 at fs/btrfs/qgroup.c:1414 > btrfs_delayed_qgroup_accounting+0x9f1/0xa0b [btrfs]() > From: Liu Bo > To: Tomasz Chmielewski > Date: 2015年02月13日 12:56 >> On Fri, Feb 13, 2015 at 10:20:25AM +0900, Tomasz Chmielewski wrote: >>> FYI, still seeing this with 3.19: >> I also got this warning (can be reproduced by a loop of running >> xfstests/btrfs/057) and >> tried to fix it but I failed. >> >> I think you also have several snapshots, and this warning may occur >> after deleting a shared file, the reason is that after >> 'commit fcebe4562dec ("Btrfs: rework qgroup accounting")', btrfs doesn't >> record time_seq for delayed refs at the point of adding delayed refs, >> >> Imagine such a case, >> >> # How we process a 'delete', >> 1. add delayed ref 'DROP' >> 2. run delayed ref 'DROP' >> 3. record qgroup operation for 'DROP' >> 4. process qgroup accounting for 'DROP' >> >> Here is an example, >> tree block A is shared by fs tree (rootid=5) and its snapshot >> (rootid=257), then we remove A in both fs tree and the snapshot, which >> means >> >> 'DROP A' on root 5 will either >> a) reduce fs tree's "qgroup reference number" and add snapshot's >> "qgroup exclusive number", >> or >> b) 'DROP A' on root 5 will think it's the last ref on this extent and >> reduce fs tree's both "qgroup reference >> number" and "qgroup exclusive number" by tree block A's length, and in a >> later time, 'DROP A' on root 257 will do this again, so the number can >> be something negative like -4k. >> >> Thanks, >> >> -liubo > And things seems get even worse when involving file extents in the > shared leaf. > Still use the A leaf shared by 5 and 257 and call the file extent in > it as F for example. > root 5 has only one exclusive node(4K for example) and F is 16K long. > > When root 257 needs to change leaf A, btrfs cow it and increase ref > counts on all file extents in A, > including F. > Btrfs ref increase codes knows leaf A is shared so passed ADD_SHARED > operation for qgroup codes.(*) > > Although qgroup rescan already consider every file extent in A is > shared, but in ADD_SHARED operation codes, > it still decide to reduce the excl number of root 5 since it consider > the file extent is exclusive before ADD_SHARED. > > So excl number of root 5 will be reduced by the length of F, which we > will get 4k - 16k. > > I have a 1G(compressed to 1.1M) binary image with the above situation > and any one can just trigger it by > remove everything in the fs. > (just rm -rf ,except the snapshot which can't be removed > using rm -rf). > https://drive.google.com/file/d/0BxpkL3ehzX3pYlkwRDJaUEFQZzQ/view?usp=sharing > > > Commit fcebe4562dec makes qgroup nearly unusable with snapshot. > To Josef, would you please consider revert that huge commit? > > Thanks, > Qu >>> [196992.429463] ------------[ cut here ]------------ >>> [196992.429526] WARNING: CPU: 1 PID: 26328 at fs/btrfs/qgroup.c:1414 >>> btrfs_delayed_qgroup_accounting+0x9f3/0xa0d [btrfs]() >>> [196992.429617] Modules linked in: xt_nat xt_tcpudp ipt_MASQUERADE >>> nf_nat_masquerade_ipv4 iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 >>> nf_nat_ipv4 nf_nat nf_conntrack ip_tables x_tables tun >>> cpufreq_conservative cpufreq_powersave cpufreq_stats ipv6 btrfs xor >>> raid6_pq zlib_deflate coretemp hwmon loop pcspkr i2c_i801 i2c_core >>> battery parport_pc parport tpm_infineon tpm_tis tpm video >>> 8250_fintek lpc_ich mfd_core ehci_pci ehci_hcd button acpi_cpufreq >>> ext4 crc16 jbd2 mbcache raid1 sg sd_mod ahci libahci libata scsi_mod >>> r8169 mii >>> [196992.429979] CPU: 1 PID: 26328 Comm: kworker/u16:21 Not tainted >>> 3.19.0 #1 >>> [196992.430026] Hardware name: System manufacturer System Product >>> Name/P8H77-M PRO, BIOS 1101 02/04/2013 >>> [196992.430123] Workqueue: btrfs-extent-refs >>> btrfs_extent_refs_helper [btrfs] >>> [196992.430171] 0000000000000009 ffff8800045a3c18 ffffffff813bc952 >>> 0000000000000000 >>> [196992.430260] 0000000000000000 ffff8800045a3c58 ffffffff8103b015 >>> ffff8807f9281c90 >>> [196992.430349] ffffffffa0332a33 ffff8807f9281000 ffff8807f2747f00 >>> ffffffffffffffff >>> [196992.430438] Call Trace: >>> [196992.430484] [] dump_stack+0x45/0x57 >>> [196992.430532] [] warn_slowpath_common+0x97/0xb1 >>> [196992.430586] [] ? >>> btrfs_delayed_qgroup_accounting+0x9f3/0xa0d [btrfs] >>> [196992.430675] [] warn_slowpath_null+0x15/0x17 >>> [196992.430727] [] >>> btrfs_delayed_qgroup_accounting+0x9f3/0xa0d [btrfs] >>> [196992.430820] [] >>> btrfs_run_delayed_refs+0x1e4/0x21b [btrfs] >>> [196992.430873] [] >>> delayed_ref_async_start+0x37/0x76 [btrfs] >>> [196992.430927] [] normal_work_helper+0xb5/0x16a >>> [btrfs] >>> [196992.430981] [] >>> btrfs_extent_refs_helper+0xd/0xf [btrfs] >>> [196992.431030] [] process_one_work+0x187/0x2a9 >>> [196992.431077] [] worker_thread+0x241/0x33e >>> [196992.431125] [] ? >>> process_scheduled_works+0x2a/0x2a >>> [196992.431173] [] kthread+0xcd/0xd5 >>> [196992.431219] [] ? >>> kthread_freezable_should_stop+0x43/0x43 >>> [196992.431268] [] ret_from_fork+0x7c/0xb0 >>> [196992.431315] [] ? >>> kthread_freezable_should_stop+0x43/0x43 >>> [196992.431363] ---[ end trace 5d57d07bb94831a0 ]--- >>> [197051.336444] ------------[ cut here ]------------ >>> [197051.336506] WARNING: CPU: 5 PID: 2544 at fs/btrfs/qgroup.c:1414 >>> btrfs_delayed_qgroup_accounting+0x9f3/0xa0d [btrfs]() >>> [197051.336598] Modules linked in: xt_nat xt_tcpudp ipt_MASQUERADE >>> nf_nat_masquerade_ipv4 iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 >>> nf_nat_ipv4 nf_nat nf_conntrack ip_tables x_tables tun >>> cpufreq_conservative cpufreq_powersave cpufreq_stats ipv6 btrfs xor >>> raid6_pq zlib_deflate coretemp hwmon loop pcspkr i2c_i801 i2c_core >>> battery parport_pc parport tpm_infineon tpm_tis tpm video >>> 8250_fintek lpc_ich mfd_core ehci_pci ehci_hcd button acpi_cpufreq >>> ext4 crc16 jbd2 mbcache raid1 sg sd_mod ahci libahci libata scsi_mod >>> r8169 mii >>> [197051.336965] CPU: 5 PID: 2544 Comm: btrfs-cleaner Tainted: G >>> W 3.19.0 #1 >>> [197051.337070] Hardware name: System manufacturer System Product >>> Name/P8H77-M PRO, BIOS 1101 02/04/2013 >>> [197051.337160] 0000000000000009 ffff8800c7e8bbe8 ffffffff813bc952 >>> 000000000000009b >>> [197051.337249] 0000000000000000 ffff8800c7e8bc28 ffffffff8103b015 >>> ffff8807f9281c90 >>> [197051.337338] ffffffffa0332a33 ffff8807f9281000 ffff8807f2740480 >>> ffffffffffffffff >>> [197051.337427] Call Trace: >>> [197051.337473] [] dump_stack+0x45/0x57 >>> [197051.337521] [] warn_slowpath_common+0x97/0xb1 >>> [197051.337576] [] ? >>> btrfs_delayed_qgroup_accounting+0x9f3/0xa0d [btrfs] >>> [197051.337664] [] warn_slowpath_null+0x15/0x17 >>> [197051.337717] [] >>> btrfs_delayed_qgroup_accounting+0x9f3/0xa0d [btrfs] >>> [197051.337809] [] >>> btrfs_run_delayed_refs+0x1e4/0x21b [btrfs] >>> [197051.337863] [] >>> btrfs_should_end_transaction+0x4a/0x53 [btrfs] >>> [197051.337955] [] >>> btrfs_drop_snapshot+0x379/0x68f [btrfs] >>> [197051.338009] [] ? >>> btrfs_run_defrag_inodes+0x2fa/0x30e [btrfs] >>> [197051.338101] [] ? >>> btrfs_delete_unused_bgs+0x3f/0x210 [btrfs] >>> [197051.338193] [] >>> btrfs_clean_one_deleted_snapshot+0xb4/0xc2 [btrfs] >>> [197051.338284] [] ? btrfs_free_path+0x22/0x26 >>> [btrfs] >>> [197051.338336] [] cleaner_kthread+0x134/0x16c >>> [btrfs] >>> [197051.338388] [] ? btrfs_alloc_root+0x2c/0x2c >>> [btrfs] >>> [197051.338437] [] kthread+0xcd/0xd5 >>> [197051.338484] [] ? >>> kthread_freezable_should_stop+0x43/0x43 >>> [197051.338533] [] ret_from_fork+0x7c/0xb0 >>> [197051.338580] [] ? >>> kthread_freezable_should_stop+0x43/0x43 >>> [197051.338628] ---[ end trace 5d57d07bb94831a1 ]--- >>> [197051.340365] ------------[ cut here ]------------ >>> [197051.340450] WARNING: CPU: 0 PID: 26314 at fs/btrfs/qgroup.c:1414 >>> btrfs_delayed_qgroup_accounting+0x9f3/0xa0d [btrfs]() >>> [197051.340568] Modules linked in: xt_nat xt_tcpudp ipt_MASQUERADE >>> nf_nat_masquerade_ipv4 iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 >>> nf_nat_ipv4 nf_nat nf_conntrack ip_tables x_tables tun >>> cpufreq_conservative cpufreq_powersave cpufreq_stats ipv6 btrfs xor >>> raid6_pq zlib_deflate coretemp hwmon loop pcspkr i2c_i801 i2c_core >>> battery parport_pc parport tpm_infineon tpm_tis tpm video >>> 8250_fintek lpc_ich mfd_core ehci_pci ehci_hcd button acpi_cpufreq >>> ext4 crc16 jbd2 mbcache raid1 sg sd_mod ahci libahci libata scsi_mod >>> r8169 mii >>> [197051.341053] CPU: 0 PID: 26314 Comm: kworker/u16:5 Tainted: G >>> W 3.19.0 #1 >>> [197051.341165] Hardware name: System manufacturer System Product >>> Name/P8H77-M PRO, BIOS 1101 02/04/2013 >>> [197051.341297] Workqueue: btrfs-extent-refs >>> btrfs_extent_refs_helper [btrfs] >>> [197051.341360] 0000000000000009 ffff8802c511bc18 ffffffff813bc952 >>> 0000000000000000 >>> [197051.341475] 0000000000000000 ffff8802c511bc58 ffffffff8103b015 >>> ffff8807f9281c90 >>> [197051.341590] ffffffffa0332a33 ffff8807f9281000 ffff8807f2745300 >>> ffffffffffffffff >>> [197051.341705] Call Trace: >>> [197051.341763] [] dump_stack+0x45/0x57 >>> [197051.341825] [] warn_slowpath_common+0x97/0xb1 >>> [197051.341901] [] ? >>> btrfs_delayed_qgroup_accounting+0x9f3/0xa0d [btrfs] >>> [197051.342015] [] warn_slowpath_null+0x15/0x17 >>> [197051.342089] [] >>> btrfs_delayed_qgroup_accounting+0x9f3/0xa0d [btrfs] >>> [197051.342214] [] >>> btrfs_run_delayed_refs+0x1e4/0x21b [btrfs] >>> [197051.342287] [] >>> delayed_ref_async_start+0x37/0x76 [btrfs] >>> [197051.342365] [] normal_work_helper+0xb5/0x16a >>> [btrfs] >>> [197051.342441] [] >>> btrfs_extent_refs_helper+0xd/0xf [btrfs] >>> [197051.342506] [] process_one_work+0x187/0x2a9 >>> [197051.342568] [] worker_thread+0x241/0x33e >>> [197051.342630] [] ? >>> process_scheduled_works+0x2a/0x2a >>> [197051.342694] [] kthread+0xcd/0xd5 >>> [197051.342755] [] ? >>> kthread_freezable_should_stop+0x43/0x43 >>> [197051.342819] [] ret_from_fork+0x7c/0xb0 >>> [197051.342880] [] ? >>> kthread_freezable_should_stop+0x43/0x43 >>> [197051.342944] ---[ end trace 5d57d07bb94831a2 ]--- >>> >>> >>> Tomasz Chmielewski >>> http://www.sslrack.com >>> >>> On 2015-01-04 07:58, Tomasz Chmielewski wrote: >>>> Got this with 3.18.1 and qgroups enabled. Not sure how to reproduce. >>>> >>>> >>>> [1262648.802286] ------------[ cut here ]------------ >>>> [1262648.802350] WARNING: CPU: 1 PID: 2436 at fs/btrfs/qgroup.c:1414 >>>> btrfs_delayed_qgroup_accounting+0x9f1/0xa0b [btrfs]() >>>> [1262648.802441] Modules linked in: ipt_MASQUERADE >>>> nf_nat_masquerade_ipv4 iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 >>>> nf_nat_ipv4 nf_nat nf_conntrack ip_tables x_tables cpufreq_ondemand >>>> cpufreq_conservative cpufreq_powersave cpufreq_stats nfsd auth_rpcgss >>>> oid_registry exportfs nfs_acl nfs lockd grace fscache sunrpc ipv6 >>>> btrfs xor raid6_pq zlib_deflate coretemp hwmon loop pcspkr i2c_i801 >>>> i2c_core battery parport_pc parport 8250_fintek tpm_infineon tpm_tis >>>> tpm video ehci_pci ehci_hcd lpc_ich mfd_core acpi_cpufreq button ext4 >>>> crc16 jbd2 mbcache raid1 sg sd_mod r8169 mii ahci libahci libata >>>> scsi_mod >>>> [1262648.802854] CPU: 1 PID: 2436 Comm: btrfs-cleaner Not tainted >>>> 3.18.1 #1 >>>> [1262648.802902] Hardware name: System manufacturer System Product >>>> Name/P8H77-M PRO, BIOS 1101 02/04/2013 >>>> [1262648.802992] 0000000000000009 ffff8800c805fbe8 ffffffff813b1128 >>>> 0000000000000000 >>>> [1262648.803081] 0000000000000000 ffff8800c805fc28 ffffffff81039b39 >>>> ffff8807f341c000 >>>> [1262648.803170] ffffffffa0300be2 ffff8807f341c000 ffff8807f3fd8b40 >>>> ffffffffffffffff >>>> [1262648.803259] Call Trace: >>>> [1262648.803305] [] dump_stack+0x46/0x58 >>>> [1262648.803352] [] warn_slowpath_common+0x77/0x91 >>>> [1262648.803406] [] ? >>>> btrfs_delayed_qgroup_accounting+0x9f1/0xa0b [btrfs] >>>> [1262648.803495] [] warn_slowpath_null+0x15/0x17 >>>> [1262648.803548] [] >>>> btrfs_delayed_qgroup_accounting+0x9f1/0xa0b [btrfs] >>>> [1262648.803642] [] >>>> btrfs_run_delayed_refs+0x1e4/0x21b [btrfs] >>>> [1262648.803734] [] >>>> btrfs_should_end_transaction+0x4a/0x53 [btrfs] >>>> [1262648.803826] [] >>>> btrfs_drop_snapshot+0x379/0x68f [btrfs] >>>> [1262648.803881] [] ? >>>> btrfs_run_defrag_inodes+0x2fa/0x30e [btrfs] >>>> [1262648.803974] [] >>>> btrfs_clean_one_deleted_snapshot+0xb3/0xc2 [btrfs] >>>> [1262648.804067] [] cleaner_kthread+0x134/0x16c >>>> [btrfs] >>>> [1262648.804119] [] ? >>>> btrfs_alloc_root+0x2c/0x2c [btrfs] >>>> [1262648.804169] [] kthread+0xcd/0xd5 >>>> [1262648.804215] [] ? >>>> kthread_freezable_should_stop+0x43/0x43 >>>> [1262648.804264] [] ret_from_fork+0x7c/0xb0 >>>> [1262648.804311] [] ? >>>> kthread_freezable_should_stop+0x43/0x43 >>>> [1262648.804360] ---[ end trace b76fd72b4be63515 ]--- >>> -- >>> To unsubscribe from this list: send the line "unsubscribe >>> linux-btrfs" in >>> the body of a message tomajordomo@vger.kernel.org >>> More majordomo info athttp://vger.kernel.org/majordomo-info.html >> -- >> To unsubscribe from this list: send the line "unsubscribe >> linux-btrfs" in >> the body of a message tomajordomo@vger.kernel.org >> More majordomo info athttp://vger.kernel.org/majordomo-info.html > > -- > To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html