[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#21372: [PATCH] df: fix prioritize real mounts over bind mounts
From: |
Pádraig Brady |
Subject: |
bug#21372: [PATCH] df: fix prioritize real mounts over bind mounts |
Date: |
Fri, 11 Sep 2015 21:42:20 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
On 31/08/15 22:05, Dave Chiluk wrote:
> Fixes an issue where bind mounts with shorter mount directories than the
> original mount are prioritized when running df. The root cause of this
> is that /proc/self/mountinfo now lists the filesystem device with bind
> mounts rather than the source directory. With /etc/mtab the source
> device was listed as the originating directory so this was not an issue.
>
> More information is available here.
> https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/1432871
> ---
> src/df.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/src/df.c b/src/df.c
> index 2e541b9..00c77c1 100644
> --- a/src/df.c
> +++ b/src/df.c
> @@ -652,9 +652,14 @@ filter_mount_list (bool devices_only)
> else if ((strchr (me->me_devname, '/')
> /* let "real" devices with '/' in the name win. */
> && ! strchr (devlist->me->me_devname, '/'))
> - /* let a shorter mountdir win. */
> - || (strlen (devlist->me->me_mountdir)
> + /* let a shorter mountdir win. */
> + /* Only if it's not a bind mount. */
> + || ((strlen (devlist->me->me_mountdir)
> > strlen (me->me_mountdir))
> + && (devlist->me->me_mntroot != NULL
> + && me->me_mntroot != NULL
> + && (strlen (devlist->me->me_mntroot)
> + > strlen(me->me_mntroot))))
As previously mentioned, should this be >= ?
We'll need to look at tests.
This will be quite tricky given the current
avoidance of /proc/self/mountinfo in tests.
I'll look at adding a separate test for this.
thanks,
Pádraig.
- bug#21372: [PATCH] df: fix prioritize real mounts over bind mounts,
Pádraig Brady <=
- bug#21372: [PATCH] df: fix prioritize real mounts over bind mounts, Dave Chiluk, 2015/09/11
- bug#21372: [PATCH] df: fix prioritize real mounts over bind mounts, Pádraig Brady, 2015/09/11
- bug#21372: [PATCH v4] df: fix prioritize real mounts over bind mounts, Dave Chiluk, 2015/09/21
- bug#21372: [PATCH v4] df: fix prioritize real mounts over bind mounts, Pádraig Brady, 2015/09/21
- bug#21372: [PATCH v4] df: fix prioritize real mounts over bind mounts, Pádraig Brady, 2015/09/21
- bug#21372: [PATCH v4] df: fix prioritize real mounts over bind mounts, Dave Chiluk, 2015/09/22
- bug#21372: [PATCH v4] df: fix prioritize real mounts over bind mounts, Dave Chiluk, 2015/09/22
- bug#21372: [PATCH v4] df: fix prioritize real mounts over bind mounts, Pádraig Brady, 2015/09/22