From d0ca764a1a9116238f64f4f6e1ded116d5d28ed0 Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Mon, 26 Aug 2019 14:42:17 +1000 Subject: [PATCH] LU-10467 lustre: don't use l_wait_event() for poll loops. When polling without any usable wait queue, it is clearest to have an explicit poll loop. So don't use l_wait_event() in these two cases, but use a while loop with ssleep(1); Signed-off-by: Mr NeilBrown Change-Id: Ic6a203085699fb9802d32871479c822ebe3c2510 Reviewed-on: https://review.whamcloud.com/35968 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Shaun Tancheff Reviewed-by: Petros Koutoupis Reviewed-by: Oleg Drokin --- lustre/llite/llite_lib.c | 14 ++++++++------ lustre/lov/lov_request.c | 15 ++++++++------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 933b77a..e537be6 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -45,6 +45,7 @@ #include #include #include +#include #ifdef HAVE_UIDGID_HEADER # include #endif @@ -2397,8 +2398,7 @@ void ll_umount_begin(struct super_block *sb) struct ll_sb_info *sbi = ll_s2sbi(sb); struct obd_device *obd; struct obd_ioctl_data *ioc_data; - struct l_wait_info lwi; - wait_queue_head_t waitq; + int cnt; ENTRY; CDEBUG(D_VFSTRACE, "VFS Op: superblock %p count %d active %d\n", sb, @@ -2437,10 +2437,12 @@ void ll_umount_begin(struct super_block *sb) * and then continue. For now, we just periodically checking for vfs * to decrement mnt_cnt and hope to finish it within 10sec. */ - init_waitqueue_head(&waitq); - lwi = LWI_TIMEOUT_INTERVAL(cfs_time_seconds(10), - cfs_time_seconds(1), NULL, NULL); - l_wait_event(waitq, may_umount(sbi->ll_mnt.mnt), &lwi); + cnt = 10; + while (cnt > 0 && + !may_umount(sbi->ll_mnt.mnt)) { + ssleep(1); + cnt -= 1; + } EXIT; } diff --git a/lustre/lov/lov_request.c b/lustre/lov/lov_request.c index 75e5c90..f69383e 100644 --- a/lustre/lov/lov_request.c +++ b/lustre/lov/lov_request.c @@ -32,6 +32,7 @@ #define DEBUG_SUBSYSTEM S_LOV +#include #include #include @@ -105,11 +106,10 @@ static int lov_check_set(struct lov_obd *lov, int idx) */ static int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx) { - wait_queue_head_t waitq; - struct l_wait_info lwi; struct lov_tgt_desc *tgt; struct obd_import *imp = NULL; int rc = 0; + int cnt; mutex_lock(&lov->lov_lock); @@ -130,11 +130,12 @@ static int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx) mutex_unlock(&lov->lov_lock); - init_waitqueue_head(&waitq); - lwi = LWI_TIMEOUT_INTERVAL(cfs_time_seconds(obd_timeout), - cfs_time_seconds(1), NULL, NULL); - - rc = l_wait_event(waitq, lov_check_set(lov, ost_idx), &lwi); + cnt = obd_timeout; + while (cnt > 0 && + !lov_check_set(lov, ost_idx)) { + ssleep(1); + cnt -= 1; + } if (tgt->ltd_active) return 1; -- 1.8.3.1