[Patch v3 3/3] kdump fails loading if target is root fs by default while disk is mounted on save path

Jerry Hoemann jerry.hoemann at hp.com
Thu Mar 6 07:12:34 UTC 2014


On Thu, Mar 06, 2014 at 09:55:03AM +0800, Baoquan He wrote:
> > -- 
> > 
> > Baoquan,
> > 
> > Thanks for making this change.  I have hit this problem and this
> > modification will make things better.
> > 
> > This got me thinking about the issue, and I have an idea
> > for a next step and wanted your feedback.
> > 
> > Right now, fedora requires the pair { <partition>,  <path> }
> > where path is relative to the root of the partition.
> > 
> > I find this a little confusing especially when using the gui
> > system-config-kdump.
> > 
> > As an alternative, could we instead of having the customer visible
> > entities that need to be configured as the above pair,  could we
> > just have them specify the mounted path and walk up the path
> > to find the partition?
> > 
> > So, if they say "/home/user/crash"  we first look if "/home/user/crash"
> > is a mounted partition, if it is, this is the partition for crash
> > and our relative path is ".".
> > 
> > If crash isn't a mounted partition we check "/home/user" and if it is our
> > partition is that and the relative path is "./crash".  And so on until
> > we get to "/".
> > 
> > 
> > As a proof of concept, I wrote a script to decompose a "path" into
> > the deepest mounted partition and relative offset, but wanted to get
> > your and Vivek's views before i continued down this road.
> 
> Hi Jerry,
> 
> Thanks for your great idea. I remember we thought about this during
> cleaning the concept of "default target", "default action" and "default
> default action". But we didn't go that deep as you thought of. 
> 
> Actually what you mentioned is just like a kernel intelnal function
> path_lookup(), right?  Each time when I go through this function, a
> shiver ran down my body. It's too complicated. As for kdump script, the
> path and partition concept has embedded into user's heart, and in a shell
> script this solution may mess up the code, it's not good to maintain and
> read.


Yes, similar idea, but is actually straight forward to get
the mount point.   It was seeing your use of findmnt that gave
me the idea.

When the path isn't a mount point, it returns error.  So we
just add a loop using "dirname" to strip off the lowest level
of th path like following prototype:


# find mount point of lowest level partition in path
function get_mountpoint()
{
    local _dumppath=${1:-"/var/crash"}
    local _mntpoint
    local _source
    local count=0

    _mountpoint=$_dumppath
    _source=$(findmnt -k -f -n -o SOURCE $_mountpoint)

    while [[ ! -b "$_source" && $count -lt 50 ]] ; do
        let count=$count+1
        _mountpoint=`dirname "$_mountpoint"`
        _source=$(findmnt -k -f -n -o SOURCE $_mountpoint)
    done
    if [ -b "$_source" ] ; then
        echo "$_mountpoint"
    fi
}

There is of course more that would be needed.
Getting FS type and UUID for the partition, and stripping
the mountpoint off the full path to get the relative path.
But the above is the key function.



> 
> This is just my personal opinion. I also want to see how other people
> think of this.
> 
> Baoquan
> Thanks
> 
> 
> > 
> > thanks
> > 
> > Jerry
> > 
> > 
> > 
> > ----------------------------------------------------------------------------
> > Jerry Hoemann            Software Engineer              Hewlett-Packard
> > 
> > 3404 E Harmony Rd. MS 57                        phone:  (970) 898-1022
> > Ft. Collins, CO 80528                           FAX:    (970) 898-XXXX
> >                                                 email:  jerry.hoemann at hp.com
> > ----------------------------------------------------------------------------
> > 
> > _______________________________________________
> > kexec mailing list
> > kexec at lists.fedoraproject.org
> > https://lists.fedoraproject.org/mailman/listinfo/kexec

-- 

----------------------------------------------------------------------------
Jerry Hoemann            Software Engineer              Hewlett-Packard

3404 E Harmony Rd. MS 57                        phone:  (970) 898-1022
Ft. Collins, CO 80528                           FAX:    (970) 898-XXXX
                                                email:  jerry.hoemann at hp.com
----------------------------------------------------------------------------



More information about the kexec mailing list