diff options
author | Karel Zak | 2013-04-23 10:25:02 +0200 |
---|---|---|
committer | Karel Zak | 2013-04-23 10:25:02 +0200 |
commit | f697d61b6efbcca777221de7f391307712cfba4e (patch) | |
tree | b3ad8016c91af5baf09cd1c4131b58ddb3438610 /sys-utils | |
parent | libfdisk: (gpt) fix EFI UUID usage (diff) | |
download | kernel-qcow2-util-linux-f697d61b6efbcca777221de7f391307712cfba4e.tar.gz kernel-qcow2-util-linux-f697d61b6efbcca777221de7f391307712cfba4e.tar.xz kernel-qcow2-util-linux-f697d61b6efbcca777221de7f391307712cfba4e.zip |
umount: use devno to identify --all-target devices
# mount -t tmpfs tmp /mnt/A
# mount --bind /mnt/A /mnt/B
# mount -t tmpfs tmp /mnt/C
the command:
umount --all-targets /mnt/A
has to umount only A and B, but not C. The C is a another filesystem.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils')
-rw-r--r-- | sys-utils/umount.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys-utils/umount.c b/sys-utils/umount.c index e88320d65..17764b534 100644 --- a/sys-utils/umount.c +++ b/sys-utils/umount.c @@ -406,7 +406,7 @@ static int umount_alltargets(struct libmnt_context *cxt, const char *spec, int r struct libmnt_fs *fs; struct libmnt_table *tb; struct libmnt_iter *itr = NULL; - char *src = NULL; + dev_t devno = 0; int rc; /* Convert @spec to device name, Use the same logic like regular @@ -423,7 +423,7 @@ static int umount_alltargets(struct libmnt_context *cxt, const char *spec, int r if (rc < 0) return mk_exit_code(cxt, rc); /* error */ - if (!mnt_fs_get_srcpath(fs)) + if (!mnt_fs_get_srcpath(fs) || !mnt_fs_get_devno(fs)) err(MOUNT_EX_USAGE, _("%s: failed to determine source"), spec); itr = mnt_new_iter(MNT_ITER_BACKWARD); @@ -437,13 +437,13 @@ static int umount_alltargets(struct libmnt_context *cxt, const char *spec, int r /* Note that @fs is from mount context and the context will be reseted * after each umount() call */ - src = xstrdup(mnt_fs_get_srcpath(fs)); + devno = mnt_fs_get_devno(fs); fs = NULL; mnt_reset_context(cxt); while (mnt_table_next_fs(tb, itr, &fs) == 0) { - if (!mnt_fs_streq_srcpath(fs, src)) + if (mnt_fs_get_devno(fs) != devno) continue; mnt_context_disable_swapmatch(cxt, 1); if (rec) @@ -457,7 +457,6 @@ static int umount_alltargets(struct libmnt_context *cxt, const char *spec, int r mnt_free_iter(itr); mnt_free_table(tb); - free(src); return rc; } |