From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw0-f195.google.com ([209.85.161.195]:33585 "EHLO mail-yw0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750737AbdE0U37 (ORCPT ); Sat, 27 May 2017 16:29:59 -0400 Received: by mail-yw0-f195.google.com with SMTP id y64so2519265ywe.0 for ; Sat, 27 May 2017 13:29:59 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Ivan P Date: Sat, 27 May 2017 22:29:38 +0200 Message-ID: Subject: Re: btrfs-tools/linux 4.11: btrfs-cleaner misbehaving To: Hans van Kranenburg Cc: linux-btrfs@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-btrfs-owner@vger.kernel.org List-ID: On Sat, May 27, 2017 at 9:33 PM, Hans van Kranenburg wrote: > Hi, > > On 05/27/2017 08:53 PM, Ivan P wrote: >> >> for a while now, btrfs-cleaner has been molesting my system's btrfs partition, >> as well as my CPU. The behavior is as following: >> >> After booting, nothing relevant is happening. After about 5-30 minutes, >> a btrfs-cleaner process is spawned, which is constantly using one CPU core. >> The btrfs-cleaner process never seems to finish (I've let it waste CPU cycles >> for 9 hours) and also cannot be stopped or killed. >> >> Rebooting again usually resolves the issue for some time. >> But on next boot, the issue usually reappears. >> >> I'm running linux 4.11.2, but the issue is also present on current LTS 4.9.29. >> I am using newest btrfs-tools, as far as I can tell (4.11). The system is an >> arch linux x64 installed on a Transcend 120GB mSATA drive. >> >> No other disks are present, but the root volume contains several subvolumes >> (@arch snapshots, @home, @data). >> >> The logs don't contain anything related to btrfs, beside the usual diag output >> on mounting the root partition. >> >> I am mounting the btrfs partition with the following options: >> >> subvol=@arch_current,compress=lzo,ssd,noatime,autodefrag >> >> What information should I provide so we could debug this? > > What I usually do first in a similar situation is look at the output of > > watch cat /proc//stack > > where is the pid of the btrfs-cleaner thread. > > This might already give an idea what kind of things it's doing, by > looking at the stack trace. When it's cleaning up a removed subvolume > for example, there will be a similar function name in the stack somewhere. > > -- > Hans van Kranenburg Thank you for the fast reply. Most of the time, the stack is just 0xffffffffffffffff, even though CPU load is generated. These repeat all the time, but addresses stay the same: [] get_alloc_profile+0xa9/0x1a0 [btrfs] [] can_overcommit+0xc2/0x110 [btrfs] [] btrfs_free_reserved_data_space_noquota+0x6e/0x100 [btrfs] [] 0xffffffffffffffff [] block_rsv_release_bytes+0x8e/0x2b0 [btrfs] [] btrfs_free_reserved_data_space_noquota+0x6e/0x100 [btrfs] [] 0xffffffffffffffff [] block_rsv_release_bytes+0x8e/0x2b0 [btrfs] [] 0xffffffffffffffff [] retint_kernel+0x1b/0x1d [] 0xffffffffffffffff So far, these appeared only once or twice: [] retint_kernel+0x1b/0x1d [] __radix_tree_lookup+0x76/0xf0 [] radix_tree_lookup+0xd/0x10 [] __do_page_cache_readahead+0x10f/0x2f0 [] ondemand_readahead+0x193/0x2c0 [] page_cache_sync_readahead+0x2e/0x50 [] btrfs_defrag_file+0x9fb/0xf90 [btrfs] [] btrfs_run_defrag_inodes+0x25a/0x350 [btrfs] [] cleaner_kthread+0x147/0x180 [btrfs] [] kthread+0x108/0x140 [] ret_from_fork+0x2c/0x40 [] 0xffffffffffffffff [] ___preempt_schedule+0x16/0x18 [] __clear_extent_bit+0x2a6/0x3e0 [btrfs] [] clear_extent_bit+0x17/0x20 [btrfs] [] btrfs_defrag_file+0xd4a/0xf90 [btrfs] [] btrfs_run_defrag_inodes+0x25a/0x350 [btrfs] [] cleaner_kthread+0x147/0x180 [btrfs] [] kthread+0x108/0x140 [] ret_from_fork+0x2c/0x40 [] 0xffffffffffffffff [] retint_kernel+0x1b/0x1d [] __rcu_read_unlock+0x4a/0x60 [] __set_page_dirty_nobuffers+0xdb/0x170 [] btrfs_set_page_dirty+0xe/0x10 [btrfs] [] set_page_dirty+0x5b/0xb0 [] btrfs_defrag_file+0xd9e/0xf90 [btrfs] [] btrfs_run_defrag_inodes+0x25a/0x350 [btrfs] [] cleaner_kthread+0x147/0x180 [btrfs] [] kthread+0x108/0x140 [] ret_from_fork+0x2c/0x40 [] 0xffffffffffffffff Forgot to mention that I have tried running a scrub, but it neither reported any errors nor solved the issue. Regards, Ivan