]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libmount: fix mnt_table_is_fs_mounted() for NFS bind mounts.
authorNeilBrown <neilb@suse.com>
Wed, 18 Apr 2018 03:31:38 +0000 (13:31 +1000)
committerKarel Zak <kzak@redhat.com>
Wed, 18 Apr 2018 08:17:26 +0000 (10:17 +0200)
commit7966cbba53890e1010861b75bd9923e793bbc975
tree4aedad970bf15d00a0b46d265cd13769579d42c8
parentf958101d2ea55174f8cd584efe41d4cefa9578c6
libmount: fix mnt_table_is_fs_mounted() for NFS bind mounts.

When you bind-mount a subdirectory of a local filesystem, the
path to that subdirectory appears as the fourth field in mountinfo.

For nfs mounts, the fourth field is always "/", and the subdirectory
part is appended to the "special" (aka "device") field.  This is
consistent with historical NFS usage which always includes a path in
the fs_spec field.

libmount needs to know about this when "mount -a" checks to see if
a filesystem is already mounted.

Without this fix, fstab lines like:

 server::/path /dir nfs defaults 0 0
 /dir/subdir /mnt/test none bind 0 0

result in a new mount at /mnt/test every time "mount -a" is run.

[kzak@redhat.com: - use strappend() rather than asprintf()]

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/tab.c