summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9761d5c)
1. If the file is being opened by popen, it should use
pclose instead of fclose to close the file, to make sure
the process created by popen is closed after pclose, then
to avoid loop device is being hold on release.
2. Give another try in loop_cleanup in case there are still
some process going on with the loop.
3. wait loop device to release before continue conf-sanity
32c.
4. Add losetup -a to list loop dev information when the
test(conf-sanity 32) fails.
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: wang di <di.wang@intel.com>
Change-Id: I0051de9b5a39d487fe34554c79773de4635178cc
Reviewed-on: http://review.whamcloud.com/8409
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
t32_wait_til_devices_gone() {
local node=$1
local devices
t32_wait_til_devices_gone() {
local node=$1
local devices
local i=0
echo wait for devices to go
while ((i < 20)); do
devices=$(do_rpc_nodes $node $LCTL device_list | wc -l)
local i=0
echo wait for devices to go
while ((i < 20)); do
devices=$(do_rpc_nodes $node $LCTL device_list | wc -l)
- ((devices == 0)) && return 0
+ loops=$(do_rpc_nodes $node losetup -a | grep -c t32)
+ ((devices == 0 && loops == 0)) && return 0
sleep 5
i=$((i + 1))
done
sleep 5
i=$((i + 1))
done
- echo "waiting for devices on $node: Given up"
+ echo "waiting for dev on $node: dev $devices loop $loops given up"
+ do_rpc_nodes $node "losetup -a"
+ do_rpc_nodes $node "$LCTL devices_list"
$r $LCTL set_param debug="$PTLDEBUG"
$r $TUNEFS --dryrun $tmp/mdt || {
$r $LCTL set_param debug="$PTLDEBUG"
$r $TUNEFS --dryrun $tmp/mdt || {
error_noexit "tunefs.lustre before mounting the MDT"
return 1
}
error_noexit "tunefs.lustre before mounting the MDT"
return 1
}
mopts=loop,writeconf
if [ $fstype == "ldiskfs" ]; then
$r $TUNEFS --quota $tmp/mdt || {
mopts=loop,writeconf
if [ $fstype == "ldiskfs" ]; then
$r $TUNEFS --quota $tmp/mdt || {
error_noexit "Enable mdt quota feature"
return 1
}
error_noexit "Enable mdt quota feature"
return 1
}
t32_wait_til_devices_gone $node
$r mount -t lustre -o $mopts $tmp/mdt $tmp/mnt/mdt || {
t32_wait_til_devices_gone $node
$r mount -t lustre -o $mopts $tmp/mdt $tmp/mnt/mdt || {
error_noexit "Mounting the MDT"
return 1
}
error_noexit "Mounting the MDT"
return 1
}
mopts=loop,mgsnode=$nid,$writeconf
if [ $fstype == "ldiskfs" ]; then
$r $TUNEFS --quota $tmp/ost || {
mopts=loop,mgsnode=$nid,$writeconf
if [ $fstype == "ldiskfs" ]; then
$r $TUNEFS --quota $tmp/ost || {
error_noexit "Enable ost quota feature"
return 1
}
error_noexit "Enable ost quota feature"
return 1
}
# mount a second time to make sure we didnt leave upgrade flag on
$r $TUNEFS --dryrun $tmp/mdt || {
# mount a second time to make sure we didnt leave upgrade flag on
$r $TUNEFS --dryrun $tmp/mdt || {
error_noexit "tunefs.lustre before remounting the MDT"
return 1
}
error_noexit "tunefs.lustre before remounting the MDT"
return 1
}
int main(int argc, char *const argv[])
{
int main(int argc, char *const argv[])
{
- struct mkfs_opts mop;
- struct lustre_disk_data *ldd;
- char *mountopts = NULL;
- char always_mountopts[512] = "";
- char default_mountopts[512] = "";
+ struct mkfs_opts mop;
+ struct lustre_disk_data *ldd;
+ char *mountopts = NULL;
+ char always_mountopts[512] = "";
+ char default_mountopts[512] = "";
+ int ret = 0;
+ int ret2 = 0;
if ((progname = strrchr(argv[0], '/')) != NULL)
progname++;
if ((progname = strrchr(argv[0], '/')) != NULL)
progname++;
+ ret2 = loop_cleanup(&mop);
+ if (ret == 0)
+ ret = ret2;
/* Fix any crazy return values from system() */
if (ret && ((ret & 255) == 0))
/* Fix any crazy return values from system() */
if (ret && ((ret & 255) == 0))
char default_mountopts[512] = "";
struct mkfs_opts mkop;
int ret;
char default_mountopts[512] = "";
struct mkfs_opts mkop;
int ret;
memset(&mkop, 0, sizeof(mkop));
mkop.mo_ldd = *ldd;
memset(&mkop, 0, sizeof(mkop));
mkop.mo_ldd = *ldd;
fprintf(stderr, "failed to write local files: %s\n",
strerror(ret));
}
fprintf(stderr, "failed to write local files: %s\n",
strerror(ret));
}
+
+ ret2 = loop_cleanup(&mkop);
+ if (ret == 0)
+ ret = ret2;
int loop_cleanup(struct mkfs_opts *mop)
{
char cmd[150];
int loop_cleanup(struct mkfs_opts *mop)
{
char cmd[150];
if ((mop->mo_flags & MO_IS_LOOP) && *mop->mo_loopdev) {
if ((mop->mo_flags & MO_IS_LOOP) && *mop->mo_loopdev) {
sprintf(cmd, "losetup -d %s", mop->mo_loopdev);
sprintf(cmd, "losetup -d %s", mop->mo_loopdev);
- ret = run_command(cmd, sizeof(cmd));
+ for (tries = 0; tries < 3; tries++) {
+ ret = run_command(cmd, sizeof(cmd));
+ if (ret == 0)
+ break;
+ sleep(1);
+ }
+
+ if (ret != 0)
+ fprintf(stderr, "cannot cleanup %s: rc = %d\n",
+ mop->mo_loopdev, ret);
}
ret = fread(supp_features, 1, sizeof(supp_features) - 1, fp);
supp_features[ret] = '\0';
}
ret = fread(supp_features, 1, sizeof(supp_features) - 1, fp);
supp_features[ret] = '\0';
}
if (ret > 0 && strstr(supp_features,
strncmp(feature, "-O ", 3) ? feature : feature+3))
}
if (ret > 0 && strstr(supp_features,
strncmp(feature, "-O ", 3) ? feature : feature+3))
ret = fread(enabled_features, 1, sizeof(enabled_features) - 1, fp);
enabled_features[ret] = '\0';
ret = fread(enabled_features, 1, sizeof(enabled_features) - 1, fp);
enabled_features[ret] = '\0';
if (strstr(enabled_features, feature))
return 1;
if (strstr(enabled_features, feature))
return 1;