]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
umount: use correct return value for is_vers4.
authorNeilBrown <neilb@suse.de>
Mon, 6 Aug 2012 12:41:13 +0000 (08:41 -0400)
committerSteve Dickson <steved@redhat.com>
Mon, 6 Aug 2012 13:11:27 +0000 (09:11 -0400)
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>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/mount/mount_libmount.c

index ddf61b20913f5931bc47157dce6b5962646b9333..701d41e42e2e8725d1f8a2bb1c07d1d343a2a8a8 100644 (file)
@@ -140,14 +140,14 @@ static int try_mount(struct libmnt_context *cxt, int bg)
        return ret;
 }
 
        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);
 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;
 
        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)
        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;
        }
        mnt_free_table(tb);
        return rc;