linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Yecheng Fu <cofyc.jackson@gmail.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, Karel Zak <kzak@redhat.com>
Subject: Re: [PATCH] vfs: use "none" if mount source is empty string
Date: Wed, 18 Apr 2018 08:28:50 -0700	[thread overview]
Message-ID: <20180418152850.GE27475@bombadil.infradead.org> (raw)
In-Reply-To: <1524064686-65246-1-git-send-email-cofyc.jackson@gmail.com>

On Wed, Apr 18, 2018 at 11:18:06PM +0800, Yecheng Fu wrote:
> `libmount` from util-linux and many softwares in userspace (e.g.
> kubelet) did not expect empty string as mount source:
> 
> ```
> $ mount -t tmpfs "" /mnt/tmpfs
> $ findmnt /mnt/tmpfs
> findmnt: /proc/self/mountinfo: parse error at line 51
> $ cat /proc/self/mountinfo | grep -P '\/mnt\/tmpfs'
> 74 25 0:59 / /mnt/tmpfs rw,relatime shared:38 - tmpfs  rw
> $ cat /proc/self/mounts | grep -P '\/mnt\/tmpfs'
>  /mnt/tmpfs tmpfs rw,relatime 0 0
> ```
> 
> `source` field in mounts/mountinfo is empty, which breaks a lot of
> mounts/mountinfo parsers when user use empty string as mount source.
> 
> This fixes issues in parsing when user use empty string as mount
> source.
> 
> Cc: Karel Zak <kzak@redhat.com>
> Signed-off-by: Yecheng Fu <cofyc.jackson@gmail.com>

What about show_vfsstat()?  Doesn't it need:

+++ b/fs/proc_namespace.c
@@ -205,7 +205,7 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
                if (err)
                        goto out;
        } else {
-               if (r->mnt_devname) {
+               if (r->mnt_devname && r->mnt_devname[0] != '\0') {
                        seq_puts(m, "device ");
                        mangle(m, r->mnt_devname);
                } else

      reply	other threads:[~2018-04-18 15:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-18 15:18 [PATCH] vfs: use "none" if mount source is empty string Yecheng Fu
2018-04-18 15:28 ` Matthew Wilcox [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=20180418152850.GE27475@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=cofyc.jackson@gmail.com \
    --cc=kzak@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).