Whamcloud - gitweb
LU-3682 tunefs: prevent tunefs running on a mounted device 33/7433/7
authorEmoly Liu <emoly.liu@intel.com>
Tue, 10 Sep 2013 07:14:16 +0000 (15:14 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 20 Sep 2013 21:29:21 +0000 (21:29 +0000)
commit66858bc059362504d201262202549099185e69ba
tree7b47153bf4388c441e066b748107dcf2516b89fc
parent02eb3c533534741d7f90a2af92e13a4744f1c1f8
LU-3682 tunefs: prevent tunefs running on a mounted device

This patch is to check if the given device is already mounted in
the following two situations.
1) Try to get the real path to the given device, in case it is a
symbolic link or dm device for instance, and return EEXIST if it
is already mounted.
2) If the given file is already associated with a mounted loop
device, check_mtab_entry() should return EEXIST to prevent the
following loop setup attemp.

Signed-off-by: Emoly Liu <emoly.liu@intel.com>
Change-Id: I57d9dc443d94057014212cb30d04a2f385b50d7b
Reviewed-on: http://review.whamcloud.com/7433
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/utils/mkfs_lustre.c
lustre/utils/mount_lustre.c
lustre/utils/mount_utils.c
lustre/utils/mount_utils.h