summaryrefslogtreecommitdiffstats
path: root/utils/mount/mount.c
Commit message (Collapse)AuthorAgeFilesLines
* mount.nfs: No need to return nfs_mount_data structsChuck Lever2007-07-201-20/+2
| | | | | | | | | | | | | | | | Refactor mount processing slightly to remove an output parameter and an unnecessary type cast. The mount syscall is now made from inside nfs_mount or nfs4mount, rather than in common code after those are called. Code review suggests that EX_BG was never returned by mount.nfs because the logic I just replaced was always returning EX_FAIL. The new logic should properly return EX_BG when appropriate. However, it is unclear whether /bin/mount handles backgrounding the mount request, or whether mount.nfs should. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Move MS_DUMMY and friends to header fileChuck Lever2007-07-201-5/+0
| | | | | | | | | We move the definitions of MS_USER and friends to our local copy of mount_constants.h. These will need to be available in nfsmount.c and nfs4mount.c when we move the mount system call out of mount.c. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Move start_statd into nfs_mountChuck Lever2007-07-201-59/+2
| | | | | | | | | | | | | | Move start_startd into network.c, and move the call inside of nfs_mount, instead of immediately after - conceptually a better place for it. Also fix a minor nit: Since the mount actually fails if start_statd doesn't work, cause mount.nfs to exit with a status of EX_FAIL. Still need to do something about "running_bg" in nfsmount.c:nfsmount(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Move network functions into a common source moduleChuck Lever2007-07-201-6/+1
| | | | | | | | Separate network oriented functions from filesystem oriented functions, for general cleanliness. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Always preset nfs_mount_versionChuck Lever2007-07-201-0/+49
| | | | | | | | | | | | nfs_mount_version is a global integer that is set based on a guess about which nfs_mount_data version is appropriate for the kernel we're running on. Make it always available and have the correct value before calling mount and unmount so they don't have to worry about setting it themselves. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Create a common source module for reporting mount errorsChuck Lever2007-07-201-28/+5
| | | | | | | Clean up, and pre-requisite for subsequent fixes. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: clean-up add_mtabChuck Lever2007-07-201-24/+28
| | | | | | | | | | Clean up add_mtab(), and make /sbin/mount.nfs[4] return a proper error if it fails. Also include an unbalanced unlock_mtab() noticed by Steve D. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: /bin/mount already handles --bind & friendsChuck Lever2007-07-201-30/+0
| | | | | | | | | | | | | Clean-up: remove logic to handle --bind and other such command-line options from mount.nfs[4]. These options are already handled in /bin/mount, and the logic for handling them in the NFS helper is currently disabled. Other helpers such as mount.ocfs2 appear not to support --bind (ie. they rely on /bin/mount to do it). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Remove support for "-t" optionChuck Lever2007-07-201-36/+26
| | | | | | | | /bin/mount will never pass "-t" to a mount helper, since it passes the fs-type in the name of the program it is executing. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Simplify generation of prognameChuck Lever2007-07-201-7/+2
| | | | | | | Use basename() instead of our own majick. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* Fix umount.nfs exit statusSteinar H. Gunderson2007-07-161-1/+1
| | | | | | | | | | | | | | | | Hi, As per a bug report from a user: mount.c seems to assume that nfsumount() uses standard C true/false return values, and inverts them for the exit status (where 0 is traditionally considered success). However, nfsumount() consistently seems to use 0 for success, and thus a success gets returned as exit status 1 and a failure as exit status 0. This confuses at least the GNOME drive manager applet, and probably others as well. Signed-off-by: Steinar H. Gunderson <sesse@debian.org> Signed-off-by: Neil Brown <neilb@suse.de>
* Added missing unlock_mtab() call in the add_mtab()Steve Dickson2007-07-161-0/+1
| | | | | | routine. Signed-off-by: Steve Dickson <steved@redhat.com>
* fix warnings in mount.cJ. Bruce Fields2007-07-101-1/+1
| | | | | | | | The compiler is warning because we aren't properly specifying the type of the chk_mountpoint argument. Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs - NFSv4 mounts give wrong error message when server denies the mountSteve Dickson2007-05-171-5/+35
| | | | | | | | | | When nfs4 mount fail because the exported directory does not exist, the mount command claims the local mount point does not exist which is wrong. This patch fixes that problem as well as makes the v4 mount failures look like v3/v2 failures. Signed-off-by: Steve Dickson <steved@redhat.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs - require statd to be running to mount without nolocksNeil Brown2007-03-291-7/+46
| | | | | | | | | If we are mounting nfsv2 or nfsv3 and statd isn't running and we cannot start statd, then fail the mount request. Also use an RPC ping to check on statd. Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Fix issue with -o user,execNeil Brown2007-03-221-4/+2
| | | | | | | | | | | | It would seem to make sense for mount.nfs to impose the "-o user" => "-o noexec,nodev,nosuid" rule. However if you give "user,exec" to /sbin/mount, it will pass down nodev,nosuid,user with the 'exec' flag :-( So we have to leave that handling of that particular rule to /sbin/mount.
* Fix a couple of problems that crept into mountKevin Coffman2007-03-211-2/+2
| | | | | | | | | | | | Commit 6facb22402a0bd8cd49be2ed1a0856b24fef42f4 changed the allocation of len to no longer get 20 extra bytes. It needs to get at least one extra byte for a null character, otherwise a single extra option such as "sec=krb5" is never copied in parse_opt() and is dropped. Commit 44a3727a3243e674a1f1fdad5cbbc639aa25d01c added a typo when checking the program name. Signed-off-by: Neil Brown <neilb@suse.de>
* Add support for quoted mount optionsKarel Zak2007-03-201-6/+18
| | | | | | | | | | | | The patch avoid the collision between commas in security contexts and the delimiter between mount options. Try: mount.nfs foo://mnt/bar /mnt/bar -o context=\"aaa,bbb,ccc\",ro Signed-off-by: Cory Olmo <colmo@TrustedCS.com> Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Neil Brown <neilb@suse.de>
* Build mount.nfs by default, and install setuidNeil Brown2007-03-201-3/+10
| | | | Also fix a few bugs that came up in initial testing.
* mount.nfs - make sure program name in error message is correct.Neil Brown2007-03-201-1/+2
| | | | | | getopt_long uses argv[0] in error messages. So it it is given argv+2 for example, we need to make sure that argv[2] has the correct program name.
* mount.nfs - Tidy up option parsing.Neil Brown2007-03-201-14/+38
| | | | | Make sure all possible invalid arguments are discovered and reported. Make sure nothing gets by for uid!=0 that doesn't perfectly match fstab.
* Handle -o remount betterNeil Brown2007-03-201-0/+5
| | | | | | | | On -o remount, we need to update the entry in mtab rather than add a new one. update_mtab does this so use that. However it might free some strings that shouldn't be freed, so stop it from calling free - the program will exit soon anyway so no exit is needed.
* Correctly handle -f (fake) mount option.Karel Zak2007-03-201-9/+9
| | | | | | | | | The fake option has to write to mtab like a normal mount. Read mount(8) man page for more details. It's very important for system init scripts that use "-f" as a way how write info about mount points to /etc/mtab. Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Neil Brown <neilb@suse.de>
* Clean up of some error messages.Amit Gud2007-03-191-4/+4
| | | | | Signed-off-by: Steve Dickson <steved@redhat.com> Signed-off-by: Neil Brown <neilb@suse.de>
* Correctly handle "user" and "users" mount options.Neil Brown2007-03-161-6/+57
| | | | | | | | | | | | If "user" or "users" is given, then allow mount.nfs to be run by a non-root user providing that the mountpoint, filesystem, and options exactly match what is found in fstab. For "user", record the user name in mtab so they can unmount the filesystem later. Also alwasys ignore auto, owner, group and their negations as well as "_netdev", "comment" and "loop".
* Remove some incorrect version matching code.Neil Brown2007-03-161-1/+1
| | | | | The version of the interface to the kernel for requesting a mount it entirely different to the version of NFS that is being mounted.
* Return the correct exit status on failed mountsSteve Dickson2007-03-161-10/+16
| | | | | Signed-off-by: Steve Dickson <steved@redhat.com> Signed-off-by: Neil Brown <neilb@suse.de>
* Support -s option to ignore unknown options (sloppy)Neil Brown2007-03-161-1/+6
|
* Return correct exit status for umount.nfs.Neil Brown2007-03-161-1/+1
| | | | | | nfsumount() returns 1 for success and 0 for failure. Take proper account of this when producing an exit status.
* Automatically start statd when mounting an nfs filesystem.Neil Brown2007-03-161-5/+27
| | | | | | | | | | | If statd is not running (/var/run/rpc.statd.pid) when an nfs filesystem is mounted (v2 or v3, with remote locking enabled), and if /usr/sbin/start-statd (or other program specified at config time) is present, then run that program to start statd. This means that statd does not need to be running "just in case". It only needs to be started at boot time if the nfs server is started.
* Remove unused variable from add_mtabNeil Brown2007-03-131-1/+0
|
* nfs-utils - mtab locking needed on add as well as updateIan Kent2006-12-191-9/+6
| | | | | | | | | | | | | Hi all, I noticed some mtab corruption the other day when doing some autofs testing but thought nothing of it. When investigating another issue I came across utils/mount.c:add_mtab which looks like it adds an entry to /etc/mtab without performing correct locking. Perhaps this is not needed when adding entries but I think it is.
* Merge nfsmount.x and mount.x into mount.xAmit Gud2006-06-231-1/+1
| | | | | | | Merge utils/mount/nfsmount.x and support/export/mount.x into support/export/mount.x. Signed-off-by: Amit Gud <agud@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Move NFS mount code from util-linux to nfs-utils - part 1Amit Gud2006-06-161-0/+387
Adds the mount directory and the code to mount and umount the NFS file system. Signed-off-by: Amit Gud <agud@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>