Results 1 to 2 of 2
This is an odd one. I have a C program that calls umount to unmount a volume. A simplified case looks like this:
Code:
int main()
{
int rc = ...
- 11-13-2010 #1Just Joined!
- Join Date
- Nov 2010
- Posts
- 11
Calling umount2() unmounts volume but df entry still visible
This is an odd one. I have a C program that calls umount to unmount a volume. A simplified case looks like this:
When I run this code, the "/v0" volume is unmount, but it still shows up in df:Code:int main() { int rc = umount2("/v0", MNT_FORCE); if (rc != 0) { printf("Unable to unmount volume /v0, err='%s'", strerror(errno)); } }
As you can see, df still shows that /v0 is mount. However, it's not *really* mounted. If I try to access it, the commands fail:Code:# mount /dev/sda7 /v0 # touch /v0/xxx # df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda1 8254240 3554504 4280444 46% / /dev/sda7 20954552 4260 20950292 1% /v0 /dev/sdb7 20954552 4256 20950296 1% /v1 /dev/sda2 4127108 180232 3737228 5% /var #./a.out #df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda1 8254240 3554504 4280444 46% / /dev/sda7 20954552 4260 20950292 1% /v0 /dev/sdb7 20954552 4256 20950296 1% /v1 /dev/sda2 4127108 180232 3737228 5% /var
If I run a umount, it fails as well, but this removes the /v0 entry as well:Code:# ls /v0/xxx ls: cannot access /v0/xxx: No such file or directory
So, the question is, why does calling umount2() in my code not completely unmount the volume?Code:# umount -f /v0 umount2: Invalid argument umount: /v0: not mounted umount2: Invalid argument # df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda1 8254240 3554504 4280444 46% / /dev/sdb7 20954552 4256 20950296 1% /v1 /dev/sda2 4127108 180232 3737228 5% /var
- 11-13-2010 #2Just Joined!
- Join Date
- Nov 2010
- Posts
- 11
I've discovered the opposite problem with the mount() function call. I have code that makes the call:
After making this call, a df command does not show an entry for the newly mounted volume. However, accessing the volume through other commands confirms that in fact the volume *is* mounted, and issuing a umount command from the command line unmounts the volume without any errors.Code:mount(drive, volume, "xfs", MS_NOATIME, NULL);
So, why is my C code behaving differently than running the mount/umount commands from the command line?


Reply With Quote