From 6778948f9de86c3cfaf36725a7c87dcff9ba247f Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Mon, 11 Dec 2023 08:20:59 +0000
Subject: [PATCH] kernel_5.10 no rt
---
kernel/mm/shmem.c | 31 ++++++++++++++-----------------
1 files changed, 14 insertions(+), 17 deletions(-)
diff --git a/kernel/mm/shmem.c b/kernel/mm/shmem.c
index 682a3e9..768c918 100644
--- a/kernel/mm/shmem.c
+++ b/kernel/mm/shmem.c
@@ -285,10 +285,10 @@
ino_t ino;
if (!(sb->s_flags & SB_KERNMOUNT)) {
- raw_spin_lock(&sbinfo->stat_lock);
+ spin_lock(&sbinfo->stat_lock);
if (sbinfo->max_inodes) {
if (!sbinfo->free_inodes) {
- raw_spin_unlock(&sbinfo->stat_lock);
+ spin_unlock(&sbinfo->stat_lock);
return -ENOSPC;
}
sbinfo->free_inodes--;
@@ -311,7 +311,7 @@
}
*inop = ino;
}
- raw_spin_unlock(&sbinfo->stat_lock);
+ spin_unlock(&sbinfo->stat_lock);
} else if (inop) {
/*
* __shmem_file_setup, one of our callers, is lock-free: it
@@ -326,14 +326,13 @@
* to worry about things like glibc compatibility.
*/
ino_t *next_ino;
-
next_ino = per_cpu_ptr(sbinfo->ino_batch, get_cpu());
ino = *next_ino;
if (unlikely(ino % SHMEM_INO_BATCH == 0)) {
- raw_spin_lock(&sbinfo->stat_lock);
+ spin_lock(&sbinfo->stat_lock);
ino = sbinfo->next_ino;
sbinfo->next_ino += SHMEM_INO_BATCH;
- raw_spin_unlock(&sbinfo->stat_lock);
+ spin_unlock(&sbinfo->stat_lock);
if (unlikely(is_zero_ino(ino)))
ino++;
}
@@ -349,9 +348,9 @@
{
struct shmem_sb_info *sbinfo = SHMEM_SB(sb);
if (sbinfo->max_inodes) {
- raw_spin_lock(&sbinfo->stat_lock);
+ spin_lock(&sbinfo->stat_lock);
sbinfo->free_inodes++;
- raw_spin_unlock(&sbinfo->stat_lock);
+ spin_unlock(&sbinfo->stat_lock);
}
}
@@ -1493,10 +1492,10 @@
{
struct mempolicy *mpol = NULL;
if (sbinfo->mpol) {
- raw_spin_lock(&sbinfo->stat_lock); /* prevent replace/use races */
+ spin_lock(&sbinfo->stat_lock); /* prevent replace/use races */
mpol = sbinfo->mpol;
mpol_get(mpol);
- raw_spin_unlock(&sbinfo->stat_lock);
+ spin_unlock(&sbinfo->stat_lock);
}
return mpol;
}
@@ -3563,10 +3562,9 @@
struct shmem_options *ctx = fc->fs_private;
struct shmem_sb_info *sbinfo = SHMEM_SB(fc->root->d_sb);
unsigned long inodes;
- struct mempolicy *mpol = NULL;
const char *err;
- raw_spin_lock(&sbinfo->stat_lock);
+ spin_lock(&sbinfo->stat_lock);
inodes = sbinfo->max_inodes - sbinfo->free_inodes;
if ((ctx->seen & SHMEM_SEEN_BLOCKS) && ctx->blocks) {
if (!sbinfo->max_blocks) {
@@ -3611,15 +3609,14 @@
* Preserve previous mempolicy unless mpol remount option was specified.
*/
if (ctx->mpol) {
- mpol = sbinfo->mpol;
+ mpol_put(sbinfo->mpol);
sbinfo->mpol = ctx->mpol; /* transfers initial ref */
ctx->mpol = NULL;
}
- raw_spin_unlock(&sbinfo->stat_lock);
- mpol_put(mpol);
+ spin_unlock(&sbinfo->stat_lock);
return 0;
out:
- raw_spin_unlock(&sbinfo->stat_lock);
+ spin_unlock(&sbinfo->stat_lock);
return invalfc(fc, "%s", err);
}
@@ -3736,7 +3733,7 @@
sbinfo->mpol = ctx->mpol;
ctx->mpol = NULL;
- raw_spin_lock_init(&sbinfo->stat_lock);
+ spin_lock_init(&sbinfo->stat_lock);
if (percpu_counter_init(&sbinfo->used_blocks, 0, GFP_KERNEL))
goto failed;
spin_lock_init(&sbinfo->shrinklist_lock);
--
Gitblit v1.6.2