Whamcloud - gitweb
LU-10467 lustre: don't use l_wait_event() for poll loops. 68/35968/6
authorMr NeilBrown <neilb@suse.com>
Mon, 26 Aug 2019 04:42:17 +0000 (14:42 +1000)
committerOleg Drokin <green@whamcloud.com>
Fri, 6 Dec 2019 00:58:05 +0000 (00:58 +0000)
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 <neilb@suse.com>
Change-Id: Ic6a203085699fb9802d32871479c822ebe3c2510
Reviewed-on: https://review.whamcloud.com/35968
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Shaun Tancheff <stancheff@cray.com>
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/llite_lib.c
lustre/lov/lov_request.c

index 933b77a..e537be6 100644 (file)
@@ -45,6 +45,7 @@
 #include <linux/version.h>
 #include <linux/mm.h>
 #include <linux/user_namespace.h>
+#include <linux/delay.h>
 #ifdef HAVE_UIDGID_HEADER
 # include <linux/uidgid.h>
 #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;
 }
index 75e5c90..f69383e 100644 (file)
@@ -32,6 +32,7 @@
 
 #define DEBUG_SUBSYSTEM S_LOV
 
+#include <linux/delay.h>
 #include <libcfs/libcfs.h>
 
 #include <obd_class.h>
@@ -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;