Thanks for the inputs.
I will send a V2 with the suggested changes.
On Wed, Oct 10, 2018 at 9:07 AM, Kairui Song <kasong(a)redhat.com> wrote:
> Thanks for the declaration, now I understand how that happens and your
> fix looks good.
>
> Only one thing, I would suggest using findmnt to find the mount
> options and prefix local
> variable with "local", align to _dev and _mp, this make the code
> cleaner and more robust.
> eg. something like "local _op=$(findmnt -k -f -n -r -o OPTIONS $1)"
>
>
>
> On Mon, Oct 8, 2018 at 10:49 PM Kenneth Dsouza <kdsouza(a)redhat.com> wrote:
>>
>> On Mon, Oct 8, 2018 at 3:10 PM, Kairui Song <kasong(a)redhat.com> wrote:
>> > Hi Kenneth,
>> >
>>
>> > Can you provide more info like what argument do you have in your fstab
entry?
>> > What's the mount status before and after the remount? What's you
kdump config?
>> >
>> > kdump is already dropping arguments like "ro", "nofail"
which are
>> > causing problems,
>> > and remount as rw shouldn't cause such problem.
>> >
>>
>> nfs-server-ip: y.y.y.y
>> nfs-client-ip: x.x.x.x
>>
>> # kdump-config --show
>> default shell
>> nfs y.y.y.y:/home
>>
>> # findmnt --fstab /mnt
>> TARGET SOURCE FSTYPE OPTIONS
>> /mnt y.y.y.y:/home nfs rsize=3072,wsize=3072
>>
>> # findmnt /mnt
>> TARGET SOURCE FSTYPE OPTIONS
>> /mnt yy.y.y:/home nfs4
>>
rw,relatime,vers=4.1,rsize=2048,wsize=2048,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=x.x.x.x,local_lock=none,addr=192.168.122.1
>>
>> # mount -o,remount /mnt -vv
>> mount.nfs: mount(2): Invalid argument
>> mount.nfs: an incorrect mount option was specified
>>
>>
>> Issue: When the remount is invoked with only the mount point, the
>> fstab options for the dump target will be reconsidered and options
>> like rsize,wsize or nolock cannot be changed on a mounted share. As
>> the rsize and wsize values might not always be the one specified in
>> /etc/fstab but will depend on the nfs-server and nfs-client
>> negotiation.
>>
>> Refer man nfs for rsize,wsize and remount for explanation.
>>
>> Possible solutions:
>>
>> 1> Eliminate the remount to rw as the dump target will always be mounted to
rw.
>>
>> 2> Add check for read-only status for dump target and mount to rw only
>> if found ro ignoring fstab options. I have sent a patch for this but I
>> prefer solution number 3.
>>
>> 3> Change the remount line not to check fstab again as we are just
>> concerned with rw option. (mount -o remount,rw <device>
<mount-point>)
>>
>> Let me know which solution you would like me to send in a V2 or keep this patch.
>>
>>
>> > On Mon, Oct 8, 2018 at 1:46 PM Kenneth Dsouza <kdsouza(a)redhat.com>
wrote:
>> >>
>> >> From: Kenneth D'souza <kdsouza(a)redhat.com>
>> >>
>> >> Currently the script does not check if the dump target is read-only and
would
>> >> always mount to read-write mode. This caused an issue with nfs mount as
>> >> the fstab options would be reconsidered while remounting to read-write
mode.
>> >> The remount would fail with the below error as all options cannot be
changed
>> >> runtime.
>> >>
>> >> mount.nfs: an incorrect mount option was specified
>> >>
>> >> Which in result would not save the vmcore on the dump target.
>> >>
>> >> This patch addresses this issue by checking the dump target status for
read-only.
>> >> If yes, remount to read-write mode without reconsidering the fstab
options.
>> >>
>> >> Signed-off-by: Kenneth D'souza <kdsouza(a)redhat.com>
>> >> ---
>> >> kdump-lib-initramfs.sh | 8 +++++++-
>> >> 1 file changed, 7 insertions(+), 1 deletion(-)
>> >>
>> >> diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
>> >> index 2c18c87..8adcba2 100755
>> >> --- a/kdump-lib-initramfs.sh
>> >> +++ b/kdump-lib-initramfs.sh
>> >> @@ -100,7 +100,13 @@ dump_fs()
>> >>
>> >> echo "kdump: saving to
$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/"
>> >>
>> >> - mount -o remount,rw $_mp || return 1
>> >> + # Only remount to read-write mode if the dump target is mounted
read-only.
>> >> + check_status=$(grep "\srw[\s,]" /proc/mounts | grep -i
$_mp)
>> >> + if [ -z "$check_status" ]; then
>> >> + echo "kdump: Mounting Dump target $_dev in rw mode."
>> >> + mount -o remount,rw $_dev $_mp || return 1
>> >> + fi
>> >> +
>> >> mkdir -p $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR || return 1
>> >>
>> >> save_vmcore_dmesg_fs ${DMESG_COLLECTOR}
"$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/"
>> >> --
>> >> 2.14.3
>> >> _______________________________________________
>> >> kexec mailing list -- kexec(a)lists.fedoraproject.org
>> >> To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
>> >> Fedora Code of Conduct:
https://getfedora.org/code-of-conduct.html
>> >> List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
>> >> List Archives:
https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org
>> >
>> >
>> >
>> > --
>> > Best Regards,
>> > Kairui Song
>
>
>
> --
> Best Regards,
> Kairui Song