Bug 1003207

Summary: Dracut needs support for bcache
Product: [Fedora] Fedora Reporter: Rolf Fokkens <rolf>
Component: dracutAssignee: dracut-maint
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dracut-maint, g2p.code+rhbugs, harald, ignatenko, jonathan
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dracut-033-1.fc21 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-12 13:15:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 998543, 999690, 1008227, 1008228    
Attachments:
Description Flags
Initial attempt to build a bcache module for dracut none

Description Rolf Fokkens 2013-08-31 20:19:59 UTC
Description of problem:

Bug 998543 is related to a change wich implements SSD caching. As such Bug 998543 is a SelfContained change for F20, but for F21 the Change is intended toe be SystemWide. This implies among others dracut support for bcache.

This Bug is a starting point for the steps to be taken.

Comment 1 Rolf Fokkens 2013-09-01 09:41:46 UTC
Started discussion on devel@:
https://lists.fedoraproject.org/pipermail/devel/2013-September/188625.html

Comment 2 Igor Gnatenko 2013-09-01 10:04:38 UTC
We have initramfs hook at bcache-tools, but I don't know how we should use it.

Comment 3 Igor Gnatenko 2013-09-01 11:05:17 UTC
http://bcache.evilpiepirate.org/#index6h1
ok. our steps I think:
we should port initramfs hook to dracut module (https://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html#_developer_manual)
Rolf, can you do this ?

Comment 4 Rolf Fokkens 2013-09-01 14:53:01 UTC
Created attachment 792597 [details]
Initial attempt to build a bcache module for dracut

I throw the bcache initramfs/hook and 90mdraid/module-setup.sh in the blender, and the result is my first attempt for a dracut module.

It tested it and it does work, so that's OK. I even disabled the bcache udev rule on my root FS, which provided prof that the initramfs worked because /dev/bcache* devices were there.

What worries me is the fact that 90mdraid/module-setup.sh has more checks that I left out because I don't understand them.

I'm also wondering if this should be part of dracut, or part of bcache-tools.

Comment 5 Harald Hoyer 2013-09-02 08:39:06 UTC
Well, dracut-032 already contains a bcache module:

http://git.kernel.org/cgit/boot/dracut/dracut.git/tree/modules.d/90bcache/module-setup.sh

$ rpm -qf /usr/lib/dracut/modules.d/90bcache/
dracut-032-11.git20130822

$ cat /usr/lib/dracut/modules.d/90bcache/module-setup.sh 
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

check() {
    type -P probe-bcache >/dev/null || return 1

    [[ $hostonly ]] || [[ $mount_needs ]] && {
        for fs in "${host_fs_types[@]}"; do
            [[ $fs = "bcache" ]] && return 0
        done
        return 255
    }

    return 0
}

depends() {
    return 0
}

installkernel() {
    instmods bcache
}

install() {
    inst_multiple probe-bcache ${udevdir}/bcache-register
    inst_rules 61-bcache.rules
}



What else do you need?

Comment 6 Rolf Fokkens 2013-09-02 09:32:14 UTC
Thanks, looks like that takes care of it.

Looking forward: blkid (util-linux) may obsolete probe-bcache, see bug 1001120. 

I'll leave this bug open to address it when util-linux is updated, OK?

Comment 7 Rolf Fokkens 2013-09-05 06:44:33 UTC
For F20 probe-bcache will be obsoleted indeed by util-linux:

https://bugzilla.redhat.com/show_bug.cgi?id=1001120#c13

Comment 8 Nimimo 2013-09-05 10:35:38 UTC
Removing probe-bcache will be a Fedora-specific change until
upstream can assume everyone has the next util-linux release.
If you go ahead with it, I'd recommend patching the Dracut
module in preference to an upstream change.

Comment 9 Rolf Fokkens 2013-09-09 08:35:06 UTC
Did some testing in an f20 image, the bcache module in dracut works fine.

Comment 10 Harald Hoyer 2013-09-12 13:14:45 UTC
dracut-033-1.fc21

Comment 11 Rolf Fokkens 2013-09-14 11:21:34 UTC
This is not really a bug (yet), but for the record:

Testing demonstrated the following:

${host_fs_types[@]} appears to rely on blkid. With the current util-linux there's no bcache reported in host_fs_types, so dracut only creates a working initramfs with the -N option. When using the new util-linux (2.24) blkid reports bcache, and then dracut creates a working initramfs without the -N option.

In the end for F20 this won't be an issue, but if (only __if__) bcache is backported to F19 (or older?) this may lead to confusion for users. This also depends on dracut and util-linux being backported.

Comment 12 Harald Hoyer 2013-09-14 11:27:54 UTC
(In reply to Rolf Fokkens from comment #11)
> This is not really a bug (yet), but for the record:
> 
> Testing demonstrated the following:
> 
> ${host_fs_types[@]} appears to rely on blkid. With the current util-linux
> there's no bcache reported in host_fs_types, so dracut only creates a
> working initramfs with the -N option. When using the new util-linux (2.24)
> blkid reports bcache, and then dracut creates a working initramfs without
> the -N option.
> 
> In the end for F20 this won't be an issue, but if (only __if__) bcache is
> backported to F19 (or older?) this may lead to confusion for users. This
> also depends on dracut and util-linux being backported.

yes, true