fs: dlm: use dlm_recovery_stopped in condition
authorAlexander Aring <aahringo@redhat.com>
Tue, 2 Nov 2021 19:17:13 +0000 (15:17 -0400)
committerDavid Teigland <teigland@redhat.com>
Tue, 2 Nov 2021 19:39:20 +0000 (14:39 -0500)
This patch will change to evaluate the dlm_recovery_stopped() in the
condition of the if branch instead fetch it before evaluating the
condition. As this is an atomic test-set operation it should be
evaluated in the condition itself.

Reported-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
fs/dlm/dir.c
fs/dlm/member.c
fs/dlm/recoverd.c

index 45ebbe602bbf043d1c0ec9953d63192afd7a0537..b6692f81ec83eacfe00924422a69a4cc2798a111 100644 (file)
@@ -84,8 +84,7 @@ int dlm_recover_directory(struct dlm_ls *ls)
 
                for (;;) {
                        int left;
-                       error = dlm_recovery_stopped(ls);
-                       if (error) {
+                       if (dlm_recovery_stopped(ls)) {
                                error = -EINTR;
                                goto out_free;
                        }
index 731d489aa323ed736e006d3015b32133c3e93b0c..61f906e705db8aac3300cef0480283963d5bf600 100644 (file)
@@ -442,8 +442,7 @@ static int ping_members(struct dlm_ls *ls)
        int error = 0;
 
        list_for_each_entry(memb, &ls->ls_nodes, list) {
-               error = dlm_recovery_stopped(ls);
-               if (error) {
+               if (dlm_recovery_stopped(ls)) {
                        error = -EINTR;
                        break;
                }
index 97d052cea5a924e4b4efb0e66329aeaf7b8c8c74..a55dfce705dd264b78d0dc8df352517c993f4a14 100644 (file)
@@ -124,8 +124,7 @@ static int ls_recover(struct dlm_ls *ls, struct dlm_recover *rv)
 
        dlm_recover_waiters_pre(ls);
 
-       error = dlm_recovery_stopped(ls);
-       if (error) {
+       if (dlm_recovery_stopped(ls)) {
                error = -EINTR;
                goto fail;
        }