On Thu, Sep 04, 2014 at 04:59:29PM +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(a)redhat.com>
---
mkdumprd | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/mkdumprd b/mkdumprd
index 409235b..e9246f2 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -104,7 +104,12 @@ 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)
+ if [ -z "$_options" ]; then
+ _options=$(findmnt -k -f -n -r -o OPTIONS $_dev)
+ elif [ "$_options" = "defaults" ]; then
+ _options=""
+ fi
Bao, why do we set options to null in case of "defaults"?
man page says following.
defaults
use default options: rw, suid, dev, exec, auto, nouser,
and async.
So who comes up with defult values of these paratmers?
Secondly, what happens to parameters like.
x-systemd.device-timeout=0
I think kernel does not uderstand these options. Will we not get errors
during mounting if we don't filter out these options?
Thanks
Vivek