linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Steve Dickson <SteveD@redhat.com>
Cc: Karel Zak <kzak@redhat.com>, NFS <linux-nfs@vger.kernel.org>
Subject: Re: nfs-utils: Something is wrong in is_vers4()
Date: Thu, 2 Aug 2012 10:21:42 +1000	[thread overview]
Message-ID: <20120802102142.10be27f4@notabene.brown> (raw)
In-Reply-To: <5019499C.2040805@RedHat.com>

[-- Attachment #1: Type: text/plain, Size: 2709 bytes --]

On Wed, 01 Aug 2012 11:22:04 -0400 Steve Dickson <SteveD@redhat.com> wrote:

> 
> 
> On 07/31/2012 02:37 PM, Karel Zak wrote:
> > On Tue, Jul 31, 2012 at 01:04:58PM -0400, Steve Dickson wrote:
> >>> BTW Steve, Karel's "[PATCH] umount.nfs: ignore non-nfs filesystems"
> >>> which appears in email:
> >>>
> >>> From: Karel Zak <kzak@redhat.com>
> >>> To: NeilBrown <neilb@suse.de>
> >>> Cc: Steve Dickson <SteveD@redhat.com>, NFS <linux-nfs@vger.kernel.org>
> >>> Subject: Re: [PATCH] umount.nfs: restore correct error status when umount fails.
> >>> Date: Thu, 12 Jul 2012 18:44:20 +0200
> >>>
> >>> hasn't been applied, but probably should be.
> >> I beg to differ....
> >>
> >> commit 76908c3f14a12e865054ea5d6e4cad201c28839a
> >> Author: NeilBrown <neilb@suse.de>
> >> Date:   Mon Jul 16 08:43:28 2012 -0400
> >>
> >>     mount.nfs: restore correct error status when umount fails
> >>
> >> Or am I missing something?
> > 
> >  Yes, Neil found two problems:
> > 
> >     http://www.spinics.net/lists/linux-nfs/msg31466.html
> Ah... Found it and committed it... 
> 
> steved.

Thanks.
So here is one more :-)  This  fixes the the bug in $SUBJECT

NeilBrown

From: Neil Brown <neilb@suse.de>
Date: Thu, 2 Aug 2012 10:20:13 +1000
Subject: [PATCH] umount: use correct return value for is_vers4.

is_vers4 in mount_libmount.c is based on nfs_umount_is_vers4
in nfsumount.c, except the return values are reversed.
The result of this is:
 - a MOUNT_UMNT call is not sent when an NFSv3 or NFSv2
   filesystem is unmounted
 - a MOUNT_UMNT call *is* sent when and 'nfs4' filesystem
   is unmounted (but not when an 'nfs -o vers=4 filesystem
   is unmounted, as that is checked elsewhere).

Signed-off-by: NeilBrown <neilb@suse.de>

diff --git a/utils/mount/mount_libmount.c b/utils/mount/mount_libmount.c
index ddf61b2..701d41e 100644
--- a/utils/mount/mount_libmount.c
+++ b/utils/mount/mount_libmount.c
@@ -140,14 +140,14 @@ static int try_mount(struct libmnt_context *cxt, int bg)
 	return ret;
 }
 
-/* returns: error = -1, success = 0 , unknown = 1 */
+/* returns: error = -1, success = 1 , not vers4 == 0 */
 static int is_vers4(struct libmnt_context *cxt)
 {
 	struct libmnt_fs *fs = mnt_context_get_fs(cxt);
 	struct libmnt_table *tb = NULL;
 	const char *src = mnt_context_get_source(cxt),
 		   *tgt = mnt_context_get_target(cxt);
-	int rc = 1;
+	int rc = 0;
 
 	if (!src || !tgt)
 		return -1;
@@ -163,7 +163,7 @@ static int is_vers4(struct libmnt_context *cxt)
 	if (fs) {
 		const char *type = mnt_fs_get_fstype(fs);
 		if (type && strcmp(type, "nfs4") == 0)
-			rc = 0;
+			rc = 1;
 	}
 	mnt_free_table(tb);
 	return rc;

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2012-08-02  0:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-31  6:58 nfs-utils: Something is wrong in is_vers4() NeilBrown
2012-07-31  9:58 ` Karel Zak
2012-07-31 17:04 ` Steve Dickson
2012-07-31 18:37   ` Karel Zak
2012-08-01 15:22     ` Steve Dickson
2012-08-02  0:21       ` NeilBrown [this message]
2012-08-06 14:21         ` Steve Dickson

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=20120802102142.10be27f4@notabene.brown \
    --to=neilb@suse.de \
    --cc=SteveD@redhat.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 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).