On Mon, Mar 15, 2010 at 5:34 PM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote: > On Mon, Mar 15, 2010 at 10:04:46AM -0600, Andreas Dilger wrote: >> On 2010-03-13, at 13:30, Francis Moreau wrote: >> >I've some shell scripts which try to find out the filesystem hosted by >> >a block device. >> > >> >They basically do this: >> > >> > mount /dev/sdc1 /mnt >> > fs=$(stat -f -c %T $mount_point) >> > umount /mnt >> >> Mounting an in-use filesystem is a bad idea. > > Huh? mount() will happily create another vfsmount refering to the same > superblock in that case. It *is* OK to mount the same block device twice; > any fs that uses get_sb_bdev() will DTRT. > > It should be safe. The lack of error checking after mount, OTOH, is not. > Well I omitted the error checking since it was not revelant in my case: umount(8) fails but not mount(8). -- Francis -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html