Re: [PATCH 2/2] xfs: make sure link path does not go away at access

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

 



Hi Ian,

I love your patch! Perhaps something to improve:

[auto build test WARNING on xfs-linux/for-next]
[also build test WARNING on mszeredi-vfs/overlayfs-next linus/master v5.16-rc1 next-20211117]
[cannot apply to djwong-xfs/djwong-devel]
[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/Ian-Kent/vfs-check-dentry-is-still-valid-in-get_link/20211111-114013
base:   https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git for-next
config: i386-randconfig-s001-20211115 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/0day-ci/linux/commit/1208c3b6210fbb49718cdf4fa5f7db35bea008f6
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Ian-Kent/vfs-check-dentry-is-still-valid-in-get_link/20211111-114013
        git checkout 1208c3b6210fbb49718cdf4fa5f7db35bea008f6
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash fs/

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


sparse warnings: (new ones prefixed by >>)
>> fs/xfs/xfs_inode.c:2648:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
>> fs/xfs/xfs_inode.c:2648:17: sparse:    char [noderef] __rcu *
>> fs/xfs/xfs_inode.c:2648:17: sparse:    char *
--
>> fs/xfs/xfs_iops.c:531:16: sparse: sparse: incompatible types in comparison expression (different address spaces):
>> fs/xfs/xfs_iops.c:531:16: sparse:    char [noderef] __rcu *
>> fs/xfs/xfs_iops.c:531:16: sparse:    char *

vim +2648 fs/xfs/xfs_inode.c

  2600	
  2601	/*
  2602	 * This is called to return an inode to the inode free list.
  2603	 * The inode should already be truncated to 0 length and have
  2604	 * no pages associated with it.  This routine also assumes that
  2605	 * the inode is already a part of the transaction.
  2606	 *
  2607	 * The on-disk copy of the inode will have been added to the list
  2608	 * of unlinked inodes in the AGI. We need to remove the inode from
  2609	 * that list atomically with respect to freeing it here.
  2610	 */
  2611	int
  2612	xfs_ifree(
  2613		struct xfs_trans	*tp,
  2614		struct xfs_inode	*ip)
  2615	{
  2616		struct xfs_mount	*mp = ip->i_mount;
  2617		struct xfs_perag	*pag;
  2618		struct xfs_icluster	xic = { 0 };
  2619		struct xfs_inode_log_item *iip = ip->i_itemp;
  2620		int			error;
  2621	
  2622		ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
  2623		ASSERT(VFS_I(ip)->i_nlink == 0);
  2624		ASSERT(ip->i_df.if_nextents == 0);
  2625		ASSERT(ip->i_disk_size == 0 || !S_ISREG(VFS_I(ip)->i_mode));
  2626		ASSERT(ip->i_nblocks == 0);
  2627	
  2628		pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino));
  2629	
  2630		/*
  2631		 * Pull the on-disk inode from the AGI unlinked list.
  2632		 */
  2633		error = xfs_iunlink_remove(tp, pag, ip);
  2634		if (error)
  2635			goto out;
  2636	
  2637		error = xfs_difree(tp, pag, ip->i_ino, &xic);
  2638		if (error)
  2639			goto out;
  2640	
  2641		/*
  2642		 * Free any local-format data sitting around before we reset the
  2643		 * data fork to extents format.  Note that the attr fork data has
  2644		 * already been freed by xfs_attr_inactive.
  2645		 */
  2646		if (ip->i_df.if_format == XFS_DINODE_FMT_LOCAL) {
  2647			kmem_free_rcu(ip->i_df.if_u1.if_data);
> 2648			RCU_INIT_POINTER(ip->i_df.if_u1.if_data, NULL);
  2649			ip->i_df.if_bytes = 0;
  2650		}
  2651	
  2652		VFS_I(ip)->i_mode = 0;		/* mark incore inode as free */
  2653		ip->i_diflags = 0;
  2654		ip->i_diflags2 = mp->m_ino_geo.new_diflags2;
  2655		ip->i_forkoff = 0;		/* mark the attr fork not in use */
  2656		ip->i_df.if_format = XFS_DINODE_FMT_EXTENTS;
  2657		if (xfs_iflags_test(ip, XFS_IPRESERVE_DM_FIELDS))
  2658			xfs_iflags_clear(ip, XFS_IPRESERVE_DM_FIELDS);
  2659	
  2660		/* Don't attempt to replay owner changes for a deleted inode */
  2661		spin_lock(&iip->ili_lock);
  2662		iip->ili_fields &= ~(XFS_ILOG_AOWNER | XFS_ILOG_DOWNER);
  2663		spin_unlock(&iip->ili_lock);
  2664	
  2665		/*
  2666		 * Bump the generation count so no one will be confused
  2667		 * by reincarnations of this inode.
  2668		 */
  2669		VFS_I(ip)->i_generation++;
  2670		xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
  2671	
  2672		if (xic.deleted)
  2673			error = xfs_ifree_cluster(tp, pag, ip, &xic);
  2674	out:
  2675		xfs_perag_put(pag);
  2676		return error;
  2677	}
  2678	

---
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]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux