All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@redhat.com>
To: Karel Zak <kzak@redhat.com>
Cc: Chuck Lever <chuck.lever@oracle.com>, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 2/2] mount: add --enable-libmount-mount
Date: Thu, 03 Mar 2011 14:53:06 -0500	[thread overview]
Message-ID: <4D6FF1A2.8060205@RedHat.com> (raw)
In-Reply-To: <1299159822-25190-3-git-send-email-kzak@redhat.com>



On 03/03/2011 08:43 AM, Karel Zak wrote:

> +static int umount_main(struct libmnt_context *cxt, int argc, char **argv)
> +{
> +	int rc, c;
> +	char *spec = NULL, *opts = NULL;
> +
> +	static const struct option longopts[] = {
> +		{ "force", 0, 0, 'f' },
> +		{ "help", 0, 0, 'h' },
> +		{ "no-mtab", 0, 0, 'n' },
> +		{ "verbose", 0, 0, 'v' },
> +		{ "read-only", 0, 0, 'r' },
> +		{ "lazy", 0, 0, 'l' },
> +		{ "types", 1, 0, 't' },
> +		{ NULL, 0, 0, 0 }
> +	};
> +
> +	mnt_context_init_helper(cxt, MNT_ACT_UMOUNT, 0);
> +
> +	while ((c = getopt_long (argc, argv, "fvnrlh", longopts, NULL)) != -1) {
> +
> +		rc = mnt_context_helper_setopt(cxt, c, optarg);
> +		if (rc == 0)		/* valid option */
> +			continue;
> +		if (rc < 0)		/* error (probably ENOMEM) */
> +			goto err;
> +					/* rc==1 means unknow option */
> +		umount_usage();
> +		return EX_USAGE;
> +	}
> +
> +	if (optind < argc)
> +		spec = argv[optind++];
> +
> +	if (!spec || (*spec != '/' && strchr(spec,':') == NULL)) {
> +		nfs_error(_("%s: no mount point provided"), progname);
> +		return EX_USAGE;
> +	}
> +
> +	if (mnt_context_set_target(cxt, spec))
> +		goto err;
> +	if (mnt_context_set_fstype_pattern(cxt, "nfs,nfs4"))	/* restrict filesystems */
> +		goto err;
> +
> +	/* read mtab/fstab, evaluate permissions, etc. */
> +	rc = mnt_context_prepare_umount(cxt);
> +	if (rc) {
> +		nfs_error(_("%s: failed to prepare umount: %s\n"),
> +					progname, strerror(-rc));
> +		goto err;
> +	}
> +
> +	opts = retrieve_mount_options(mnt_context_get_fs(cxt));
> +
> +	if (!mnt_context_is_lazy(cxt)) {
> +		if (opts) {
> +			/* we have full FS description (e.g. from mtab or /proc) */
> +			switch (is_vers4(cxt)) {
> +			case 0:
> +				/* We ignore the error from nfs_umount23.
> +				 * If the actual umount succeeds (in del_mtab),
> +				 * we don't want to signal an error, as that
> +				 * could cause /sbin/mount to retry!
> +				 */
> +				nfs_umount23(mnt_context_get_source(cxt), opts);
> +				break;
> +			case 1:			/* unknown */
> +				break;
> +			default:		/* error */
> +				goto err;
> +			}
> +		} else
> +			/* strange, no entry in mtab or /proc not mounted */
> +			nfs_umount23(spec, "tcp,v3");
Question: since retrieve_mount_options() returns NULL why do you assume 
the mount exists? What's happing is I'm doing an umount.nfs on an 
not existing mount point and the error is 
    umount.nfs: remote share not in 'host:dir' format

Instead of
    umount.nfs: /mnt/home: not mounted

steved.
  

  reply	other threads:[~2011-03-03 19:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-03 13:43 mount.nfs libmount support (v2) Karel Zak
2011-03-03 13:43 ` [PATCH 1/2] mount: move generic functions to utils.c and network.c Karel Zak
2011-03-03 20:03   ` [PATCH 1.5/2] mount: Remove MOUNT_CONFIG warning Steve Dickson
     [not found]     ` <4D6FF3F4.8040602-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
2011-03-05 21:24       ` Steve Dickson
2011-03-03 13:43 ` [PATCH 2/2] mount: add --enable-libmount-mount Karel Zak
2011-03-03 19:53   ` Steve Dickson [this message]
2011-03-04 10:18     ` Karel Zak
2011-03-04 16:23       ` Steve Dickson
2011-03-03 14:48 ` mount.nfs libmount support (v2) Chuck Lever
2011-03-03 20:04 ` [PATCH 3/2] mount: Allow 'port=0' to be a valid port value Steve Dickson
2011-03-03 20:12   ` Chuck Lever
2011-03-03 20:16     ` Chuck Lever
2011-03-03 20:38       ` Steve Dickson
  -- strict thread matches above, loose matches on Subject: below --
2011-03-14 13:58 mount.nfs libmount support (v3) Karel Zak
2011-03-14 13:58 ` [PATCH 2/2] mount: add --enable-libmount-mount Karel Zak
2011-02-08 13:45 mount.nfs libmount support Karel Zak
2011-02-08 13:45 ` [PATCH 2/2] mount: add --enable-libmount-mount Karel Zak
2011-02-08 15:56   ` Chuck Lever

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=4D6FF1A2.8060205@RedHat.com \
    --to=steved@redhat.com \
    --cc=chuck.lever@oracle.com \
    --cc=kzak@redhat.com \
    --cc=linux-nfs@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.