/* * Usually all that is needed for an NFS remount is to change * generic mount options like "sync" or "ro". These generic * options are controlled by mi->flags, not by text-based * options, and no contact with the server is needed. * * Take care with the /etc/mtab entry for this mount; just * calling update_mtab() will change an "-t nfs -o vers=4" * mount to an "-t nfs -o remount" mount, and that will * confuse umount.nfs. * * Returns a valid mount command exit code. */ static int nfs_remount(struct nfsmount_info *mi) { if (nfs_sys_mount(mi, mi->options)) return EX_SUCCESS; mount_error(mi->spec, mi->node, errno); return EX_FAIL; }
static int nfs_do_mount_v4(struct nfsmount_info *mi, struct sockaddr *sap, socklen_t salen) { struct mount_options *options = po_dup(mi->options); int result = 0; if (!options) { errno = ENOMEM; return result; } if (mi->version == 0) { if (po_contains(options, "mounthost") || po_contains(options, "mountaddr") || po_contains(options, "mountvers") || po_contains(options, "mountproto")) { /* * Since these mountd options are set assume version 3 * is wanted so error out with EPROTONOSUPPORT so the * protocol negation starts with v3. */ errno = EPROTONOSUPPORT; goto out_fail; } if (po_append(options, "vers=4") == PO_FAILED) { errno = EINVAL; goto out_fail; } } if (!nfs_append_addr_option(sap, salen, options)) { errno = EINVAL; goto out_fail; } if (!nfs_append_clientaddr_option(sap, salen, options)) { errno = EINVAL; goto out_fail; } /* * Update option string to be recorded in /etc/mtab. */ if (po_join(options, mi->extra_opts) == PO_FAILED) { errno = ENOMEM; goto out_fail; } if (verbose) printf(_("%s: trying text-based options '%s'\n"), progname, *mi->extra_opts); result = nfs_sys_mount(mi, options); out_fail: po_destroy(options); return result; }
static int nfs_do_mount_v3v2(struct nfsmount_info *mi, struct sockaddr *sap, socklen_t salen, int checkv4) { struct mount_options *options = po_dup(mi->options); int result = 0; if (!options) { errno = ENOMEM; return result; } errno = 0; if (!nfs_append_addr_option(sap, salen, options)) { if (errno == 0) errno = EINVAL; goto out_fail; } if (!nfs_fix_mounthost_option(options, mi->hostname)) { if (errno == 0) errno = EINVAL; goto out_fail; } if (!mi->fake && !nfs_verify_lock_option(options)) { if (errno == 0) errno = EINVAL; goto out_fail; } /* * Options we negotiate below may be stale by the time this * file system is unmounted. In order to force umount.nfs * to renegotiate with the server, only write the user- * specified options, and not negotiated options, to /etc/mtab. */ if (po_join(options, mi->extra_opts) == PO_FAILED) { errno = ENOMEM; goto out_fail; } if (verbose) printf(_("%s: trying text-based options '%s'\n"), progname, *mi->extra_opts); if (!nfs_rewrite_pmap_mount_options(options, checkv4, mi->local_ip)) goto out_fail; result = nfs_sys_mount(mi, options); out_fail: po_destroy(options); return result; }
/* * Usually all that is needed for an NFS remount is to change * generic mount options like "sync" or "ro". These generic * options are controlled by mi->flags, not by text-based * options, and no contact with the server is needed. * * Take care with the /etc/mtab entry for this mount; just * calling update_mtab() will change an "-t nfs -o vers=4" * mount to an "-t nfs -o remount" mount, and that will * confuse umount.nfs. * * Returns a valid mount command exit code. */ static int nfs_remount(struct nfsmount_info *mi) { if (nfs_sys_mount(mi, mi->options)) return EX_SUCCESS; return EX_FAIL; }