fs: dlm: use READ_ONCE for config var
authorAlexander Aring <aahringo@redhat.com>
Fri, 16 Jul 2021 20:22:35 +0000 (16:22 -0400)
committerDavid Teigland <teigland@redhat.com>
Mon, 19 Jul 2021 16:53:43 +0000 (11:53 -0500)
This patch will use READ_ONCE to signal the compiler to read this
variable only one time. If we don't do that it could be that the
compiler read this value more than one time, because some optimizations,
from the configure data which might can be changed during this time.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
fs/dlm/lockspace.c

index d71aba8..23c2d73 100644 (file)
@@ -498,7 +498,7 @@ static int new_lockspace(const char *name, const char *cluster,
        ls->ls_exflags = (flags & ~(DLM_LSFL_TIMEWARN | DLM_LSFL_FS |
                                    DLM_LSFL_NEWEXCL));
 
-       size = dlm_config.ci_rsbtbl_size;
+       size = READ_ONCE(dlm_config.ci_rsbtbl_size);
        ls->ls_rsbtbl_size = size;
 
        ls->ls_rsbtbl = vmalloc(array_size(size, sizeof(struct dlm_rsbtable)));