2018-10-03 03:43:43

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH] SUNRPC: use cmpxchg64() in gss_seq_send64_fetch_and_inc()

The newly introduced gss_seq_send64_fetch_and_inc() fails to build on
32-bit architectures:

net/sunrpc/auth_gss/gss_krb5_seal.c:144:14: note: in expansion of macro 'cmpxchg'
seq_send = cmpxchg(&ctx->seq_send64, old, old + 1);
^~~~~~~
arch/x86/include/asm/cmpxchg.h:128:3: error: call to '__cmpxchg_wrong_size' declared with attribute error: Bad argument size for cmpxchg
__cmpxchg_wrong_size(); \

As the message tells us, cmpxchg() cannot be used on 64-bit arguments,
that's what cmpxchg64() does.

Fixes: 571ed1fd2390 ("SUNRPC: Replace krb5_seq_lock with a lockless scheme")
Signed-off-by: Arnd Bergmann <[email protected]>
---
net/sunrpc/auth_gss/gss_krb5_seal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sunrpc/auth_gss/gss_krb5_seal.c b/net/sunrpc/auth_gss/gss_krb5_seal.c
index 92594681d619..5775b9805bdc 100644
--- a/net/sunrpc/auth_gss/gss_krb5_seal.c
+++ b/net/sunrpc/auth_gss/gss_krb5_seal.c
@@ -141,7 +141,7 @@ gss_seq_send64_fetch_and_inc(struct krb5_ctx *ctx)

do {
old = seq_send;
- seq_send = cmpxchg(&ctx->seq_send64, old, old + 1);
+ seq_send = cmpxchg64(&ctx->seq_send64, old, old + 1);
} while (old != seq_send);
return seq_send;
}
--
2.18.0


2018-10-05 20:35:08

by Trond Myklebust

[permalink] [raw]
Subject: Re: [PATCH] SUNRPC: use cmpxchg64() in gss_seq_send64_fetch_and_inc()

T24gVHVlLCAyMDE4LTEwLTAyIGF0IDIyOjU3ICswMjAwLCBBcm5kIEJlcmdtYW5uIHdyb3RlOg0K
PiBUaGUgbmV3bHkgaW50cm9kdWNlZCBnc3Nfc2VxX3NlbmQ2NF9mZXRjaF9hbmRfaW5jKCkgZmFp
bHMgdG8gYnVpbGQgb24NCj4gMzItYml0IGF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