[PATCH v2] mkdumprd: try to get mount options from fstab first

Baoquan He bhe at redhat.com
Tue Sep 16 07:06:25 UTC 2014


On 09/15/14 at 11:09am, Vivek Goyal wrote:
> On Thu, Sep 04, 2014 at 05:38:17PM +0800, Baoquan He wrote:
> > Previously if a target need mount info, the relevant mount options
> > are got from /proc/mounts by below command:
> > findmnt -k -f -n -r -o OPTIONS $_dev
> > 
> > This will bring problems. Since /proc/mounts will give out a set
> > which contains each option. Some options have value specified by
> > user, some options just have default value if user doesn't specify.
> > If some mount options are not supported very well, bugs occured.
> > The more options, the worse.
> > 
> > So in this patch, we try to check fstab to get mount options firstly,
> > this give user a chance to decide which options they really want.
> > If they don't give a fstab entry, then we trust all options in
> > /proc/mounts.
> > 
> > Signed-off-by: Baoquan He <bhe at redhat.com>
> > ---
> >  mkdumprd | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/mkdumprd b/mkdumprd
> > index 409235b..a30d9ca 100644
> > --- a/mkdumprd
> > +++ b/mkdumprd
> > @@ -104,7 +104,8 @@ to_mount() {
> >      # mount under /sysroot in 2nd kernel, and we umount -R /sysroot before exit
> >      _target="/sysroot$_target"
> >      _fstype=$(findmnt -k -f -n -r -o FSTYPE $_dev)
> > -    _options=$(findmnt -k -f -n -r -o OPTIONS $_dev)
> > +    _options=$(findmnt --fstab -f -n -r -o OPTIONS $_dev)
> > +    [ -z "$_options" ] && _options=$(findmnt -k -f -n -r -o OPTIONS $_dev)
> 
> Ok, so kernel recognizes -o defaults?
> 
> Secondly, question of x-systemd.* options still remains.

I just put the information of fstab in 1st kernel into fstab in 2nd
kernel. They should handle fstab in the same mechanism. I just tested
the -o defaults, it works. There should not be difference between 1st
kernel and 2nd kernel.

> 
> Thanks
> Vivek


More information about the kexec mailing list