We were negating the error code sent to complain, which is wrong. The
documentation of mnt_context_do_umount() states that errors returned
from the umount() syscall will be returned >0, so we shouldn't be
doing a switch on the negated value. This fixes the following
non-helpful output:

Before:
    sudo sbin/mount/umount.nilfs2 /mnt/nilfs
    umount.nilfs2: /dev/loop0: Unknown error -16

After:
    $ sudo sbin/mount/umount.nilfs2 /mnt/nilfs
    umount.nilfs2: /dev/loop0: device is busy

Signed-off-by: Dan McGee <[email protected]>
---

The complain() function was copied from the original umount code; I removed the
comment as it doesn't make much sense in the context of using libmount and not
parsing fstab directly.

 sbin/mount/umount_libmount.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/sbin/mount/umount_libmount.c b/sbin/mount/umount_libmount.c
index 939c6b0..2c983b3 100644
--- a/sbin/mount/umount_libmount.c
+++ b/sbin/mount/umount_libmount.c
@@ -183,8 +183,6 @@ static void complain(int err, const char *dev)
                error(_("%s: %s: I/O error while unmounting"), progname, dev);
                break;
        case EBUSY:
-               /* Let us hope fstab has a line "proc /proc ..."
-                  and not "none /proc ..."*/
                error(_("%s: %s: device is busy"), progname, dev);
                break;
        case ENOENT:
@@ -284,7 +282,7 @@ static int nilfs_umount_one(struct nilfs_umount_info *umi)
        if (!mnt_context_is_fake(umi->cxt)) {
                res = nilfs_do_umount_one(umi);
                if (res) {
-                       complain(-res, mnt_context_get_source(umi->cxt));
+                       complain(res, mnt_context_get_source(umi->cxt));
                        goto failed;
                }
        }
-- 
1.7.8

--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to