summaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-07-13 15:14:34 -0400
committerDarrick J. Wong <darrick.wong@oracle.com>2017-07-13 17:55:05 -0400
commit0891f9971a3b00d243d5743cc78a628ad060adea (patch)
tree23e456cbe32786092965088bf25c13f38148655a /fs/xfs
parent29db2500f6a92d63834a40c5e9eebab34c78c53a (diff)
Revert "xfs: grab dquots without taking the ilock"
This reverts commit 50e0bdbe9f48f98bb02eac7030d682f4716884ae. The new XFS_QMOPT_NOLOCK isn't used at all, and conditional locking based on a flag is always the wrong thing to do - we should be having helpers that can be called without the lock instead. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/libxfs/xfs_quota_defs.h2
-rw-r--r--fs/xfs/xfs_dquot.c14
2 files changed, 4 insertions, 12 deletions
diff --git a/fs/xfs/libxfs/xfs_quota_defs.h b/fs/xfs/libxfs/xfs_quota_defs.h
index 2834574cb6e7..d69c772271cb 100644
--- a/fs/xfs/libxfs/xfs_quota_defs.h
+++ b/fs/xfs/libxfs/xfs_quota_defs.h
@@ -136,8 +136,6 @@ typedef uint16_t xfs_qwarncnt_t;
136 */ 136 */
137#define XFS_QMOPT_INHERIT 0x1000000 137#define XFS_QMOPT_INHERIT 0x1000000
138 138
139#define XFS_QMOPT_NOLOCK 0x2000000 /* don't ilock during dqget */
140
141/* 139/*
142 * flags to xfs_trans_mod_dquot. 140 * flags to xfs_trans_mod_dquot.
143 */ 141 */
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index f89f7b5241e6..fd2ef8c2c9a7 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -472,23 +472,18 @@ xfs_qm_dqtobp(
472 struct xfs_mount *mp = dqp->q_mount; 472 struct xfs_mount *mp = dqp->q_mount;
473 xfs_dqid_t id = be32_to_cpu(dqp->q_core.d_id); 473 xfs_dqid_t id = be32_to_cpu(dqp->q_core.d_id);
474 struct xfs_trans *tp = (tpp ? *tpp : NULL); 474 struct xfs_trans *tp = (tpp ? *tpp : NULL);
475 uint lock_mode = 0; 475 uint lock_mode;
476 476
477 quotip = xfs_quota_inode(dqp->q_mount, dqp->dq_flags); 477 quotip = xfs_quota_inode(dqp->q_mount, dqp->dq_flags);
478 dqp->q_fileoffset = (xfs_fileoff_t)id / mp->m_quotainfo->qi_dqperchunk; 478 dqp->q_fileoffset = (xfs_fileoff_t)id / mp->m_quotainfo->qi_dqperchunk;
479 479
480 ASSERT(!(flags & XFS_QMOPT_NOLOCK) || 480 lock_mode = xfs_ilock_data_map_shared(quotip);
481 xfs_isilocked(quotip, XFS_ILOCK_SHARED) ||
482 xfs_isilocked(quotip, XFS_ILOCK_EXCL));
483 if (!(flags & XFS_QMOPT_NOLOCK))
484 lock_mode = xfs_ilock_data_map_shared(quotip);
485 if (!xfs_this_quota_on(dqp->q_mount, dqp->dq_flags)) { 481 if (!xfs_this_quota_on(dqp->q_mount, dqp->dq_flags)) {
486 /* 482 /*
487 * Return if this type of quotas is turned off while we 483 * Return if this type of quotas is turned off while we
488 * didn't have the quota inode lock. 484 * didn't have the quota inode lock.
489 */ 485 */
490 if (lock_mode) 486 xfs_iunlock(quotip, lock_mode);
491 xfs_iunlock(quotip, lock_mode);
492 return -ESRCH; 487 return -ESRCH;
493 } 488 }
494 489
@@ -498,8 +493,7 @@ xfs_qm_dqtobp(
498 error = xfs_bmapi_read(quotip, dqp->q_fileoffset, 493 error = xfs_bmapi_read(quotip, dqp->q_fileoffset,
499 XFS_DQUOT_CLUSTER_SIZE_FSB, &map, &nmaps, 0); 494 XFS_DQUOT_CLUSTER_SIZE_FSB, &map, &nmaps, 0);
500 495
501 if (lock_mode) 496 xfs_iunlock(quotip, lock_mode);
502 xfs_iunlock(quotip, lock_mode);
503 if (error) 497 if (error)
504 return error; 498 return error;
505 499