]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Revert "NFSv4: Fix callback server shutdown"
authorDhaval Giani <dhaval.giani@oracle.com>
Wed, 26 Jul 2017 17:16:50 +0000 (13:16 -0400)
committerDhaval Giani <dhaval.giani@oracle.com>
Wed, 26 Jul 2017 17:16:50 +0000 (13:16 -0400)
This reverts commit 13757272bec28f1b8be59f56292e8f17076923b3.

Orabug: 26479081
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
Reviewed-by: Brian Maly <brian.maly@oracle.com>
fs/nfs/callback.c
include/linux/sunrpc/svc.h
net/sunrpc/svc.c

index 8481d457c36da53bc4e7d2d22410dcc7c99b5a90..df57bdcb4d5057b273b8f3387b8e391154fb6420 100644 (file)
@@ -77,10 +77,7 @@ nfs4_callback_svc(void *vrqstp)
 
        set_freezable();
 
-       while (!kthread_freezable_should_stop(NULL)) {
-
-               if (signal_pending(current))
-                       flush_signals(current);
+       while (!kthread_should_stop()) {
                /*
                 * Listen for a request on the socket
                 */
@@ -89,8 +86,6 @@ nfs4_callback_svc(void *vrqstp)
                        continue;
                svc_process(rqstp);
        }
-       svc_exit_thread(rqstp);
-       module_put_and_exit(0);
        return 0;
 }
 
@@ -136,10 +131,9 @@ nfs41_callback_svc(void *vrqstp)
 
        set_freezable();
 
-       while (!kthread_freezable_should_stop(NULL)) {
-
-               if (signal_pending(current))
-                       flush_signals(current);
+       while (!kthread_should_stop()) {
+               if (try_to_freeze())
+                       continue;
 
                prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_INTERRUPTIBLE);
                spin_lock_bh(&serv->sv_cb_lock);
@@ -155,13 +149,11 @@ nfs41_callback_svc(void *vrqstp)
                                error);
                } else {
                        spin_unlock_bh(&serv->sv_cb_lock);
-                       if (!kthread_should_stop())
-                               schedule();
+                       schedule();
                        finish_wait(&serv->sv_cb_waitq, &wq);
                }
+               flush_signals(current);
        }
-       svc_exit_thread(rqstp);
-       module_put_and_exit(0);
        return 0;
 }
 
index 1e1a55c71036655edc6e37a69a223ab193c46d74..fae6fb947fc8671e238d4db1d9acd6ff9b59098a 100644 (file)
@@ -437,7 +437,6 @@ struct svc_serv *  svc_create_pooled(struct svc_program *, unsigned int,
                        void (*shutdown)(struct svc_serv *, struct net *net),
                        svc_thread_fn, struct module *);
 int               svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);
-int               svc_set_num_threads_sync(struct svc_serv *, struct svc_pool *, int);
 int               svc_pool_stats_open(struct svc_serv *serv, struct file *file);
 void              svc_destroy(struct svc_serv *);
 void              svc_shutdown_net(struct svc_serv *, struct net *);
index b9a699ca38948e3f5c210f7d11faa1e1a3548b4e..ec97d7985859b2bed89ba61e45197bc49f35c83f 100644 (file)
@@ -787,44 +787,6 @@ svc_set_num_threads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
 }
 EXPORT_SYMBOL_GPL(svc_set_num_threads);
 
-/* destroy old threads */
-static int
-svc_stop_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
-{
-       struct task_struct *task;
-       unsigned int state = serv->sv_nrthreads-1;
-
-       /* destroy old threads */
-       do {
-               task = choose_victim(serv, pool, &state);
-               if (task == NULL)
-                       break;
-               kthread_stop(task);
-               nrservs++;
-       } while (nrservs < 0);
-       return 0;
-}
-
-int
-svc_set_num_threads_sync(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
-{
-       if (pool == NULL) {
-               /* The -1 assumes caller has done a svc_get() */
-               nrservs -= (serv->sv_nrthreads-1);
-       } else {
-               spin_lock_bh(&pool->sp_lock);
-               nrservs -= pool->sp_nrthreads;
-               spin_unlock_bh(&pool->sp_lock);
-       }
-
-       if (nrservs > 0)
-               return svc_start_kthreads(serv, pool, nrservs);
-       if (nrservs < 0)
-               return svc_stop_kthreads(serv, pool, nrservs);
-       return 0;
-}
-EXPORT_SYMBOL_GPL(svc_set_num_threads_sync);
-
 /*
  * Called from a server thread as it's exiting. Caller must hold the "service
  * mutex" for the service.