All of lore.kernel.org
 help / color / mirror / Atom feed
* [djwong-xfs:repair-quota 54/55] fs/xfs/scrub/quotacheck.c:484:1-7: preceding lock on line 450 (fwd)
@ 2020-06-23 16:00 Julia Lawall
  2020-06-23 17:47 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2020-06-23 16:00 UTC (permalink / raw)
  To: kbuild-all

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

Hello,

There is a strange alternation between goto out_xqclock and goto
out_ilock.  Please check that it is as intended.

julia

---------- Forwarded message ----------
Date: Tue, 23 Jun 2020 09:38:36 +0800
From: kernel test robot <lkp@intel.com>
To: kbuild(a)lists.01.org
Cc: lkp(a)intel.com, Julia Lawall <julia.lawall@lip6.fr>
Subject: [djwong-xfs:repair-quota 54/55] fs/xfs/scrub/quotacheck.c:484:1-7:
    preceding lock on line 450

CC: kbuild-all(a)lists.01.org
CC: "Darrick J. Wong" <darrick.wong@oracle.com>
TO: "Darrick J. Wong" <darrick.wong@oracle.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git repair-quota
head:   46c1bb2989f596b35ff8fd23fc42a15d36b27e96
commit: 7d1edf310e9cb46eccfc844765af018a43088cb0 [54/55] xfs: track quota updates during live quotacheck
:::::: branch date: 7 hours ago
:::::: commit date: 7 hours ago
config: powerpc64-randconfig-c021-20200622 (attached as .config)
compiler: powerpc-linux-gcc (GCC) 9.3.0

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


coccinelle warnings: (new ones prefixed by >>)

>> fs/xfs/scrub/quotacheck.c:484:1-7: preceding lock on line 450

# https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/commit/?id=7d1edf310e9cb46eccfc844765af018a43088cb0
git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
git remote update djwong-xfs
git checkout 7d1edf310e9cb46eccfc844765af018a43088cb0
vim +484 fs/xfs/scrub/quotacheck.c

7d1edf310e9cb4 Darrick J. Wong 2020-06-09  416
e46a7f62683636 Darrick J. Wong 2020-06-05  417  /* Record this inode's quota usage in our shadow quota counter data. */
e46a7f62683636 Darrick J. Wong 2020-06-05  418  STATIC int
e46a7f62683636 Darrick J. Wong 2020-06-05  419  xqcheck_inode(
e46a7f62683636 Darrick J. Wong 2020-06-05  420  	struct xqcheck		*xqc,
e46a7f62683636 Darrick J. Wong 2020-06-05  421  	struct xfs_inode	*ip)
e46a7f62683636 Darrick J. Wong 2020-06-05  422  {
e46a7f62683636 Darrick J. Wong 2020-06-05  423  	struct xfs_trans	*tp = xqc->sc->tp;
e46a7f62683636 Darrick J. Wong 2020-06-05  424  	xfs_qcnt_t		nblks;
e46a7f62683636 Darrick J. Wong 2020-06-05  425  	xfs_filblks_t		rtblks = 0;	/* total rt blks */
e46a7f62683636 Darrick J. Wong 2020-06-05  426  	uint			ilock_flags = 0;
e46a7f62683636 Darrick J. Wong 2020-06-05  427  	xfs_dqid_t		id;
e46a7f62683636 Darrick J. Wong 2020-06-05  428  	int			error;
e46a7f62683636 Darrick J. Wong 2020-06-05  429
e46a7f62683636 Darrick J. Wong 2020-06-05  430  	/* Figure out the data / rt device block counts. */
e46a7f62683636 Darrick J. Wong 2020-06-05  431  	if (XFS_IS_REALTIME_INODE(ip)) {
e46a7f62683636 Darrick J. Wong 2020-06-05  432  		struct xfs_ifork	*ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
e46a7f62683636 Darrick J. Wong 2020-06-05  433
e46a7f62683636 Darrick J. Wong 2020-06-05  434  		ilock_flags = xfs_ilock_data_map_shared(ip);
e46a7f62683636 Darrick J. Wong 2020-06-05  435
e46a7f62683636 Darrick J. Wong 2020-06-05  436  		if (!(ifp->if_flags & XFS_IFEXTENTS)) {
e46a7f62683636 Darrick J. Wong 2020-06-05  437  			error = xfs_iread_extents(tp, ip, XFS_DATA_FORK);
e46a7f62683636 Darrick J. Wong 2020-06-05  438  			if (error)
e46a7f62683636 Darrick J. Wong 2020-06-05  439  				goto out_ilock;
e46a7f62683636 Darrick J. Wong 2020-06-05  440  		}
e46a7f62683636 Darrick J. Wong 2020-06-05  441
e46a7f62683636 Darrick J. Wong 2020-06-05  442  		xfs_bmap_count_leaves(ifp, &rtblks);
e46a7f62683636 Darrick J. Wong 2020-06-05  443  	} else {
e46a7f62683636 Darrick J. Wong 2020-06-05  444  		ilock_flags = XFS_ILOCK_SHARED;
e46a7f62683636 Darrick J. Wong 2020-06-05  445  		xfs_ilock(ip, ilock_flags);
e46a7f62683636 Darrick J. Wong 2020-06-05  446  	}
e46a7f62683636 Darrick J. Wong 2020-06-05  447  	nblks = (xfs_qcnt_t)ip->i_d.di_nblocks - rtblks;
e46a7f62683636 Darrick J. Wong 2020-06-05  448
7d1edf310e9cb4 Darrick J. Wong 2020-06-09  449  	/* Update the shadow dquot counters if we haven't already failed. */
7d1edf310e9cb4 Darrick J. Wong 2020-06-09 @450  	mutex_lock(&xqc->lock);
7d1edf310e9cb4 Darrick J. Wong 2020-06-09  451  	if (xqc->hook_dead) {
7d1edf310e9cb4 Darrick J. Wong 2020-06-09  452  		error = -ECANCELED;
7d1edf310e9cb4 Darrick J. Wong 2020-06-09  453  		goto out_xqclock;
7d1edf310e9cb4 Darrick J. Wong 2020-06-09  454  	}
7d1edf310e9cb4 Darrick J. Wong 2020-06-09  455
e46a7f62683636 Darrick J. Wong 2020-06-05  456  	id = xfs_qm_id_for_quotatype(ip, XFS_DQ_USER);
e46a7f62683636 Darrick J. Wong 2020-06-05  457  	error = xqcheck_update_incore(xqc, xqc->ucounts, id, 1, nblks, rtblks);
e46a7f62683636 Darrick J. Wong 2020-06-05  458  	if (error)
e46a7f62683636 Darrick J. Wong 2020-06-05  459  		goto out_ilock;
e46a7f62683636 Darrick J. Wong 2020-06-05  460
e46a7f62683636 Darrick J. Wong 2020-06-05  461  	id = xfs_qm_id_for_quotatype(ip, XFS_DQ_GROUP);
e46a7f62683636 Darrick J. Wong 2020-06-05  462  	error = xqcheck_update_incore(xqc, xqc->gcounts, id, 1, nblks, rtblks);
e46a7f62683636 Darrick J. Wong 2020-06-05  463  	if (error)
e46a7f62683636 Darrick J. Wong 2020-06-05  464  		goto out_ilock;
e46a7f62683636 Darrick J. Wong 2020-06-05  465
e46a7f62683636 Darrick J. Wong 2020-06-05  466  	id = xfs_qm_id_for_quotatype(ip, XFS_DQ_PROJ);
e46a7f62683636 Darrick J. Wong 2020-06-05  467  	error = xqcheck_update_incore(xqc, xqc->pcounts, id, 1, nblks, rtblks);
7d1edf310e9cb4 Darrick J. Wong 2020-06-09  468  	if (error)
7d1edf310e9cb4 Darrick J. Wong 2020-06-09  469  		goto out_xqclock;
e46a7f62683636 Darrick J. Wong 2020-06-05  470
7d1edf310e9cb4 Darrick J. Wong 2020-06-09  471  	/*
7d1edf310e9cb4 Darrick J. Wong 2020-06-09  472  	 * Update the quotacheck scan cursor so that the quota hooks will
7d1edf310e9cb4 Darrick J. Wong 2020-06-09  473  	 * capture any quota updates made on behalf of this inode after we
7d1edf310e9cb4 Darrick J. Wong 2020-06-09  474  	 * unlock it.
7d1edf310e9cb4 Darrick J. Wong 2020-06-09  475  	 */
7d1edf310e9cb4 Darrick J. Wong 2020-06-09  476  	xqc->last_ino = ip->i_ino;
7d1edf310e9cb4 Darrick J. Wong 2020-06-09  477
7d1edf310e9cb4 Darrick J. Wong 2020-06-09  478  out_xqclock:
7d1edf310e9cb4 Darrick J. Wong 2020-06-09  479  	if (error)
7d1edf310e9cb4 Darrick J. Wong 2020-06-09  480  		xqc->hook_dead = true;
7d1edf310e9cb4 Darrick J. Wong 2020-06-09  481  	mutex_unlock(&xqc->lock);
e46a7f62683636 Darrick J. Wong 2020-06-05  482  out_ilock:
e46a7f62683636 Darrick J. Wong 2020-06-05  483  	xfs_iunlock(ip, ilock_flags);
e46a7f62683636 Darrick J. Wong 2020-06-05 @484  	return error;
e46a7f62683636 Darrick J. Wong 2020-06-05  485  }
e46a7f62683636 Darrick J. Wong 2020-06-05  486

:::::: The code at line 484 was first introduced by commit
:::::: e46a7f62683636c9d03ed2b5fbfae74bff39a2b2 xfs: implement live quotacheck inode scan

:::::: TO: Darrick J. Wong <darrick.wong@oracle.com>
:::::: CC: Darrick J. Wong <darrick.wong@oracle.com>

---
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: 30436 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [djwong-xfs:repair-quota 54/55] fs/xfs/scrub/quotacheck.c:484:1-7: preceding lock on line 450 (fwd)
  2020-06-23 16:00 [djwong-xfs:repair-quota 54/55] fs/xfs/scrub/quotacheck.c:484:1-7: preceding lock on line 450 (fwd) Julia Lawall
@ 2020-06-23 17:47 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2020-06-23 17:47 UTC (permalink / raw)
  To: kbuild-all

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

On Tue, Jun 23, 2020 at 06:00:11PM +0200, Julia Lawall wrote:
> Hello,
> 
> There is a strange alternation between goto out_xqclock and goto
> out_ilock.  Please check that it is as intended.

Yep, definitely broken error handling.  Thank you for pointing this out!

--D

> julia
> 
> ---------- Forwarded message ----------
> Date: Tue, 23 Jun 2020 09:38:36 +0800
> From: kernel test robot <lkp@intel.com>
> To: kbuild(a)lists.01.org
> Cc: lkp(a)intel.com, Julia Lawall <julia.lawall@lip6.fr>
> Subject: [djwong-xfs:repair-quota 54/55] fs/xfs/scrub/quotacheck.c:484:1-7:
>     preceding lock on line 450
> 
> CC: kbuild-all(a)lists.01.org
> CC: "Darrick J. Wong" <darrick.wong@oracle.com>
> TO: "Darrick J. Wong" <darrick.wong@oracle.com>
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git repair-quota
> head:   46c1bb2989f596b35ff8fd23fc42a15d36b27e96
> commit: 7d1edf310e9cb46eccfc844765af018a43088cb0 [54/55] xfs: track quota updates during live quotacheck
> :::::: branch date: 7 hours ago
> :::::: commit date: 7 hours ago
> config: powerpc64-randconfig-c021-20200622 (attached as .config)
> compiler: powerpc-linux-gcc (GCC) 9.3.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Julia Lawall <julia.lawall@lip6.fr>
> 
> 
> coccinelle warnings: (new ones prefixed by >>)
> 
> >> fs/xfs/scrub/quotacheck.c:484:1-7: preceding lock on line 450
> 
> # https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/commit/?id=7d1edf310e9cb46eccfc844765af018a43088cb0
> git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
> git remote update djwong-xfs
> git checkout 7d1edf310e9cb46eccfc844765af018a43088cb0
> vim +484 fs/xfs/scrub/quotacheck.c
> 
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09  416
> e46a7f62683636 Darrick J. Wong 2020-06-05  417  /* Record this inode's quota usage in our shadow quota counter data. */
> e46a7f62683636 Darrick J. Wong 2020-06-05  418  STATIC int
> e46a7f62683636 Darrick J. Wong 2020-06-05  419  xqcheck_inode(
> e46a7f62683636 Darrick J. Wong 2020-06-05  420  	struct xqcheck		*xqc,
> e46a7f62683636 Darrick J. Wong 2020-06-05  421  	struct xfs_inode	*ip)
> e46a7f62683636 Darrick J. Wong 2020-06-05  422  {
> e46a7f62683636 Darrick J. Wong 2020-06-05  423  	struct xfs_trans	*tp = xqc->sc->tp;
> e46a7f62683636 Darrick J. Wong 2020-06-05  424  	xfs_qcnt_t		nblks;
> e46a7f62683636 Darrick J. Wong 2020-06-05  425  	xfs_filblks_t		rtblks = 0;	/* total rt blks */
> e46a7f62683636 Darrick J. Wong 2020-06-05  426  	uint			ilock_flags = 0;
> e46a7f62683636 Darrick J. Wong 2020-06-05  427  	xfs_dqid_t		id;
> e46a7f62683636 Darrick J. Wong 2020-06-05  428  	int			error;
> e46a7f62683636 Darrick J. Wong 2020-06-05  429
> e46a7f62683636 Darrick J. Wong 2020-06-05  430  	/* Figure out the data / rt device block counts. */
> e46a7f62683636 Darrick J. Wong 2020-06-05  431  	if (XFS_IS_REALTIME_INODE(ip)) {
> e46a7f62683636 Darrick J. Wong 2020-06-05  432  		struct xfs_ifork	*ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
> e46a7f62683636 Darrick J. Wong 2020-06-05  433
> e46a7f62683636 Darrick J. Wong 2020-06-05  434  		ilock_flags = xfs_ilock_data_map_shared(ip);
> e46a7f62683636 Darrick J. Wong 2020-06-05  435
> e46a7f62683636 Darrick J. Wong 2020-06-05  436  		if (!(ifp->if_flags & XFS_IFEXTENTS)) {
> e46a7f62683636 Darrick J. Wong 2020-06-05  437  			error = xfs_iread_extents(tp, ip, XFS_DATA_FORK);
> e46a7f62683636 Darrick J. Wong 2020-06-05  438  			if (error)
> e46a7f62683636 Darrick J. Wong 2020-06-05  439  				goto out_ilock;
> e46a7f62683636 Darrick J. Wong 2020-06-05  440  		}
> e46a7f62683636 Darrick J. Wong 2020-06-05  441
> e46a7f62683636 Darrick J. Wong 2020-06-05  442  		xfs_bmap_count_leaves(ifp, &rtblks);
> e46a7f62683636 Darrick J. Wong 2020-06-05  443  	} else {
> e46a7f62683636 Darrick J. Wong 2020-06-05  444  		ilock_flags = XFS_ILOCK_SHARED;
> e46a7f62683636 Darrick J. Wong 2020-06-05  445  		xfs_ilock(ip, ilock_flags);
> e46a7f62683636 Darrick J. Wong 2020-06-05  446  	}
> e46a7f62683636 Darrick J. Wong 2020-06-05  447  	nblks = (xfs_qcnt_t)ip->i_d.di_nblocks - rtblks;
> e46a7f62683636 Darrick J. Wong 2020-06-05  448
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09  449  	/* Update the shadow dquot counters if we haven't already failed. */
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09 @450  	mutex_lock(&xqc->lock);
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09  451  	if (xqc->hook_dead) {
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09  452  		error = -ECANCELED;
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09  453  		goto out_xqclock;
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09  454  	}
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09  455
> e46a7f62683636 Darrick J. Wong 2020-06-05  456  	id = xfs_qm_id_for_quotatype(ip, XFS_DQ_USER);
> e46a7f62683636 Darrick J. Wong 2020-06-05  457  	error = xqcheck_update_incore(xqc, xqc->ucounts, id, 1, nblks, rtblks);
> e46a7f62683636 Darrick J. Wong 2020-06-05  458  	if (error)
> e46a7f62683636 Darrick J. Wong 2020-06-05  459  		goto out_ilock;
> e46a7f62683636 Darrick J. Wong 2020-06-05  460
> e46a7f62683636 Darrick J. Wong 2020-06-05  461  	id = xfs_qm_id_for_quotatype(ip, XFS_DQ_GROUP);
> e46a7f62683636 Darrick J. Wong 2020-06-05  462  	error = xqcheck_update_incore(xqc, xqc->gcounts, id, 1, nblks, rtblks);
> e46a7f62683636 Darrick J. Wong 2020-06-05  463  	if (error)
> e46a7f62683636 Darrick J. Wong 2020-06-05  464  		goto out_ilock;
> e46a7f62683636 Darrick J. Wong 2020-06-05  465
> e46a7f62683636 Darrick J. Wong 2020-06-05  466  	id = xfs_qm_id_for_quotatype(ip, XFS_DQ_PROJ);
> e46a7f62683636 Darrick J. Wong 2020-06-05  467  	error = xqcheck_update_incore(xqc, xqc->pcounts, id, 1, nblks, rtblks);
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09  468  	if (error)
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09  469  		goto out_xqclock;
> e46a7f62683636 Darrick J. Wong 2020-06-05  470
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09  471  	/*
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09  472  	 * Update the quotacheck scan cursor so that the quota hooks will
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09  473  	 * capture any quota updates made on behalf of this inode after we
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09  474  	 * unlock it.
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09  475  	 */
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09  476  	xqc->last_ino = ip->i_ino;
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09  477
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09  478  out_xqclock:
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09  479  	if (error)
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09  480  		xqc->hook_dead = true;
> 7d1edf310e9cb4 Darrick J. Wong 2020-06-09  481  	mutex_unlock(&xqc->lock);
> e46a7f62683636 Darrick J. Wong 2020-06-05  482  out_ilock:
> e46a7f62683636 Darrick J. Wong 2020-06-05  483  	xfs_iunlock(ip, ilock_flags);
> e46a7f62683636 Darrick J. Wong 2020-06-05 @484  	return error;
> e46a7f62683636 Darrick J. Wong 2020-06-05  485  }
> e46a7f62683636 Darrick J. Wong 2020-06-05  486
> 
> :::::: The code at line 484 was first introduced by commit
> :::::: e46a7f62683636c9d03ed2b5fbfae74bff39a2b2 xfs: implement live quotacheck inode scan
> 
> :::::: TO: Darrick J. Wong <darrick.wong@oracle.com>
> :::::: CC: Darrick J. Wong <darrick.wong@oracle.com>
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-23 17:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-23 16:00 [djwong-xfs:repair-quota 54/55] fs/xfs/scrub/quotacheck.c:484:1-7: preceding lock on line 450 (fwd) Julia Lawall
2020-06-23 17:47 ` Darrick J. Wong

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.