public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@01.org, David Howells <dhowells@redhat.com>
Cc: kbuild-all@01.org, linux-fsdevel@vger.kernel.org
Subject: [vfs:uncertain.shmem 18/18] mm/shmem.c:3577 shmem_reconfigure() warn: inconsistent returns 'spin_lock:&sbinfo->stat_lock'.
Date: Mon, 16 Sep 2019 09:16:30 +0300	[thread overview]
Message-ID: <20190916061630.GX20699@kadam> (raw)

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@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

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

                 reply	other threads:[~2019-09-16  6:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190916061630.GX20699@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=dhowells@redhat.com \
    --cc=kbuild-all@01.org \
    --cc=kbuild@01.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox