On Sat, 8 Jun 2013 13:39:33 +0200 Peter Valdemar Mørch <peter@xxxxxxxxx> wrote: > Hi, > > Is there some way to detect if the mount no longer "works"? There > could be many reasons for this: network error, Windows server has been > shut down, etc. > > I can of course periodically do this: > > > time ls -l /mnt/cifs/ > ls: cannot access /mnt/cifs/: Host is down > EHOSTDOWN is not really a legit error to most syscalls. The fact that it leaks out into userland is a bug. I wouldn't rely on that. > real 0m10.000s > user 0m0.000s > sys 0m0.000s > > And use that error to umount, which is what I'll do if I don't have > any other options. > > But I'm hoping for some timeout / auto-umount mechanism or some way to > query if the mount is still "good", that doesn't take 10 seconds pr. > mountpoint... > Given the nature of how networks and the SMB protocol work, there is little choice other than to send a call to the server and wait. That wait is necessarily long (minutes even) since there's no way to know if the client really isn't responding or is just taking a long time to process the request. If you really don't care about the mount and you have no dirty data on it, then you should be able to do a lazy umount (umount -l) which will detach it from the mount tree and eventually clean it up when there are no more references to it. If you have this problem frequently, then consider using something like autofs to mount it as needed and unmount it when you're done. -- Jeff Layton <jlayton@xxxxxxxxxx> -- To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html