hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/mm/shmem.c
....@@ -285,10 +285,10 @@
285285 ino_t ino;
286286
287287 if (!(sb->s_flags & SB_KERNMOUNT)) {
288
- raw_spin_lock(&sbinfo->stat_lock);
288
+ spin_lock(&sbinfo->stat_lock);
289289 if (sbinfo->max_inodes) {
290290 if (!sbinfo->free_inodes) {
291
- raw_spin_unlock(&sbinfo->stat_lock);
291
+ spin_unlock(&sbinfo->stat_lock);
292292 return -ENOSPC;
293293 }
294294 sbinfo->free_inodes--;
....@@ -311,7 +311,7 @@
311311 }
312312 *inop = ino;
313313 }
314
- raw_spin_unlock(&sbinfo->stat_lock);
314
+ spin_unlock(&sbinfo->stat_lock);
315315 } else if (inop) {
316316 /*
317317 * __shmem_file_setup, one of our callers, is lock-free: it
....@@ -326,14 +326,13 @@
326326 * to worry about things like glibc compatibility.
327327 */
328328 ino_t *next_ino;
329
-
330329 next_ino = per_cpu_ptr(sbinfo->ino_batch, get_cpu());
331330 ino = *next_ino;
332331 if (unlikely(ino % SHMEM_INO_BATCH == 0)) {
333
- raw_spin_lock(&sbinfo->stat_lock);
332
+ spin_lock(&sbinfo->stat_lock);
334333 ino = sbinfo->next_ino;
335334 sbinfo->next_ino += SHMEM_INO_BATCH;
336
- raw_spin_unlock(&sbinfo->stat_lock);
335
+ spin_unlock(&sbinfo->stat_lock);
337336 if (unlikely(is_zero_ino(ino)))
338337 ino++;
339338 }
....@@ -349,9 +348,9 @@
349348 {
350349 struct shmem_sb_info *sbinfo = SHMEM_SB(sb);
351350 if (sbinfo->max_inodes) {
352
- raw_spin_lock(&sbinfo->stat_lock);
351
+ spin_lock(&sbinfo->stat_lock);
353352 sbinfo->free_inodes++;
354
- raw_spin_unlock(&sbinfo->stat_lock);
353
+ spin_unlock(&sbinfo->stat_lock);
355354 }
356355 }
357356
....@@ -1493,10 +1492,10 @@
14931492 {
14941493 struct mempolicy *mpol = NULL;
14951494 if (sbinfo->mpol) {
1496
- raw_spin_lock(&sbinfo->stat_lock); /* prevent replace/use races */
1495
+ spin_lock(&sbinfo->stat_lock); /* prevent replace/use races */
14971496 mpol = sbinfo->mpol;
14981497 mpol_get(mpol);
1499
- raw_spin_unlock(&sbinfo->stat_lock);
1498
+ spin_unlock(&sbinfo->stat_lock);
15001499 }
15011500 return mpol;
15021501 }
....@@ -3563,10 +3562,9 @@
35633562 struct shmem_options *ctx = fc->fs_private;
35643563 struct shmem_sb_info *sbinfo = SHMEM_SB(fc->root->d_sb);
35653564 unsigned long inodes;
3566
- struct mempolicy *mpol = NULL;
35673565 const char *err;
35683566
3569
- raw_spin_lock(&sbinfo->stat_lock);
3567
+ spin_lock(&sbinfo->stat_lock);
35703568 inodes = sbinfo->max_inodes - sbinfo->free_inodes;
35713569 if ((ctx->seen & SHMEM_SEEN_BLOCKS) && ctx->blocks) {
35723570 if (!sbinfo->max_blocks) {
....@@ -3611,15 +3609,14 @@
36113609 * Preserve previous mempolicy unless mpol remount option was specified.
36123610 */
36133611 if (ctx->mpol) {
3614
- mpol = sbinfo->mpol;
3612
+ mpol_put(sbinfo->mpol);
36153613 sbinfo->mpol = ctx->mpol; /* transfers initial ref */
36163614 ctx->mpol = NULL;
36173615 }
3618
- raw_spin_unlock(&sbinfo->stat_lock);
3619
- mpol_put(mpol);
3616
+ spin_unlock(&sbinfo->stat_lock);
36203617 return 0;
36213618 out:
3622
- raw_spin_unlock(&sbinfo->stat_lock);
3619
+ spin_unlock(&sbinfo->stat_lock);
36233620 return invalfc(fc, "%s", err);
36243621 }
36253622
....@@ -3736,7 +3733,7 @@
37363733 sbinfo->mpol = ctx->mpol;
37373734 ctx->mpol = NULL;
37383735
3739
- raw_spin_lock_init(&sbinfo->stat_lock);
3736
+ spin_lock_init(&sbinfo->stat_lock);
37403737 if (percpu_counter_init(&sbinfo->used_blocks, 0, GFP_KERNEL))
37413738 goto failed;
37423739 spin_lock_init(&sbinfo->shrinklist_lock);