Hello everyone!
I'm playing with guestunmount and got the following issues:
1) guestunmount never returns 3 (not mounted) - i guess it's a bug at 
guestunmount.c:223
2) I don't know whether it's a bug in guestunmount or fusermount, but on
my machine while executing
 > guestmount
 > guestunmount
 > guestunmount
on second "guestunmount" I get
"guestunmount: failed to unmount {...}: fusermount: failed to unmount 
{...}: Invalid argument"
while, according to guestunmount.c, guestunmount should return something 
like
"entry for {} not found"
3)
 > fusermount -u {}
gives me "Invalid argument" as well, while
 > umount {}
handles this error successfully and returns "not mounted".
(strace logs attached)
I have a custom centos7-based distro, but I don't think it matters.
I'd like someone to compare results with mine, and, possibly, give me 
some explanations about why it's going like this and how to distinguish 
non-mounted mountpoints from busy ones (I guess I'll have to parse 
umount {} output).
Thanks in advance!
-- 
Your sincerely,
Maxim Perevedentsev
Hi, On Monday 23 November 2015 18:29:50 Maxim Perevedentsev wrote:> 1) guestunmount never returns 3 (not mounted) - i guess it's a bug at > guestunmount.c:223Indeed, thanks for the notice -- just send a patch for it.> 2) I don't know whether it's a bug in guestunmount or fusermount, but on > my machine while executing > > guestmount > > guestunmount > > guestunmount > on second "guestunmount" I get > "guestunmount: failed to unmount {...}: fusermount: failed to unmount > {...}: Invalid argument" > while, according to guestunmount.c, guestunmount should return something > like > "entry for {} not found"Most probably it has to do with the (3) below: fusermount just reports the EINVAL got from umount while trying to unmount an not-mounted directory.> 3) > > fusermount -u {} > gives me "Invalid argument" as well, while > > umount {} > handles this error successfully and returns "not mounted". > (strace logs attached)Well, umount still returns 1, so In any case, both fail due to the mount point not being actually mounted; the difference is that umount takes the EINVAL from umount2 (which calls the umount Linux syscall) as an indication the directory is not a mount point, while fusermount just reports the failure as it is.> I'd like someone to compare results with mine, and, possibly, give me > some explanations about why it's going like this and how to distinguish > non-mounted mountpoints from busy ones (I guess I'll have to parse > umount {} output).Unfortunately it does not seem to be possible to do that, just by checking the return values of the tools. I guess you might want to ask fuse and util-linux people to improve the return values, although that might break user code... Another alternative may be writing C code doing the umount, but that would imply rewrite part of the logic... -- Pino Toscano
On 11/23/2015 07:59 PM, Pino Toscano wrote:> Hi, > > On Monday 23 November 2015 18:29:50 Maxim Perevedentsev wrote: >> 1) guestunmount never returns 3 (not mounted) - i guess it's a bug at >> guestunmount.c:223 > Indeed, thanks for the notice -- just send a patch for it. > >> 2) I don't know whether it's a bug in guestunmount or fusermount, but on >> my machine while executing >> > guestmount >> > guestunmount >> > guestunmount >> on second "guestunmount" I get >> "guestunmount: failed to unmount {...}: fusermount: failed to unmount >> {...}: Invalid argument" >> while, according to guestunmount.c, guestunmount should return something >> like >> "entry for {} not found" > Most probably it has to do with the (3) below: fusermount just reports > the EINVAL got from umount while trying to unmount an not-mounted > directory.I was mistaken. This should have been: on second "guestunmount" I get "guestunmount: failed to unmount {...}: fusermount: failed to unmount {...}: Invalid argument" while, according to guestunmount.c, **fusermount** should return something like "entry for {} not found" It looks like the code path where guestunmount returns 3 is unreachable. That's why I asked someone to check fusermount error text on his machine. If fusermount always outputs "Invalid argument" in response to non-existent mount, than parsing at guestunmount.c:200 should be fixed accordingly. -- Your sincerely, Maxim Perevedentsev