#583298 mount_check() in dirvish-cronjob does not check properly if the mount failed

#583298#5
Date:
2010-05-26 20:56:44 UTC
From:
To:
mount_check() checks for the presence of /lost+found in a mount point in order
to find out whether the mount succeeded. Instead, one should check the return
value of the mount command. If it is not equal to zero, the mount failed.
Otherwise, it must have succeeded.

Maybe, even the second check could be left out:
	if stat $1 | grep 'Inode: 2[^0-9]' >/dev/null; then # ditto

This bug occurred on Ubuntu 10.04.

#583298#10
Date:
2010-05-26 21:46:01 UTC
From:
To:
Ah yes, but perhaps the filesystem was already mounted beforehand?
The mount will fail, but the filesystem is mounted so the backup can
proceed. Please suggest how to work around that.


thanks,
Paul

#583298#15
Date:
2010-05-27 16:08:51 UTC
From:
To:
Am 26.05.2010 schrieb Paul Slootman:

Yes, of course it should be checked beforehand if the file system is already
mounted. For some reason this does not occur on my system so I did not notice
that insufficiency.

So, now I am doing a mount which lists all mount points. With grep, I am
looking, if the desired mount point exists already. If not, I try to mount
that device.

As http://git.debian.org/?p=users/lamont/util-
linux.git;a=blob;f=mount/mount.c;hb=HEAD#l261 indicates (packet util-linux,
file mount/mount.c, line 266), the output of mount is not localised so that it
should be safe parsing the output with the regular expression given to grep.

Best regards,

Jens