Skip to content

Commit 0891f99

Browse files
Christoph Hellwigdjwong
authored andcommitted
Revert "xfs: grab dquots without taking the ilock"
This reverts commit 50e0bdb. 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>
1 parent 29db250 commit 0891f99

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

fs/xfs/libxfs/xfs_quota_defs.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ typedef uint16_t xfs_qwarncnt_t;
136136
*/
137137
#define XFS_QMOPT_INHERIT 0x1000000
138138

139-
#define XFS_QMOPT_NOLOCK 0x2000000 /* don't ilock during dqget */
140-
141139
/*
142140
* flags to xfs_trans_mod_dquot.
143141
*/

fs/xfs/xfs_dquot.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -472,23 +472,18 @@ xfs_qm_dqtobp(
472472
struct xfs_mount *mp = dqp->q_mount;
473473
xfs_dqid_t id = be32_to_cpu(dqp->q_core.d_id);
474474
struct xfs_trans *tp = (tpp ? *tpp : NULL);
475-
uint lock_mode = 0;
475+
uint lock_mode;
476476

477477
quotip = xfs_quota_inode(dqp->q_mount, dqp->dq_flags);
478478
dqp->q_fileoffset = (xfs_fileoff_t)id / mp->m_quotainfo->qi_dqperchunk;
479479

480-
ASSERT(!(flags & XFS_QMOPT_NOLOCK) ||
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);
480+
lock_mode = xfs_ilock_data_map_shared(quotip);
485481
if (!xfs_this_quota_on(dqp->q_mount, dqp->dq_flags)) {
486482
/*
487483
* Return if this type of quotas is turned off while we
488484
* didn't have the quota inode lock.
489485
*/
490-
if (lock_mode)
491-
xfs_iunlock(quotip, lock_mode);
486+
xfs_iunlock(quotip, lock_mode);
492487
return -ESRCH;
493488
}
494489

@@ -498,8 +493,7 @@ xfs_qm_dqtobp(
498493
error = xfs_bmapi_read(quotip, dqp->q_fileoffset,
499494
XFS_DQUOT_CLUSTER_SIZE_FSB, &map, &nmaps, 0);
500495

501-
if (lock_mode)
502-
xfs_iunlock(quotip, lock_mode);
496+
xfs_iunlock(quotip, lock_mode);
503497
if (error)
504498
return error;
505499

0 commit comments

Comments
 (0)