linux-nilfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan McGee <dan-fd97jBR+K/6hPH1hqNUYSQ@public.gmane.org>
To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 2/7] umount.nilfs2 (libmount): send proper error code to complain function
Date: Wed, 21 Dec 2011 15:34:04 -0600	[thread overview]
Message-ID: <1324503249-17432-3-git-send-email-dan@archlinux.org> (raw)
In-Reply-To: <1324503249-17432-1-git-send-email-dan-fd97jBR+K/6hPH1hqNUYSQ@public.gmane.org>

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 <dan-fd97jBR+K/6hPH1hqNUYSQ@public.gmane.org>
---

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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2011-12-21 21:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-21 21:34 [PATCH 0/7] A handful of small cleanups and improvements Dan McGee
     [not found] ` <1324503249-17432-1-git-send-email-dan-fd97jBR+K/6hPH1hqNUYSQ@public.gmane.org>
2011-12-21 21:34   ` [PATCH 1/7] Add .gitignore rules for generated binaries Dan McGee
2011-12-21 21:34   ` Dan McGee [this message]
2011-12-21 21:34   ` [PATCH 3/7] Remove kern_compat.h Dan McGee
     [not found]     ` <1324503249-17432-4-git-send-email-dan-fd97jBR+K/6hPH1hqNUYSQ@public.gmane.org>
2011-12-23  5:25       ` Ryusuke Konishi
2011-12-21 21:34   ` [PATCH 4/7] Alpha sort AC_CHECK_FUNCS list in configure.ac Dan McGee
2011-12-21 21:34   ` [PATCH 5/7] Use strtoull instead of strtoul where applicable Dan McGee
2011-12-21 21:34   ` [PATCH 6/7] rmcp/chcp: sanity check for positive checkpoint number Dan McGee
2011-12-21 21:34   ` [PATCH 7/7] rmcp: print sensible error message on permission failure Dan McGee
     [not found]     ` <1324503249-17432-8-git-send-email-dan-fd97jBR+K/6hPH1hqNUYSQ@public.gmane.org>
2011-12-23  5:56       ` Ryusuke Konishi
     [not found]         ` <20111223.145629.123971064.ryusuke-sG5X7nlA6pw@public.gmane.org>
2011-12-23 15:00           ` Dan McGee
     [not found]             ` <CAEik5nNHs1Lp-Wz_p9k_Xt1-CBu4L=Agsf28vVC7iBp4mSsuwA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-12-24  7:20               ` Ryusuke Konishi
     [not found]                 ` <20111224.162041.267403683.ryusuke-sG5X7nlA6pw@public.gmane.org>
2012-01-03 19:46                   ` [PATCH] " Dan McGee
     [not found]                     ` <1325619960-9715-1-git-send-email-dan-fd97jBR+K/6hPH1hqNUYSQ@public.gmane.org>
2012-01-05  5:14                       ` Ryusuke Konishi
2011-12-22 16:35   ` [PATCH 0/7] A handful of small cleanups and improvements Ryusuke Konishi
     [not found]     ` <20111223.013541.163265429.ryusuke-sG5X7nlA6pw@public.gmane.org>
2011-12-23  6:40       ` Ryusuke Konishi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1324503249-17432-3-git-send-email-dan@archlinux.org \
    --to=dan-fd97jbr+k/6hph1hqnuysq@public.gmane.org \
    --cc=linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).