diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-06-10 10:57:23 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-08-14 12:28:33 -0400 |
commit | e72b8a2fd7471248698d576ffadd1e84e94df839 (patch) | |
tree | c2434ed84ea4e24ce18ddf4247dc5f23bfc720d8 /fs/bcachefs/six.c | |
parent | 75563db56729f09af1167feae21f99bd3d237635 (diff) |
six locks: Disable percpu read lock mode in userspace
When running in userspace, we currently don't have a real percpu
implementation available - at least in bcachefs-tools, which is where
this code is currently used in userspace.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/six.c')
-rw-r--r-- | fs/bcachefs/six.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/bcachefs/six.c b/fs/bcachefs/six.c index 23d62874faf0..748003a6e5e0 100644 --- a/fs/bcachefs/six.c +++ b/fs/bcachefs/six.c @@ -870,6 +870,11 @@ void __six_lock_init(struct six_lock *lock, const char *name, lockdep_init_map(&lock->dep_map, name, key, 0); #endif + /* + * Don't assume that we have real percpu variables available in + * userspace: + */ +#ifdef __KERNEL__ if (flags & SIX_LOCK_INIT_PCPU) { /* * We don't return an error here on memory allocation failure @@ -880,5 +885,6 @@ void __six_lock_init(struct six_lock *lock, const char *name, */ lock->readers = alloc_percpu(unsigned); } +#endif } EXPORT_SYMBOL_GPL(__six_lock_init); |