Skip to content
Snippets Groups Projects
Commit 86c7aebf authored by Yang Sheng's avatar Yang Sheng
Browse files

Branch HEAD

b=16953
i=johann, robert.read

Add mount retry support for liblustre.
parent 2ea0ed98
No related merge requests found
...@@ -326,6 +326,8 @@ int _sysio_lustre_init(void) ...@@ -326,6 +326,8 @@ int _sysio_lustre_init(void)
extern int _sysio_native_init(); extern int _sysio_native_init();
static int mnt_retry = 0;
char *lustre_path = NULL; char *lustre_path = NULL;
void __liblustre_setup_(void) void __liblustre_setup_(void)
...@@ -333,13 +335,20 @@ void __liblustre_setup_(void) ...@@ -333,13 +335,20 @@ void __liblustre_setup_(void)
char *target = NULL; char *target = NULL;
char *lustre_driver = "lustre"; char *lustre_driver = "lustre";
unsigned mntflgs = 0; unsigned mntflgs = 0;
int err; int err, count;
lustre_path = getenv("LIBLUSTRE_MOUNT_POINT"); lustre_path = getenv("LIBLUSTRE_MOUNT_POINT");
if (!lustre_path) { if (!lustre_path) {
lustre_path = "/mnt/lustre"; lustre_path = "/mnt/lustre";
} }
target = getenv("LIBLUSTRE_MOUNT_RETRY");
if (target) {
mnt_retry = atoi(target);
if (mnt_retry < 0)
mnt_retry = 0;
}
/* mount target */ /* mount target */
target = getenv("LIBLUSTRE_MOUNT_TARGET"); target = getenv("LIBLUSTRE_MOUNT_TARGET");
if (!target) { if (!target) {
...@@ -368,7 +377,16 @@ void __liblustre_setup_(void) ...@@ -368,7 +377,16 @@ void __liblustre_setup_(void)
exit(1); exit(1);
#endif /* INIT_SYSIO */ #endif /* INIT_SYSIO */
err = mount(target, lustre_path, lustre_driver, mntflgs, NULL); count = mnt_retry;
do {
err = mount(target, lustre_path, lustre_driver, mntflgs, NULL);
if (err && mnt_retry && (-- count)) {
fprintf(stderr, "Lustre mount failed: %s. "
"Will retry %d more times\n",
strerror(errno), mnt_retry - count );
sleep(2);
}
} while (err && count > 0);
if (err) { if (err) {
fprintf(stderr, "Lustre mount failed: %s\n", strerror(errno)); fprintf(stderr, "Lustre mount failed: %s\n", strerror(errno));
exit(1); exit(1);
......
...@@ -306,6 +306,7 @@ for NAME in $CONFIGS; do ...@@ -306,6 +306,7 @@ for NAME in $CONFIGS; do
MDS_MOUNT_OPTS=${MDS_MOUNT_OPTS/#,/-o } \ MDS_MOUNT_OPTS=${MDS_MOUNT_OPTS/#,/-o } \
$SETUP $SETUP
export LIBLUSTRE_MOUNT_POINT=$MOUNT2 export LIBLUSTRE_MOUNT_POINT=$MOUNT2
export LIBLUSTRE_MOUNT_RETRY=5
export LIBLUSTRE_MOUNT_TARGET=$MGSNID:/$FSNAME export LIBLUSTRE_MOUNT_TARGET=$MGSNID:/$FSNAME
export LIBLUSTRE_TIMEOUT=`lctl get_param -n timeout` export LIBLUSTRE_TIMEOUT=`lctl get_param -n timeout`
#export LIBLUSTRE_DEBUG_MASK=`lctl get_param -n debug` #export LIBLUSTRE_DEBUG_MASK=`lctl get_param -n debug`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment