tree: https://kernel.googlesource.com/pub/scm/linux/kernel/git/viro/vfs.git uncertain.shmem head: dc28c12a0e98f33ed0923135cfb5136caaa2e92d commit: dc28c12a0e98f33ed0923135cfb5136caaa2e92d [18/18] vfs: Convert ramfs, shmem, tmpfs, devtmpfs, rootfs to use the new mount API If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@xxxxxxxxx> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> smatch warnings: mm/shmem.c:3577 shmem_reconfigure() warn: inconsistent returns 'spin_lock:&sbinfo->stat_lock'. Locked on: line 3577 Unlocked on: line 3575 git remote add vfs https://kernel.googlesource.com/pub/scm/linux/kernel/git/viro/vfs.git git remote update vfs git checkout dc28c12a0e98f33ed0923135cfb5136caaa2e92d vim +3577 mm/shmem.c dc28c12a0e98f3 David Howells 2019-03-25 3526 static int shmem_reconfigure(struct fs_context *fc) ^1da177e4c3f41 Linus Torvalds 2005-04-16 3527 { dc28c12a0e98f3 David Howells 2019-03-25 3528 struct shmem_options *ctx = fc->fs_private; dc28c12a0e98f3 David Howells 2019-03-25 3529 struct shmem_sb_info *sbinfo = SHMEM_SB(fc->root->d_sb); 0edd73b33426df Hugh Dickins 2005-06-21 3530 unsigned long inodes; dc28c12a0e98f3 David Howells 2019-03-25 3531 const char *err; ^1da177e4c3f41 Linus Torvalds 2005-04-16 3532 0edd73b33426df Hugh Dickins 2005-06-21 3533 spin_lock(&sbinfo->stat_lock); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0edd73b33426df Hugh Dickins 2005-06-21 3534 inodes = sbinfo->max_inodes - sbinfo->free_inodes; dc28c12a0e98f3 David Howells 2019-03-25 3535 if (ctx->seen & SHMEM_SEEN_BLOCKS) { 1054087b0658a7 Al Viro 2019-09-08 3536 if (percpu_counter_compare(&sbinfo->used_blocks, dc28c12a0e98f3 David Howells 2019-03-25 3537 ctx->blocks) > 0) { dc28c12a0e98f3 David Howells 2019-03-25 3538 err = "Too small a size for current use"; 0edd73b33426df Hugh Dickins 2005-06-21 3539 goto out; ^^^^^^^^^ dc28c12a0e98f3 David Howells 2019-03-25 3540 } dc28c12a0e98f3 David Howells 2019-03-25 3541 if (ctx->blocks && !sbinfo->max_blocks) { dc28c12a0e98f3 David Howells 2019-03-25 3542 err = "Cannot retroactively limit nr_blocks"; 1054087b0658a7 Al Viro 2019-09-08 3543 goto out; 1054087b0658a7 Al Viro 2019-09-08 3544 } dc28c12a0e98f3 David Howells 2019-03-25 3545 } dc28c12a0e98f3 David Howells 2019-03-25 3546 if (ctx->seen & SHMEM_SEEN_INODES) { dc28c12a0e98f3 David Howells 2019-03-25 3547 if (ctx->inodes < inodes) { dc28c12a0e98f3 David Howells 2019-03-25 3548 err = "Too few inodes for current use"; 0edd73b33426df Hugh Dickins 2005-06-21 3549 goto out; dc28c12a0e98f3 David Howells 2019-03-25 3550 } dc28c12a0e98f3 David Howells 2019-03-25 3551 if (ctx->inodes && !sbinfo->max_inodes) { dc28c12a0e98f3 David Howells 2019-03-25 3552 err = "Cannot retroactively limit nr_inodes"; 1054087b0658a7 Al Viro 2019-09-08 3553 goto out; 1054087b0658a7 Al Viro 2019-09-08 3554 } dc28c12a0e98f3 David Howells 2019-03-25 3555 } 0edd73b33426df Hugh Dickins 2005-06-21 3556 dc28c12a0e98f3 David Howells 2019-03-25 3557 if (ctx->seen & SHMEM_SEEN_HUGE) dc28c12a0e98f3 David Howells 2019-03-25 3558 sbinfo->huge = ctx->huge; dc28c12a0e98f3 David Howells 2019-03-25 3559 if (ctx->seen & SHMEM_SEEN_BLOCKS) dc28c12a0e98f3 David Howells 2019-03-25 3560 sbinfo->max_blocks = ctx->blocks; dc28c12a0e98f3 David Howells 2019-03-25 3561 if (ctx->seen & SHMEM_SEEN_INODES) { dc28c12a0e98f3 David Howells 2019-03-25 3562 sbinfo->max_inodes = ctx->inodes; dc28c12a0e98f3 David Howells 2019-03-25 3563 sbinfo->free_inodes = ctx->inodes - inodes; 1054087b0658a7 Al Viro 2019-09-08 3564 } 71fe804b6d56d6 Lee Schermerhorn 2008-04-28 3565 5f00110f7273f9 Greg Thelen 2013-02-22 3566 /* 5f00110f7273f9 Greg Thelen 2013-02-22 3567 * Preserve previous mempolicy unless mpol remount option was specified. 5f00110f7273f9 Greg Thelen 2013-02-22 3568 */ dc28c12a0e98f3 David Howells 2019-03-25 3569 if (ctx->mpol) { 71fe804b6d56d6 Lee Schermerhorn 2008-04-28 3570 mpol_put(sbinfo->mpol); dc28c12a0e98f3 David Howells 2019-03-25 3571 sbinfo->mpol = ctx->mpol; /* transfers initial ref */ dc28c12a0e98f3 David Howells 2019-03-25 3572 ctx->mpol = NULL; 5f00110f7273f9 Greg Thelen 2013-02-22 3573 } 0edd73b33426df Hugh Dickins 2005-06-21 3574 spin_unlock(&sbinfo->stat_lock); dc28c12a0e98f3 David Howells 2019-03-25 3575 return 0; dc28c12a0e98f3 David Howells 2019-03-25 3576 out: dc28c12a0e98f3 David Howells 2019-03-25 @3577 return invalf(fc, "tmpfs: %s", err); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Need to unlock before returning. ^1da177e4c3f41 Linus Torvalds 2005-04-16 3578 } 680d794babebc7 Andrew Morton 2008-02-08 3579 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation