Whamcloud - gitweb
LU-9859 libcfs: simplify linux-prim.c 10/35410/6
authorNeilBrown <neilb@suse.com>
Thu, 12 Dec 2019 17:28:40 +0000 (12:28 -0500)
committerOleg Drokin <green@whamcloud.com>
Sun, 1 Mar 2020 05:35:19 +0000 (05:35 +0000)
cfs_block_sigs() is never used.
cfs_clear_sigpending() is only used in lustre_lib.h so move it
to that header. Based on

Linux-commit: 99c1ffc99a570c68cef906d9763edb47b316ea1a

Change-Id: Ia0d5ecb736c4107c5a7b666bda85714d6819fbca
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-on: https://review.whamcloud.com/35410
Reviewed-by: Neil Brown <neilb@suse.de>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/include/libcfs/libcfs.h
libcfs/include/libcfs/linux/linux-wait.h
libcfs/libcfs/linux/linux-prim.c
lustre/include/lustre_lib.h

index bf71718..23174a9 100644 (file)
@@ -108,10 +108,8 @@ static inline int notifier_from_ioctl_errno(int err)
  * Defined by platform
  */
 int unshare_fs_struct(void);
-sigset_t cfs_block_sigs(unsigned long sigs);
 sigset_t cfs_block_sigsinv(unsigned long sigs);
 void cfs_restore_sigs(sigset_t);
-void cfs_clear_sigpending(void);
 
 int libcfs_ioctl_data_adjust(struct libcfs_ioctl_data *data);
 
index ec72376..d3fbf60 100644 (file)
@@ -206,6 +206,7 @@ __out:      __ret;                                                          \
 #define ___wait_event_idle(wq_head, condition, exclusive, ret, cmd)    \
 ({                                                                     \
        wait_queue_entry_t __wq_entry;                                  \
+       unsigned long flags;                                            \
        long __ret = ret;       /* explicit shadow */                   \
        sigset_t __blocked;                                             \
                                                                        \
@@ -221,9 +222,13 @@ __out:     __ret;                                                          \
                if (condition)                                          \
                        break;                                          \
                /* See justification in __l_wait_event */               \
-               if (signal_pending(current))                            \
-                       cfs_clear_sigpending();                         \
-                                                                       \
+               if (signal_pending(current)) {                          \
+                       spin_lock_irqsave(&current->sighand->siglock,   \
+                                         flags);                       \
+                       clear_tsk_thread_flag(current, TIF_SIGPENDING); \
+                       spin_unlock_irqrestore(&current->sighand->siglock,\
+                                              flags);                  \
+               }                                                       \
                cmd;                                                    \
        }                                                               \
        finish_wait(&wq_head, &__wq_entry);                             \
@@ -462,6 +467,7 @@ do {                                                                        \
 #define ___wait_event_lifo(wq_head, condition, ret, cmd)               \
 ({                                                                     \
        wait_queue_entry_t __wq_entry;                                  \
+       unsigned long flags;                                            \
        long __ret = ret;       /* explicit shadow */                   \
        sigset_t __blocked;                                             \
                                                                        \
@@ -476,9 +482,13 @@ do {                                                                       \
                if (condition)                                          \
                        break;                                          \
                /* See justification in __l_wait_event */               \
-               if (signal_pending(current))                            \
-                       cfs_clear_sigpending();                         \
-                                                                       \
+               if (signal_pending(current)) {                          \
+                       spin_lock_irqsave(&current->sighand->siglock,   \
+                                         flags);                       \
+                       clear_tsk_thread_flag(current, TIF_SIGPENDING); \
+                       spin_unlock_irqrestore(&current->sighand->siglock,\
+                                              flags);                  \
+               }                                                       \
                cmd;                                                    \
        }                                                               \
        cfs_restore_sigs(__blocked);                                    \
index 1f29c52..8a1c50a 100644 (file)
@@ -194,20 +194,6 @@ int kstrtobool_from_user(const char __user *s, size_t count, bool *res)
 EXPORT_SYMBOL(kstrtobool_from_user);
 #endif /* !HAVE_KSTRTOBOOL_FROM_USER */
 
-sigset_t cfs_block_sigs(unsigned long sigs)
-{
-       unsigned long  flags;
-       sigset_t        old;
-
-       spin_lock_irqsave(&current->sighand->siglock, flags);
-       old = current->blocked;
-       sigaddsetmask(&current->blocked, sigs);
-       recalc_sigpending();
-       spin_unlock_irqrestore(&current->sighand->siglock, flags);
-       return old;
-}
-EXPORT_SYMBOL(cfs_block_sigs);
-
 /* Block all signals except for the @sigs */
 sigset_t cfs_block_sigsinv(unsigned long sigs)
 {
@@ -234,14 +220,3 @@ cfs_restore_sigs(sigset_t old)
        spin_unlock_irqrestore(&current->sighand->siglock, flags);
 }
 EXPORT_SYMBOL(cfs_restore_sigs);
-
-void
-cfs_clear_sigpending(void)
-{
-       unsigned long flags;
-
-       spin_lock_irqsave(&current->sighand->siglock, flags);
-       clear_tsk_thread_flag(current, TIF_SIGPENDING);
-       spin_unlock_irqrestore(&current->sighand->siglock, flags);
-}
-EXPORT_SYMBOL(cfs_clear_sigpending);
index a8ac55a..6be8a40 100644 (file)
@@ -312,6 +312,8 @@ do {                                                                           \
                 if (condition)                                                 \
                         break;                                                 \
                if (signal_pending(current)) {                                 \
+                       unsigned long flags;                                   \
+                                                                              \
                         if (info->lwi_on_signal != NULL &&                     \
                             (__timeout == 0 || __allow_intr)) {                \
                                 if (info->lwi_on_signal != LWI_ON_SIGNAL_NOOP) \
@@ -326,7 +328,9 @@ do {                                                                           \
                        /* -EINTR when the RPC actually succeeded.      */     \
                        /* the recalc_sigpending() below will deliver the */   \
                        /* signal properly.                             */     \
-                       cfs_clear_sigpending();                                \
+                       spin_lock_irqsave(&current->sighand->siglock, flags);  \
+                       clear_tsk_thread_flag(current, TIF_SIGPENDING);        \
+                       spin_unlock_irqrestore(&current->sighand->siglock, flags);\
                 }                                                              \
         }                                                                      \
                                                                                \