linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Zhang Yi <yi.zhang@huawei.com>, linux-ext4@vger.kernel.org
Cc: kbuild-all@lists.01.org, tytso@mit.edu, adilger.kernel@dilger.ca,
	jack@suse.cz, yi.zhang@huawei.com, yukuai3@huawei.com
Subject: Re: [PATCH 3/3] ext4: add rcu to prevent use after free when umount filesystem
Date: Thu, 8 Apr 2021 21:51:08 +0800	[thread overview]
Message-ID: <202104082149.ogXZW0AV-lkp@intel.com> (raw)
In-Reply-To: <20210408113618.1033785-4-yi.zhang@huawei.com>

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

Hi Zhang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on ext4/dev]
[also build test ERROR on linus/master v5.12-rc6 next-20210408]
[cannot apply to tytso-fscrypt/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Zhang-Yi/ext4-fix-two-issue-about-bdev_try_to_free_page/20210408-193105
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
config: alpha-randconfig-m031-20210408 (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
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
        # https://github.com/0day-ci/linux/commit/1cd15af09e1887501090c23700b696d43ebf39ca
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Zhang-Yi/ext4-fix-two-issue-about-bdev_try_to_free_page/20210408-193105
        git checkout 1cd15af09e1887501090c23700b696d43ebf39ca
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha 

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

All errors (new ones prefixed by >>):

   fs/ocfs2/journal.c: In function 'ocfs2_journal_shutdown':
>> fs/ocfs2/journal.c:1012:6: error: invalid use of void expression
    1012 |  if (!jbd2_journal_destroy(journal->j_journal) && !status) {
         |      ^


vim +1012 fs/ocfs2/journal.c

ccd979bdbce9fb Mark Fasheh                 2005-12-15   955  
ccd979bdbce9fb Mark Fasheh                 2005-12-15   956  /*
ccd979bdbce9fb Mark Fasheh                 2005-12-15   957   * If the journal has been kmalloc'd it needs to be freed after this
ccd979bdbce9fb Mark Fasheh                 2005-12-15   958   * call.
ccd979bdbce9fb Mark Fasheh                 2005-12-15   959   */
ccd979bdbce9fb Mark Fasheh                 2005-12-15   960  void ocfs2_journal_shutdown(struct ocfs2_super *osb)
ccd979bdbce9fb Mark Fasheh                 2005-12-15   961  {
ccd979bdbce9fb Mark Fasheh                 2005-12-15   962  	struct ocfs2_journal *journal = NULL;
ccd979bdbce9fb Mark Fasheh                 2005-12-15   963  	int status = 0;
ccd979bdbce9fb Mark Fasheh                 2005-12-15   964  	struct inode *inode = NULL;
ccd979bdbce9fb Mark Fasheh                 2005-12-15   965  	int num_running_trans = 0;
ccd979bdbce9fb Mark Fasheh                 2005-12-15   966  
ebdec83ba46c12 Eric Sesterhenn / snakebyte 2006-01-27   967  	BUG_ON(!osb);
ccd979bdbce9fb Mark Fasheh                 2005-12-15   968  
ccd979bdbce9fb Mark Fasheh                 2005-12-15   969  	journal = osb->journal;
ccd979bdbce9fb Mark Fasheh                 2005-12-15   970  	if (!journal)
ccd979bdbce9fb Mark Fasheh                 2005-12-15   971  		goto done;
ccd979bdbce9fb Mark Fasheh                 2005-12-15   972  
ccd979bdbce9fb Mark Fasheh                 2005-12-15   973  	inode = journal->j_inode;
ccd979bdbce9fb Mark Fasheh                 2005-12-15   974  
ccd979bdbce9fb Mark Fasheh                 2005-12-15   975  	if (journal->j_state != OCFS2_JOURNAL_LOADED)
ccd979bdbce9fb Mark Fasheh                 2005-12-15   976  		goto done;
ccd979bdbce9fb Mark Fasheh                 2005-12-15   977  
2b4e30fbde4258 Joel Becker                 2008-09-03   978  	/* need to inc inode use count - jbd2_journal_destroy will iput. */
ccd979bdbce9fb Mark Fasheh                 2005-12-15   979  	if (!igrab(inode))
ccd979bdbce9fb Mark Fasheh                 2005-12-15   980  		BUG();
ccd979bdbce9fb Mark Fasheh                 2005-12-15   981  
ccd979bdbce9fb Mark Fasheh                 2005-12-15   982  	num_running_trans = atomic_read(&(osb->journal->j_num_trans));
b41079504c786e Tao Ma                      2011-02-24   983  	trace_ocfs2_journal_shutdown(num_running_trans);
ccd979bdbce9fb Mark Fasheh                 2005-12-15   984  
ccd979bdbce9fb Mark Fasheh                 2005-12-15   985  	/* Do a commit_cache here. It will flush our journal, *and*
ccd979bdbce9fb Mark Fasheh                 2005-12-15   986  	 * release any locks that are still held.
ccd979bdbce9fb Mark Fasheh                 2005-12-15   987  	 * set the SHUTDOWN flag and release the trans lock.
ccd979bdbce9fb Mark Fasheh                 2005-12-15   988  	 * the commit thread will take the trans lock for us below. */
ccd979bdbce9fb Mark Fasheh                 2005-12-15   989  	journal->j_state = OCFS2_JOURNAL_IN_SHUTDOWN;
ccd979bdbce9fb Mark Fasheh                 2005-12-15   990  
ccd979bdbce9fb Mark Fasheh                 2005-12-15   991  	/* The OCFS2_JOURNAL_IN_SHUTDOWN will signal to commit_cache to not
ccd979bdbce9fb Mark Fasheh                 2005-12-15   992  	 * drop the trans_lock (which we want to hold until we
ccd979bdbce9fb Mark Fasheh                 2005-12-15   993  	 * completely destroy the journal. */
ccd979bdbce9fb Mark Fasheh                 2005-12-15   994  	if (osb->commit_task) {
ccd979bdbce9fb Mark Fasheh                 2005-12-15   995  		/* Wait for the commit thread */
b41079504c786e Tao Ma                      2011-02-24   996  		trace_ocfs2_journal_shutdown_wait(osb->commit_task);
ccd979bdbce9fb Mark Fasheh                 2005-12-15   997  		kthread_stop(osb->commit_task);
ccd979bdbce9fb Mark Fasheh                 2005-12-15   998  		osb->commit_task = NULL;
ccd979bdbce9fb Mark Fasheh                 2005-12-15   999  	}
ccd979bdbce9fb Mark Fasheh                 2005-12-15  1000  
ccd979bdbce9fb Mark Fasheh                 2005-12-15  1001  	BUG_ON(atomic_read(&(osb->journal->j_num_trans)) != 0);
ccd979bdbce9fb Mark Fasheh                 2005-12-15  1002  
c271c5c22b0a7c Sunil Mushran               2006-12-05  1003  	if (ocfs2_mount_local(osb)) {
2b4e30fbde4258 Joel Becker                 2008-09-03  1004  		jbd2_journal_lock_updates(journal->j_journal);
2b4e30fbde4258 Joel Becker                 2008-09-03  1005  		status = jbd2_journal_flush(journal->j_journal);
2b4e30fbde4258 Joel Becker                 2008-09-03  1006  		jbd2_journal_unlock_updates(journal->j_journal);
c271c5c22b0a7c Sunil Mushran               2006-12-05  1007  		if (status < 0)
c271c5c22b0a7c Sunil Mushran               2006-12-05  1008  			mlog_errno(status);
c271c5c22b0a7c Sunil Mushran               2006-12-05  1009  	}
c271c5c22b0a7c Sunil Mushran               2006-12-05  1010  
d85400af790dba Junxiao Bi                  2018-12-28  1011  	/* Shutdown the kernel journal system */
d85400af790dba Junxiao Bi                  2018-12-28 @1012  	if (!jbd2_journal_destroy(journal->j_journal) && !status) {
c271c5c22b0a7c Sunil Mushran               2006-12-05  1013  		/*
c271c5c22b0a7c Sunil Mushran               2006-12-05  1014  		 * Do not toggle if flush was unsuccessful otherwise
c271c5c22b0a7c Sunil Mushran               2006-12-05  1015  		 * will leave dirty metadata in a "clean" journal
c271c5c22b0a7c Sunil Mushran               2006-12-05  1016  		 */
539d8264093560 Sunil Mushran               2008-07-14  1017  		status = ocfs2_journal_toggle_dirty(osb, 0, 0);
ccd979bdbce9fb Mark Fasheh                 2005-12-15  1018  		if (status < 0)
ccd979bdbce9fb Mark Fasheh                 2005-12-15  1019  			mlog_errno(status);
c271c5c22b0a7c Sunil Mushran               2006-12-05  1020  	}
ae0dff683076b2 Sunil Mushran               2008-10-22  1021  	journal->j_journal = NULL;
ccd979bdbce9fb Mark Fasheh                 2005-12-15  1022  
ccd979bdbce9fb Mark Fasheh                 2005-12-15  1023  	OCFS2_I(inode)->ip_open_count--;
ccd979bdbce9fb Mark Fasheh                 2005-12-15  1024  
ccd979bdbce9fb Mark Fasheh                 2005-12-15  1025  	/* unlock our journal */
e63aecb651ba73 Mark Fasheh                 2007-10-18  1026  	ocfs2_inode_unlock(inode, 1);
ccd979bdbce9fb Mark Fasheh                 2005-12-15  1027  
ccd979bdbce9fb Mark Fasheh                 2005-12-15  1028  	brelse(journal->j_bh);
ccd979bdbce9fb Mark Fasheh                 2005-12-15  1029  	journal->j_bh = NULL;
ccd979bdbce9fb Mark Fasheh                 2005-12-15  1030  
ccd979bdbce9fb Mark Fasheh                 2005-12-15  1031  	journal->j_state = OCFS2_JOURNAL_FREE;
ccd979bdbce9fb Mark Fasheh                 2005-12-15  1032  

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

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

  reply	other threads:[~2021-04-08 13:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08 11:36 [PATCH 0/3] ext4: fix two issue about bdev_try_to_free_page() Zhang Yi
2021-04-08 11:36 ` [PATCH 1/3] jbd2: protect buffers release with j_checkpoint_mutex Zhang Yi
2021-04-08 13:45   ` Jan Kara
2021-04-08 11:36 ` [PATCH 2/3] jbd2: do not free buffers in jbd2_journal_try_to_free_buffers() Zhang Yi
2021-04-08 11:36 ` [PATCH 3/3] ext4: add rcu to prevent use after free when umount filesystem Zhang Yi
2021-04-08 13:51   ` kernel test robot [this message]
2021-04-08 13:56   ` Jan Kara
2021-04-08 14:38     ` Zhang Yi
2021-04-08 14:53       ` Jan Kara

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=202104082149.ogXZW0AV-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.cz \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai3@huawei.com \
    /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;
as well as URLs for NNTP newsgroup(s).