From: Pratyush Anand <panand@redhat.com>
To: Josef Bacik <jbacik@fb.com>
Cc: kernel-team@fb.com, kexec@lists.infradead.org
Subject: Re: [PATCH] kexec-tools: find sysfs smarter
Date: Thu, 2 Jun 2016 09:05:04 +0530 [thread overview]
Message-ID: <20160602033504.GB30865@dhcppc6> (raw)
In-Reply-To: <1464812798-9034-1-git-send-email-jbacik@fb.com>
On 01/06/2016:04:26:38 PM, Josef Bacik wrote:
> Some systems may not have /etc/mtab, so fall back to using /proc/mounts if we
> fail to open /etc/mtab. Also if a user does
>
> mount -t sysfs none /sys
>
> we won't find the sysfs directory. We need to check mnt->mnt_type, not
> mnt->mnt_fsname.
yes, mnt_fsname is actually "device for filesystem" and mnt_type is "type of
filesystem". Therefore, checking mnt->mnt_type is appropriate.
>
> Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Pratyush Anand <panand@redhat.com>
> ---
> kexec/arch/i386/x86-linux-setup.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
> index c75adaa..c24abaa 100644
> --- a/kexec/arch/i386/x86-linux-setup.c
> +++ b/kexec/arch/i386/x86-linux-setup.c
> @@ -425,10 +425,13 @@ char *find_mnt_by_fsname(char *fsname)
> char *mntdir;
>
> mtab = setmntent("/etc/mtab", "r");
> - if (!mtab)
> - return NULL;
> + if (!mtab) {
> + mtab = setmntent("/proc/mounts", "r");
> + if (!mtab)
> + return NULL;
> + }
> for(mnt = getmntent(mtab); mnt; mnt = getmntent(mtab)) {
> - if (strcmp(mnt->mnt_fsname, fsname) == 0)
> + if (strcmp(mnt->mnt_type, fsname) == 0)
> break;
> }
> mntdir = mnt ? strdup(mnt->mnt_dir) : NULL;
> --
> 2.5.0
>
>
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
prev parent reply other threads:[~2016-06-02 3:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-01 20:26 [PATCH] kexec-tools: find sysfs smarter Josef Bacik
2016-06-02 3:35 ` Pratyush Anand [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160602033504.GB30865@dhcppc6 \
--to=panand@redhat.com \
--cc=jbacik@fb.com \
--cc=kernel-team@fb.com \
--cc=kexec@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox