All of lore.kernel.org
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [jlayton:ceph-fscache-iter 76/77] fs/ceph/addr.c:1356:20: warning: variable 'oldest' is uninitialized when used here
Date: Fri, 29 May 2020 09:39:28 +0800	[thread overview]
Message-ID: <202005290921.rFiQzyGD%lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 7177 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git ceph-fscache-iter
head:   ce11bedb85675dee88f70d28fc09cb5bca59c73e
commit: abd9e1c4c6c6d86ef46c1782a886b52f09d87ebb [76/77] ceph: convert writepage over to new helper
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 2d068e534f1671459e1b135852c1b3c10502e929)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        git checkout abd9e1c4c6c6d86ef46c1782a886b52f09d87ebb
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

fs/ceph/addr.c:203:7: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (fsreq->pos == 0)
^~~~~~~~~~~~~~~
fs/ceph/addr.c:225:17: note: uninitialized use occurs here
fsreq->error = err;
^~~
fs/ceph/addr.c:203:3: note: remove the 'if' if its condition is always true
if (fsreq->pos == 0)
^~~~~~~~~~~~~~~~~~~~
fs/ceph/addr.c:196:9: note: initialize the variable 'err' to silence this warning
int err;
^
= 0
>> fs/ceph/addr.c:1356:20: warning: variable 'oldest' is uninitialized when used here [-Wuninitialized]
if (snapc->seq > oldest->seq) {
^~~~~~
fs/ceph/addr.c:1344:43: note: initialize the variable 'oldest' to silence this warning
struct ceph_snap_context *snapc, *oldest;
^
= NULL
2 warnings generated.

vim +/oldest +1356 fs/ceph/addr.c

1d3576fd10f0d7 Sage Weil           2009-10-06  1324  
202f44c49a2159 Jeff Layton         2020-05-28  1325  /**
202f44c49a2159 Jeff Layton         2020-05-28  1326   * writeback_older_snapc - write back any writeable dirty context so we can
202f44c49a2159 Jeff Layton         2020-05-28  1327   * 			   dirty the page in a new one.
202f44c49a2159 Jeff Layton         2020-05-28  1328   * @inode: inode associated with page
202f44c49a2159 Jeff Layton         2020-05-28  1329   * @page:  page being dirtied
1d3576fd10f0d7 Sage Weil           2009-10-06  1330   */
202f44c49a2159 Jeff Layton         2020-05-28  1331  static int writeback_older_snapc(struct inode *inode, struct page *page)
1d3576fd10f0d7 Sage Weil           2009-10-06  1332  {
6c93df5db628e7 Yan, Zheng          2016-04-15  1333  	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
1d3576fd10f0d7 Sage Weil           2009-10-06  1334  	struct ceph_inode_info *ci = ceph_inode(inode);
1d3576fd10f0d7 Sage Weil           2009-10-06  1335  
52953d55917e45 Seraphime Kirkovski 2016-12-26  1336  	if (READ_ONCE(fsc->mount_state) == CEPH_MOUNT_SHUTDOWN) {
6c93df5db628e7 Yan, Zheng          2016-04-15  1337  		dout(" page %p forced umount\n", page);
6c93df5db628e7 Yan, Zheng          2016-04-15  1338  		unlock_page(page);
6c93df5db628e7 Yan, Zheng          2016-04-15  1339  		return -EIO;
6c93df5db628e7 Yan, Zheng          2016-04-15  1340  	}
6c93df5db628e7 Yan, Zheng          2016-04-15  1341  
202f44c49a2159 Jeff Layton         2020-05-28  1342  	for (;;) {
202f44c49a2159 Jeff Layton         2020-05-28  1343  		int r;
202f44c49a2159 Jeff Layton         2020-05-28  1344  		struct ceph_snap_context *snapc, *oldest;
202f44c49a2159 Jeff Layton         2020-05-28  1345  
1d3576fd10f0d7 Sage Weil           2009-10-06  1346  		wait_on_page_writeback(page);
1d3576fd10f0d7 Sage Weil           2009-10-06  1347  
61600ef8483924 Yan, Zheng          2012-05-28  1348  		snapc = page_snap_context(page);
202f44c49a2159 Jeff Layton         2020-05-28  1349  		if (!snapc || snapc == ci->i_head_snapc)
202f44c49a2159 Jeff Layton         2020-05-28  1350  			break;
202f44c49a2159 Jeff Layton         2020-05-28  1351  
1d3576fd10f0d7 Sage Weil           2009-10-06  1352  		/*
1d3576fd10f0d7 Sage Weil           2009-10-06  1353  		 * this page is already dirty in another (older) snap
1d3576fd10f0d7 Sage Weil           2009-10-06  1354  		 * context!  is it writeable now?
1d3576fd10f0d7 Sage Weil           2009-10-06  1355  		 */
80e755fedebc8d Sage Weil           2010-03-31 @1356  		if (snapc->seq > oldest->seq) {
6298a33757ba73 Sage Weil           2010-03-31  1357  			ceph_put_snap_context(oldest);
1d3576fd10f0d7 Sage Weil           2009-10-06  1358  			dout(" page %p snapc %p not current or oldest\n",
6298a33757ba73 Sage Weil           2010-03-31  1359  			     page, snapc);
1d3576fd10f0d7 Sage Weil           2009-10-06  1360  			/*
1d3576fd10f0d7 Sage Weil           2009-10-06  1361  			 * queue for writeback, and wait for snapc to
1d3576fd10f0d7 Sage Weil           2009-10-06  1362  			 * be writeable or written
1d3576fd10f0d7 Sage Weil           2009-10-06  1363  			 */
6298a33757ba73 Sage Weil           2010-03-31  1364  			snapc = ceph_get_snap_context(snapc);
3c6f6b79a64db7 Sage Weil           2010-02-09  1365  			ceph_queue_writeback(inode);
a78bbd4b29c297 Yan, Zheng          2016-05-13  1366  			r = wait_event_killable(ci->i_cap_wq,
1d3576fd10f0d7 Sage Weil           2009-10-06  1367  			       context_is_writeable_or_written(inode, snapc));
1d3576fd10f0d7 Sage Weil           2009-10-06  1368  			ceph_put_snap_context(snapc);
202f44c49a2159 Jeff Layton         2020-05-28  1369  			return r == -ERESTARTSYS ? r : -EAGAIN;
1d3576fd10f0d7 Sage Weil           2009-10-06  1370  		}
6298a33757ba73 Sage Weil           2010-03-31  1371  		ceph_put_snap_context(oldest);
1d3576fd10f0d7 Sage Weil           2009-10-06  1372  
1d3576fd10f0d7 Sage Weil           2009-10-06  1373  		/* yay, writeable, do it now (without dropping page lock) */
1d3576fd10f0d7 Sage Weil           2009-10-06  1374  		dout(" page %p snapc %p not current, but oldest\n",
1d3576fd10f0d7 Sage Weil           2009-10-06  1375  		     page, snapc);
202f44c49a2159 Jeff Layton         2020-05-28  1376  		if (clear_page_dirty_for_io(page)) {
1d3576fd10f0d7 Sage Weil           2009-10-06  1377  			r = writepage_nounlock(page, NULL);
1d3576fd10f0d7 Sage Weil           2009-10-06  1378  			if (r < 0)
202f44c49a2159 Jeff Layton         2020-05-28  1379  				return r;
202f44c49a2159 Jeff Layton         2020-05-28  1380  		}
202f44c49a2159 Jeff Layton         2020-05-28  1381  	}
202f44c49a2159 Jeff Layton         2020-05-28  1382  	return 0;
1d3576fd10f0d7 Sage Weil           2009-10-06  1383  }
1d3576fd10f0d7 Sage Weil           2009-10-06  1384  

:::::: The code@line 1356 was first introduced by commit
:::::: 80e755fedebc8de0599a79efad2c656503df2e62 ceph: allow writeback of snapped pages older than 'oldest' snapc

:::::: TO: Sage Weil <sage@newdream.net>
:::::: CC: Sage Weil <sage@newdream.net>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 73534 bytes --]

                 reply	other threads:[~2020-05-29  1:39 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=202005290921.rFiQzyGD%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.