diff mbox

btrfs-ino-cache runs on every boot for 6 minutes

Message ID 20131206060419.GA20595@localhost.localdomain (mailing list archive)
State New, archived
Headers show

Commit Message

Liu Bo Dec. 6, 2013, 6:04 a.m. UTC
On Wed, Dec 04, 2013 at 01:41:42PM +0100, Sz?ts Ákos wrote:
> Thank you for your answer.
> 
> Here are the "blocked states" logs. Since I had a plenty of time, I made 
> multiple of them. The last two are the longest of them.
> 
> - http://paste.opensuse.org/view/raw/51654551
> - http://paste.opensuse.org/view/raw/39005796
> - http://paste.opensuse.org/view/raw/38028651
> - http://paste.opensuse.org/view/raw/21592065
> - http://paste.opensuse.org/view/raw/46655344
> - http://paste.opensuse.org/view/raw/26821272
> 
> Ákos

Could you please try the following and show me the output of dmesg?

thanks,
-liubo


--
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

Comments

Sz?ts Ákos Dec. 6, 2013, 12:46 p.m. UTC | #1
A következ?t írtad ekkor: 2013. december 6. 14:04:19
> Could you please try the following and show me the output of dmesg?
> 
> thanks,
> -liubo

The following happened:
- I upgraded to 3.13.0-rc2-6.ge7c00d8 (since the original 3.12 kernel with 
SUSE patches is not available anymore)
- Patched it and booted from that, compiled the NVIDIA driver
- and suddenly everything started to work fine. Now I don't have to wait 6 
minutes for the [btrfs-ino-cache] process.

One thing I noticed: before any logging would start, kernel prints out some 
(initramfs?) messages, like:
"Waiting for device /dev/disk/... to appear
[...]
fsck succeeded Mounting root read-write
Mounting root /dev/disk/...
mount -o rw,compress=lzo,space_cache,noatime,inode_cache /dev/... /root"

And logging starts from this point.

The interesting point is the initramfs mounting options: with the stock 3.12 
kernel I had only the following: rw,compress=lzo,space_cache. But now it's 
rw,compress=lzo,space_cache,noatime,inode_cache. In /etc/fstab the options are 
intact for a month now. Maybe I should have regenerated the initrd when I 
added the fstab mount options noatime and inode_cache?

I searched for your extra kernel messages in dmesg, but I didn't find them, 
although here is the dmesg output: http://paste.opensuse.org/30797527

Thank you,

Ákos
--
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
Liu Bo Dec. 6, 2013, 1:30 p.m. UTC | #2
On Fri, Dec 06, 2013 at 01:46:10PM +0100, Sz?ts Ákos wrote:
> A következ?t írtad ekkor: 2013. december 6. 14:04:19
> > Could you please try the following and show me the output of dmesg?
> > 
> > thanks,
> > -liubo
> 
> The following happened:
> - I upgraded to 3.13.0-rc2-6.ge7c00d8 (since the original 3.12 kernel with 
> SUSE patches is not available anymore)
> - Patched it and booted from that, compiled the NVIDIA driver
> - and suddenly everything started to work fine. Now I don't have to wait 6 
> minutes for the [btrfs-ino-cache] process.
> 
> One thing I noticed: before any logging would start, kernel prints out some 
> (initramfs?) messages, like:
> "Waiting for device /dev/disk/... to appear
> [...]
> fsck succeeded Mounting root read-write
> Mounting root /dev/disk/...
> mount -o rw,compress=lzo,space_cache,noatime,inode_cache /dev/... /root"
> 
> And logging starts from this point.
> 
> The interesting point is the initramfs mounting options: with the stock 3.12 
> kernel I had only the following: rw,compress=lzo,space_cache. But now it's 
> rw,compress=lzo,space_cache,noatime,inode_cache. In /etc/fstab the options are 
> intact for a month now. Maybe I should have regenerated the initrd when I 
> added the fstab mount options noatime and inode_cache?
> 
> I searched for your extra kernel messages in dmesg, but I didn't find them, 
> although here is the dmesg output: http://paste.opensuse.org/30797527

It seems that we should owe credit to the updated 3.13 kernel, could you
please try again 3.13 kernel without the patch?

thanks,
-liubo
--
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
Sz?ts Ákos Dec. 7, 2013, 2:48 p.m. UTC | #3
Liu Bo a következ?t írta ekkor: 2013. december 6. 21:30:34
> It seems that we should owe credit to the updated 3.13 kernel, could you
> please try again 3.13 kernel without the patch?
> 
> thanks,
> -liubo

I forcibly reinstalled the 3.13 kernel from the repository, booted from it 
twice and yes, it really seems that this bug is fixed now.

Thank you for your time.

Ákos
--
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
diff mbox

Patch

diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 057be95..8f7711e 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -2950,11 +2950,16 @@  int load_free_ino_cache(struct btrfs_fs_info *fs_info, struct btrfs_root *root)
 		return 0;
 
 	inode = lookup_free_ino_inode(root, path);
-	if (IS_ERR(inode))
+	if (IS_ERR(inode)) {
+		printk("%s: ino cache ino is NOT found\n", __func__);
 		goto out;
+	}
 
-	if (root_gen != BTRFS_I(inode)->generation)
+	if (root_gen != BTRFS_I(inode)->generation) {
+		printk("%s: gen mismatch: root_gen_mem=%llu, root_gen=%llu, ino's gen=%llu\n",
+			__func__, btrfs_root_generation(&root->root_item), root_gen, BTRFS_I(inode)->generation);
 		goto out_put;
+	}
 
 	ret = __load_free_space_cache(root, inode, ctl, path, 0);
 
diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c
index ab485e5..6535139 100644
--- a/fs/btrfs/inode-map.c
+++ b/fs/btrfs/inode-map.c
@@ -473,7 +473,12 @@  again:
 	}
 
 	spin_lock(&root->cache_lock);
-	if (root->cached != BTRFS_CACHE_FINISHED) {
+
+	/* ino cache has 3 state:
+	 * BTRFS_CACHE_NO, BTRFS_CACHE_START, BTRFS_CACHE_FINISHED
+	 */
+	if (root->cached != BTRFS_CACHE_NO && root->cached != BTRFS_CACHE_FINISHED) {
+		printk("%s: bail out because it's not FINISHED, cached=%d\n", __func__, root->cached);
 		ret = -1;
 		spin_unlock(&root->cache_lock);
 		goto out_put;