Re: [PATCH 3/3] ext4: add rcu to prevent use after free when umount filesystem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>

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@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux