]> 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:18:47 +0000 (10:18 +0200)
commit84667cace55b3422f7763d3d8e0f41286dfe309f
tree0ad87ec7cc162ac08e676fdb6955d907c71f0347
parentd00a3e2e4cbb3ee47e23ab584c39d50feaa32223
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