From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bombadil.infradead.org ([198.137.202.133]:39732 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752306AbeDRP2v (ORCPT ); Wed, 18 Apr 2018 11:28:51 -0400 Date: Wed, 18 Apr 2018 08:28:50 -0700 From: Matthew Wilcox To: Yecheng Fu Cc: Alexander Viro , linux-fsdevel@vger.kernel.org, Karel Zak Subject: Re: [PATCH] vfs: use "none" if mount source is empty string Message-ID: <20180418152850.GE27475@bombadil.infradead.org> References: <1524064686-65246-1-git-send-email-cofyc.jackson@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1524064686-65246-1-git-send-email-cofyc.jackson@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 > Signed-off-by: Yecheng Fu 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