From: nathan Date: Wed, 14 Jun 2006 19:55:38 +0000 (+0000) Subject: Branch b1_5 X-Git-Tag: v1_7_100~1^90~8^2~130 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=d5d2b8ff17b5a9669ac8c2d35b51552369515184;p=fs%2Flustre-release.git Branch b1_5 b=8007 mtab must be checked before writing anything. we no longer need the loopback setup for reading. --- diff --git a/lustre/utils/mkfs_lustre.c b/lustre/utils/mkfs_lustre.c index 968a7ab..b08ee53 100644 --- a/lustre/utils/mkfs_lustre.c +++ b/lustre/utils/mkfs_lustre.c @@ -1104,11 +1104,6 @@ int main(int argc, char *const argv[]) /* device is last arg */ strcpy(mop.mo_device, argv[argc - 1]); -#ifndef TUNEFS /* mkfs.lustre */ - if (check_mtab_entry(mop.mo_device)) - return(EEXIST); -#endif - /* Are we using a loop device? */ ret = is_block(mop.mo_device); if (ret < 0) @@ -1119,20 +1114,6 @@ int main(int argc, char *const argv[]) #ifdef TUNEFS /* For tunefs, we must read in the old values before parsing any new ones. */ - /* Create the loopback file */ - if (mop.mo_flags & MO_IS_LOOP) { - ret = access(mop.mo_device, F_OK); - if (ret == 0) - ret = loop_setup(&mop); - else - ret = errno; - if (ret) { - fatal(); - fprintf(stderr, "Loop device setup for %s failed: %s\n", - mop.mo_device, strerror(ret)); - goto out; - } - } /* Check whether the disk has already been formatted by mkfs.lustre */ ret = is_lustre_target(&mop); @@ -1250,23 +1231,30 @@ int main(int argc, char *const argv[]) goto out; } -#ifndef TUNEFS /* mkfs.lustre */ - /* Create the loopback file of the correct size */ + if (check_mtab_entry(mop.mo_device)) + return(EEXIST); + + /* Create the loopback file */ if (mop.mo_flags & MO_IS_LOOP) { ret = access(mop.mo_device, F_OK); - /* Don't destroy the loopback file if no FORCEFORMAT */ + if (ret) + ret = errno; +#ifndef TUNEFS /* mkfs.lustre */ + /* Reformat the loopback file */ if (ret || (mop.mo_flags & MO_FORCEFORMAT)) ret = loop_format(&mop); +#endif if (ret == 0) ret = loop_setup(&mop); if (ret) { fatal(); - fprintf(stderr, "Loop device setup failed: %s\n", - strerror(ret)); + fprintf(stderr, "Loop device setup for %s failed: %s\n", + mop.mo_device, strerror(ret)); goto out; } } +#ifndef TUNEFS /* mkfs.lustre */ /* Check whether the disk has already been formatted by mkfs.lustre */ if (!(mop.mo_flags & MO_FORCEFORMAT)) { ret = is_lustre_target(&mop); @@ -1289,6 +1277,7 @@ int main(int argc, char *const argv[]) } #endif + /* Write our config files */ ret = write_local_files(&mop); if (ret != 0) { fatal(); diff --git a/lustre/utils/module_setup.sh b/lustre/utils/module_setup.sh index 1594476..cd59892 100755 --- a/lustre/utils/module_setup.sh +++ b/lustre/utils/module_setup.sh @@ -51,7 +51,6 @@ if [ `egrep -c "lustre|lnet" $MODFILE` -eq 0 ]; then echo "# Lustre modules added by $0" >> $MODFILE echo "# Networking options, see /sys/module/lnet/parameters" >> $MODFILE echo "options lnet networks=tcp" >> $MODFILE - echo "alias lustre llite" >> $MODFILE echo "# end Lustre modules" >> $MODFILE fi diff --git a/lustre/utils/mount_lustre.c b/lustre/utils/mount_lustre.c index 2148df4..67aa784 100644 --- a/lustre/utils/mount_lustre.c +++ b/lustre/utils/mount_lustre.c @@ -385,7 +385,9 @@ int main(int argc, char *const argv[]) source, target, strerror(errno)); if (errno == ENODEV) fprintf(stderr, "Are the lustre modules loaded?\n" - "Check /etc/modules.conf and /proc/filesystems\n"); + "Check /etc/modprobe.conf and /proc/filesystems" + "\nNote 'alias lustre llite' should be removed" + " from modprobe.conf\n"); if (errno == ENOTBLK) fprintf(stderr, "Do you need -o loop?\n"); if (errno == ENOMEDIUM)