Backport patch of LU-1833 for b2_1.
This is needed for the diskless environment since their
mtab is linking to /proc/mount.
Signed-off-by: Shuichi Ihara <sihara@ddn.com>
Signed-off-by: Peng Tao <tao.peng@emc.com>
Change-Id: Id18cd6a820dff905f0d61ecc1f71f4ce7b48cf77
Reviewed-on: http://review.whamcloud.com/4785
Tested-by: Hudson
Reviewed-by: Peng Tao <bergwolf@gmail.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
return(0);
}
+#define PROC_DIR "/proc/"
+static int mtab_is_proc(const char *mtab)
+{
+ char path[16];
+
+ if (readlink(mtab, path, sizeof(path)) < 0)
+ return 0;
+
+ if (strncmp(path, PROC_DIR, strlen(PROC_DIR)))
+ return 0;
+
+ return 1;
+}
+
static int
update_mtab_entry(char *spec, char *mtpt, char *type, char *opts,
int flags, int freq, int pass)
struct mntent mnt;
int rc = 0;
+ /* Don't update mtab if it is linked to any file in /proc direcotry.*/
+ if (mtab_is_proc(MOUNTED))
+ return 0;
+
mnt.mnt_fsname = spec;
mnt.mnt_dir = mtpt;
mnt.mnt_type = type;