Dave Chinner | 0b61f8a | 2018-06-05 19:42:14 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
Nathan Scott | 4ce3121 | 2005-11-02 14:59:41 +1100 | [diff] [blame] | 3 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. |
| 4 | * All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | */ |
Randy Dunlap | 16f7e0f | 2006-01-11 12:17:46 -0800 | [diff] [blame] | 6 | |
Randy Dunlap | 16f7e0f | 2006-01-11 12:17:46 -0800 | [diff] [blame] | 7 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | #include "xfs.h" |
| 9 | #include "xfs_fs.h" |
Dave Chinner | 70a9883 | 2013-10-23 10:36:05 +1100 | [diff] [blame] | 10 | #include "xfs_shared.h" |
Dave Chinner | 239880e | 2013-10-23 10:50:10 +1100 | [diff] [blame] | 11 | #include "xfs_format.h" |
| 12 | #include "xfs_log_format.h" |
| 13 | #include "xfs_trans_resv.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #include "xfs_sb.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | #include "xfs_mount.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include "xfs_inode.h" |
Dave Chinner | 239880e | 2013-10-23 10:50:10 +1100 | [diff] [blame] | 17 | #include "xfs_trans.h" |
Dave Chinner | a4fbe6a | 2013-10-23 10:51:50 +1100 | [diff] [blame] | 18 | #include "xfs_quota.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | #include "xfs_qm.h" |
Dave Chinner | 6d8b79c | 2012-10-08 21:56:09 +1100 | [diff] [blame] | 20 | #include "xfs_icache.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | |
Christoph Hellwig | fcafb71 | 2009-02-09 08:47:34 +0100 | [diff] [blame] | 22 | int |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | xfs_qm_scall_quotaoff( |
| 24 | xfs_mount_t *mp, |
Christoph Hellwig | fcafb71 | 2009-02-09 08:47:34 +0100 | [diff] [blame] | 25 | uint flags) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | /* |
| 28 | * No file system can have quotas enabled on disk but not in core. |
| 29 | * Note that quota utilities (like quotaoff) _expect_ |
Dave Chinner | 2451337 | 2014-06-25 14:58:08 +1000 | [diff] [blame] | 30 | * errno == -EEXIST here. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | */ |
| 32 | if ((mp->m_qflags & flags) == 0) |
Dave Chinner | 2451337 | 2014-06-25 14:58:08 +1000 | [diff] [blame] | 33 | return -EEXIST; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
| 35 | /* |
Christoph Hellwig | 40b5222 | 2021-08-06 11:05:36 -0700 | [diff] [blame] | 36 | * We do not support actually turning off quota accounting any more. |
| 37 | * Just log a warning and ignore the accounting related flags. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | */ |
Christoph Hellwig | 40b5222 | 2021-08-06 11:05:36 -0700 | [diff] [blame] | 39 | if (flags & XFS_ALL_QUOTA_ACCT) |
| 40 | xfs_info(mp, "disabling of quota accounting not supported."); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | |
Christoph Hellwig | 40b5222 | 2021-08-06 11:05:36 -0700 | [diff] [blame] | 42 | mutex_lock(&mp->m_quotainfo->qi_quotaofflock); |
| 43 | mp->m_qflags &= ~(flags & XFS_ALL_QUOTA_ENFD); |
| 44 | spin_lock(&mp->m_sb_lock); |
| 45 | mp->m_sb.sb_qflags = mp->m_qflags; |
| 46 | spin_unlock(&mp->m_sb_lock); |
| 47 | mutex_unlock(&mp->m_quotainfo->qi_quotaofflock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | |
Christoph Hellwig | 40b5222 | 2021-08-06 11:05:36 -0700 | [diff] [blame] | 49 | /* XXX what to do if error ? Revert back to old vals incore ? */ |
| 50 | return xfs_sync_sb(mp, false); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | } |
| 52 | |
Christoph Hellwig | 5d18898 | 2010-07-20 17:51:31 +1000 | [diff] [blame] | 53 | STATIC int |
| 54 | xfs_qm_scall_trunc_qfile( |
| 55 | struct xfs_mount *mp, |
| 56 | xfs_ino_t ino) |
| 57 | { |
| 58 | struct xfs_inode *ip; |
| 59 | struct xfs_trans *tp; |
| 60 | int error; |
| 61 | |
| 62 | if (ino == NULLFSINO) |
| 63 | return 0; |
| 64 | |
| 65 | error = xfs_iget(mp, NULL, ino, 0, 0, &ip); |
| 66 | if (error) |
| 67 | return error; |
| 68 | |
| 69 | xfs_ilock(ip, XFS_IOLOCK_EXCL); |
| 70 | |
Christoph Hellwig | 253f491 | 2016-04-06 09:19:55 +1000 | [diff] [blame] | 71 | error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0, 0, 0, &tp); |
Christoph Hellwig | 5d18898 | 2010-07-20 17:51:31 +1000 | [diff] [blame] | 72 | if (error) { |
Christoph Hellwig | 5d18898 | 2010-07-20 17:51:31 +1000 | [diff] [blame] | 73 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); |
| 74 | goto out_put; |
| 75 | } |
| 76 | |
| 77 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
Christoph Hellwig | ddc3415 | 2011-09-19 15:00:54 +0000 | [diff] [blame] | 78 | xfs_trans_ijoin(tp, ip, 0); |
Christoph Hellwig | 5d18898 | 2010-07-20 17:51:31 +1000 | [diff] [blame] | 79 | |
Christoph Hellwig | 13d2c10 | 2021-03-29 11:11:40 -0700 | [diff] [blame] | 80 | ip->i_disk_size = 0; |
Christoph Hellwig | 673e8e5 | 2011-12-18 20:00:04 +0000 | [diff] [blame] | 81 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
| 82 | |
| 83 | error = xfs_itruncate_extents(&tp, ip, XFS_DATA_FORK, 0); |
Christoph Hellwig | 5d18898 | 2010-07-20 17:51:31 +1000 | [diff] [blame] | 84 | if (error) { |
Christoph Hellwig | 4906e21 | 2015-06-04 13:47:56 +1000 | [diff] [blame] | 85 | xfs_trans_cancel(tp); |
Christoph Hellwig | 5d18898 | 2010-07-20 17:51:31 +1000 | [diff] [blame] | 86 | goto out_unlock; |
| 87 | } |
| 88 | |
Christoph Hellwig | daf8396 | 2020-05-18 10:27:22 -0700 | [diff] [blame] | 89 | ASSERT(ip->i_df.if_nextents == 0); |
Christoph Hellwig | 673e8e5 | 2011-12-18 20:00:04 +0000 | [diff] [blame] | 90 | |
Dave Chinner | dcd79a1 | 2010-09-28 12:27:25 +1000 | [diff] [blame] | 91 | xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); |
Christoph Hellwig | 7039331 | 2015-06-04 13:48:08 +1000 | [diff] [blame] | 92 | error = xfs_trans_commit(tp); |
Christoph Hellwig | 5d18898 | 2010-07-20 17:51:31 +1000 | [diff] [blame] | 93 | |
| 94 | out_unlock: |
| 95 | xfs_iunlock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); |
| 96 | out_put: |
Darrick J. Wong | 44a8736 | 2018-07-25 12:52:32 -0700 | [diff] [blame] | 97 | xfs_irele(ip); |
Christoph Hellwig | 5d18898 | 2010-07-20 17:51:31 +1000 | [diff] [blame] | 98 | return error; |
| 99 | } |
| 100 | |
Christoph Hellwig | fcafb71 | 2009-02-09 08:47:34 +0100 | [diff] [blame] | 101 | int |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | xfs_qm_scall_trunc_qfiles( |
| 103 | xfs_mount_t *mp, |
| 104 | uint flags) |
| 105 | { |
Dave Chinner | 2451337 | 2014-06-25 14:58:08 +1000 | [diff] [blame] | 106 | int error = -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | |
Dave Chinner | 38c26bf | 2021-08-18 18:46:37 -0700 | [diff] [blame] | 108 | if (!xfs_has_quota(mp) || flags == 0 || |
Darrick J. Wong | 41ed4a5 | 2020-07-14 10:36:09 -0700 | [diff] [blame] | 109 | (flags & ~XFS_QMOPT_QUOTALL)) { |
Eric Sandeen | 08e96e1 | 2013-10-11 20:59:05 -0500 | [diff] [blame] | 110 | xfs_debug(mp, "%s: flags=%x m_qflags=%x", |
Dave Chinner | 8221112 | 2011-03-07 10:07:35 +1100 | [diff] [blame] | 111 | __func__, flags, mp->m_qflags); |
Dave Chinner | 2451337 | 2014-06-25 14:58:08 +1000 | [diff] [blame] | 112 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | } |
| 114 | |
Darrick J. Wong | 41ed4a5 | 2020-07-14 10:36:09 -0700 | [diff] [blame] | 115 | if (flags & XFS_QMOPT_UQUOTA) { |
Christoph Hellwig | 5d18898 | 2010-07-20 17:51:31 +1000 | [diff] [blame] | 116 | error = xfs_qm_scall_trunc_qfile(mp, mp->m_sb.sb_uquotino); |
Jie Liu | c61a9e3 | 2013-11-22 14:04:00 +0800 | [diff] [blame] | 117 | if (error) |
| 118 | return error; |
| 119 | } |
Darrick J. Wong | 41ed4a5 | 2020-07-14 10:36:09 -0700 | [diff] [blame] | 120 | if (flags & XFS_QMOPT_GQUOTA) { |
Jie Liu | c61a9e3 | 2013-11-22 14:04:00 +0800 | [diff] [blame] | 121 | error = xfs_qm_scall_trunc_qfile(mp, mp->m_sb.sb_gquotino); |
| 122 | if (error) |
| 123 | return error; |
| 124 | } |
Darrick J. Wong | 41ed4a5 | 2020-07-14 10:36:09 -0700 | [diff] [blame] | 125 | if (flags & XFS_QMOPT_PQUOTA) |
Jie Liu | c61a9e3 | 2013-11-22 14:04:00 +0800 | [diff] [blame] | 126 | error = xfs_qm_scall_trunc_qfile(mp, mp->m_sb.sb_pquotino); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | |
Jie Liu | c61a9e3 | 2013-11-22 14:04:00 +0800 | [diff] [blame] | 128 | return error; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | } |
| 130 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | /* |
| 132 | * Switch on (a given) quota enforcement for a filesystem. This takes |
| 133 | * effect immediately. |
| 134 | * (Switching on quota accounting must be done at mount time.) |
| 135 | */ |
Christoph Hellwig | fcafb71 | 2009-02-09 08:47:34 +0100 | [diff] [blame] | 136 | int |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 | xfs_qm_scall_quotaon( |
| 138 | xfs_mount_t *mp, |
| 139 | uint flags) |
| 140 | { |
| 141 | int error; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 142 | uint qf; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 | /* |
Kaixu Xia | cd59455 | 2020-04-22 21:54:30 -0700 | [diff] [blame] | 145 | * Switching on quota accounting must be done at mount time, |
| 146 | * only consider quota enforcement stuff here. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | */ |
Kaixu Xia | cd59455 | 2020-04-22 21:54:30 -0700 | [diff] [blame] | 148 | flags &= XFS_ALL_QUOTA_ENFD; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | if (flags == 0) { |
Eric Sandeen | 08e96e1 | 2013-10-11 20:59:05 -0500 | [diff] [blame] | 151 | xfs_debug(mp, "%s: zero flags, m_qflags=%x", |
Dave Chinner | 8221112 | 2011-03-07 10:07:35 +1100 | [diff] [blame] | 152 | __func__, mp->m_qflags); |
Dave Chinner | 2451337 | 2014-06-25 14:58:08 +1000 | [diff] [blame] | 153 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 154 | } |
| 155 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | /* |
| 157 | * Can't enforce without accounting. We check the superblock |
| 158 | * qflags here instead of m_qflags because rootfs can have |
| 159 | * quota acct on ondisk without m_qflags' knowing. |
| 160 | */ |
Jan Kara | fbf64b3 | 2014-10-08 11:52:52 +0200 | [diff] [blame] | 161 | if (((mp->m_sb.sb_qflags & XFS_UQUOTA_ACCT) == 0 && |
Chandra Seetharaman | 83e782e | 2013-06-27 17:25:10 -0500 | [diff] [blame] | 162 | (flags & XFS_UQUOTA_ENFD)) || |
Jan Kara | fbf64b3 | 2014-10-08 11:52:52 +0200 | [diff] [blame] | 163 | ((mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) == 0 && |
Chandra Seetharaman | 83e782e | 2013-06-27 17:25:10 -0500 | [diff] [blame] | 164 | (flags & XFS_GQUOTA_ENFD)) || |
Jan Kara | fbf64b3 | 2014-10-08 11:52:52 +0200 | [diff] [blame] | 165 | ((mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) == 0 && |
Chandra Seetharaman | 83e782e | 2013-06-27 17:25:10 -0500 | [diff] [blame] | 166 | (flags & XFS_PQUOTA_ENFD))) { |
Dave Chinner | 8221112 | 2011-03-07 10:07:35 +1100 | [diff] [blame] | 167 | xfs_debug(mp, |
Eric Sandeen | 08e96e1 | 2013-10-11 20:59:05 -0500 | [diff] [blame] | 168 | "%s: Can't enforce without acct, flags=%x sbflags=%x", |
Dave Chinner | 8221112 | 2011-03-07 10:07:35 +1100 | [diff] [blame] | 169 | __func__, flags, mp->m_sb.sb_qflags); |
Dave Chinner | 2451337 | 2014-06-25 14:58:08 +1000 | [diff] [blame] | 170 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | } |
| 172 | /* |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 173 | * If everything's up to-date incore, then don't waste time. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 174 | */ |
| 175 | if ((mp->m_qflags & flags) == flags) |
Dave Chinner | 2451337 | 2014-06-25 14:58:08 +1000 | [diff] [blame] | 176 | return -EEXIST; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 177 | |
| 178 | /* |
| 179 | * Change sb_qflags on disk but not incore mp->qflags |
| 180 | * if this is the root filesystem. |
| 181 | */ |
Eric Sandeen | 3685c2a | 2007-10-11 17:42:32 +1000 | [diff] [blame] | 182 | spin_lock(&mp->m_sb_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 183 | qf = mp->m_sb.sb_qflags; |
| 184 | mp->m_sb.sb_qflags = qf | flags; |
Eric Sandeen | 3685c2a | 2007-10-11 17:42:32 +1000 | [diff] [blame] | 185 | spin_unlock(&mp->m_sb_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 186 | |
| 187 | /* |
| 188 | * There's nothing to change if it's the same. |
| 189 | */ |
Dave Chinner | 4d11a40 | 2015-01-22 09:10:26 +1100 | [diff] [blame] | 190 | if ((qf & flags) == flags) |
Dave Chinner | 2451337 | 2014-06-25 14:58:08 +1000 | [diff] [blame] | 191 | return -EEXIST; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | |
Dave Chinner | 61e63ec | 2015-01-22 09:10:31 +1100 | [diff] [blame] | 193 | error = xfs_sync_sb(mp, false); |
| 194 | if (error) |
Eric Sandeen | d99831f | 2014-06-22 15:03:54 +1000 | [diff] [blame] | 195 | return error; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 | /* |
| 197 | * If we aren't trying to switch on quota enforcement, we are done. |
| 198 | */ |
| 199 | if (((mp->m_sb.sb_qflags & XFS_UQUOTA_ACCT) != |
| 200 | (mp->m_qflags & XFS_UQUOTA_ACCT)) || |
Nathan Scott | c8ad20f | 2005-06-21 15:38:48 +1000 | [diff] [blame] | 201 | ((mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) != |
| 202 | (mp->m_qflags & XFS_PQUOTA_ACCT)) || |
| 203 | ((mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) != |
Jan Kara | fbf64b3 | 2014-10-08 11:52:52 +0200 | [diff] [blame] | 204 | (mp->m_qflags & XFS_GQUOTA_ACCT))) |
Eric Sandeen | d99831f | 2014-06-22 15:03:54 +1000 | [diff] [blame] | 205 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 206 | |
Christoph Hellwig | 149e53a | 2021-08-06 11:05:37 -0700 | [diff] [blame] | 207 | if (!XFS_IS_QUOTA_ON(mp)) |
Dave Chinner | 2451337 | 2014-06-25 14:58:08 +1000 | [diff] [blame] | 208 | return -ESRCH; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 209 | |
| 210 | /* |
| 211 | * Switch on quota enforcement in core. |
| 212 | */ |
Christoph Hellwig | 8a7b8a8 | 2010-04-20 17:01:30 +1000 | [diff] [blame] | 213 | mutex_lock(&mp->m_quotainfo->qi_quotaofflock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | mp->m_qflags |= (flags & XFS_ALL_QUOTA_ENFD); |
Christoph Hellwig | 8a7b8a8 | 2010-04-20 17:01:30 +1000 | [diff] [blame] | 215 | mutex_unlock(&mp->m_quotainfo->qi_quotaofflock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 216 | |
Eric Sandeen | d99831f | 2014-06-22 15:03:54 +1000 | [diff] [blame] | 217 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | } |
| 219 | |
Jan Kara | 14bf61f | 2014-10-09 16:03:13 +0200 | [diff] [blame] | 220 | #define XFS_QC_MASK \ |
| 221 | (QC_LIMIT_MASK | QC_TIMER_MASK | QC_WARNS_MASK) |
Christoph Hellwig | c472b43 | 2010-05-06 17:05:17 -0400 | [diff] [blame] | 222 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 | /* |
Darrick J. Wong | d1520de | 2020-07-14 10:37:33 -0700 | [diff] [blame] | 224 | * Adjust limits of this quota, and the defaults if passed in. Returns true |
| 225 | * if the new limits made sense and were applied, false otherwise. |
| 226 | */ |
| 227 | static inline bool |
| 228 | xfs_setqlim_limits( |
| 229 | struct xfs_mount *mp, |
| 230 | struct xfs_dquot_res *res, |
| 231 | struct xfs_quota_limits *qlim, |
| 232 | xfs_qcnt_t hard, |
| 233 | xfs_qcnt_t soft, |
| 234 | const char *tag) |
| 235 | { |
| 236 | /* The hard limit can't be less than the soft limit. */ |
| 237 | if (hard != 0 && hard < soft) { |
| 238 | xfs_debug(mp, "%shard %lld < %ssoft %lld", tag, hard, tag, |
| 239 | soft); |
| 240 | return false; |
| 241 | } |
| 242 | |
| 243 | res->hardlimit = hard; |
| 244 | res->softlimit = soft; |
| 245 | if (qlim) { |
| 246 | qlim->hard = hard; |
| 247 | qlim->soft = soft; |
| 248 | } |
| 249 | |
| 250 | return true; |
| 251 | } |
| 252 | |
| 253 | static inline void |
| 254 | xfs_setqlim_warns( |
| 255 | struct xfs_dquot_res *res, |
| 256 | struct xfs_quota_limits *qlim, |
| 257 | int warns) |
| 258 | { |
| 259 | res->warnings = warns; |
| 260 | if (qlim) |
| 261 | qlim->warn = warns; |
| 262 | } |
| 263 | |
| 264 | static inline void |
| 265 | xfs_setqlim_timer( |
Darrick J. Wong | 11d8a91 | 2020-08-17 09:58:36 -0700 | [diff] [blame] | 266 | struct xfs_mount *mp, |
Darrick J. Wong | d1520de | 2020-07-14 10:37:33 -0700 | [diff] [blame] | 267 | struct xfs_dquot_res *res, |
| 268 | struct xfs_quota_limits *qlim, |
| 269 | s64 timer) |
| 270 | { |
Darrick J. Wong | 11d8a91 | 2020-08-17 09:58:36 -0700 | [diff] [blame] | 271 | if (qlim) { |
| 272 | /* Set the length of the default grace period. */ |
Darrick J. Wong | ccc8e77 | 2020-08-17 09:58:42 -0700 | [diff] [blame] | 273 | res->timer = xfs_dquot_set_grace_period(timer); |
| 274 | qlim->time = res->timer; |
Darrick J. Wong | 11d8a91 | 2020-08-17 09:58:36 -0700 | [diff] [blame] | 275 | } else { |
| 276 | /* Set the grace period expiration on a quota. */ |
| 277 | res->timer = xfs_dquot_set_timeout(mp, timer); |
| 278 | } |
Darrick J. Wong | d1520de | 2020-07-14 10:37:33 -0700 | [diff] [blame] | 279 | } |
| 280 | |
| 281 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | * Adjust quota limits, and start/stop timers accordingly. |
| 283 | */ |
Christoph Hellwig | fcafb71 | 2009-02-09 08:47:34 +0100 | [diff] [blame] | 284 | int |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 285 | xfs_qm_scall_setqlim( |
Brian Foster | b136645 | 2013-03-18 10:51:46 -0400 | [diff] [blame] | 286 | struct xfs_mount *mp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | xfs_dqid_t id, |
Darrick J. Wong | 1a7ed27 | 2020-07-15 17:53:43 -0700 | [diff] [blame] | 288 | xfs_dqtype_t type, |
Jan Kara | 14bf61f | 2014-10-09 16:03:13 +0200 | [diff] [blame] | 289 | struct qc_dqblk *newlim) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | { |
Christoph Hellwig | 8a7b8a8 | 2010-04-20 17:01:30 +1000 | [diff] [blame] | 291 | struct xfs_quotainfo *q = mp->m_quotainfo; |
Brian Foster | b136645 | 2013-03-18 10:51:46 -0400 | [diff] [blame] | 292 | struct xfs_dquot *dqp; |
| 293 | struct xfs_trans *tp; |
Carlos Maiolino | be60794 | 2016-02-08 11:27:55 +1100 | [diff] [blame] | 294 | struct xfs_def_quota *defq; |
Darrick J. Wong | d1520de | 2020-07-14 10:37:33 -0700 | [diff] [blame] | 295 | struct xfs_dquot_res *res; |
| 296 | struct xfs_quota_limits *qlim; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | int error; |
| 298 | xfs_qcnt_t hard, soft; |
| 299 | |
Jan Kara | 14bf61f | 2014-10-09 16:03:13 +0200 | [diff] [blame] | 300 | if (newlim->d_fieldmask & ~XFS_QC_MASK) |
Dave Chinner | 2451337 | 2014-06-25 14:58:08 +1000 | [diff] [blame] | 301 | return -EINVAL; |
Jan Kara | 14bf61f | 2014-10-09 16:03:13 +0200 | [diff] [blame] | 302 | if ((newlim->d_fieldmask & XFS_QC_MASK) == 0) |
Christoph Hellwig | c472b43 | 2010-05-06 17:05:17 -0400 | [diff] [blame] | 303 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 304 | |
Dave Chinner | f648167 | 2013-05-21 18:02:00 +1000 | [diff] [blame] | 305 | /* |
| 306 | * We don't want to race with a quotaoff so take the quotaoff lock. |
| 307 | * We don't hold an inode lock, so there's nothing else to stop |
| 308 | * a quotaoff from happening. |
| 309 | */ |
| 310 | mutex_lock(&q->qi_quotaofflock); |
| 311 | |
| 312 | /* |
| 313 | * Get the dquot (locked) before we start, as we need to do a |
| 314 | * transaction to allocate it if it doesn't exist. Once we have the |
| 315 | * dquot, unlock it so we can start the next transaction safely. We hold |
| 316 | * a reference to the dquot, so it's safe to do this unlock/lock without |
| 317 | * it being reclaimed in the mean time. |
| 318 | */ |
Darrick J. Wong | 30ab2dc | 2018-05-04 15:30:24 -0700 | [diff] [blame] | 319 | error = xfs_qm_dqget(mp, id, type, true, &dqp); |
Dave Chinner | f648167 | 2013-05-21 18:02:00 +1000 | [diff] [blame] | 320 | if (error) { |
Dave Chinner | 2451337 | 2014-06-25 14:58:08 +1000 | [diff] [blame] | 321 | ASSERT(error != -ENOENT); |
Dave Chinner | f648167 | 2013-05-21 18:02:00 +1000 | [diff] [blame] | 322 | goto out_unlock; |
| 323 | } |
Carlos Maiolino | be60794 | 2016-02-08 11:27:55 +1100 | [diff] [blame] | 324 | |
Eric Sandeen | ce6e7e79c | 2020-05-21 13:07:00 -0700 | [diff] [blame] | 325 | defq = xfs_get_defquota(q, xfs_dquot_type(dqp)); |
Dave Chinner | f648167 | 2013-05-21 18:02:00 +1000 | [diff] [blame] | 326 | xfs_dqunlock(dqp); |
| 327 | |
Christoph Hellwig | 253f491 | 2016-04-06 09:19:55 +1000 | [diff] [blame] | 328 | error = xfs_trans_alloc(mp, &M_RES(mp)->tr_qm_setqlim, 0, 0, 0, &tp); |
| 329 | if (error) |
Dave Chinner | f648167 | 2013-05-21 18:02:00 +1000 | [diff] [blame] | 330 | goto out_rele; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 331 | |
Dave Chinner | f648167 | 2013-05-21 18:02:00 +1000 | [diff] [blame] | 332 | xfs_dqlock(dqp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 | xfs_trans_dqjoin(tp, dqp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | |
| 335 | /* |
Darrick J. Wong | d1520de | 2020-07-14 10:37:33 -0700 | [diff] [blame] | 336 | * Update quota limits, warnings, and timers, and the defaults |
| 337 | * if we're touching id == 0. |
| 338 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | * Make sure that hardlimits are >= soft limits before changing. |
Darrick J. Wong | d1520de | 2020-07-14 10:37:33 -0700 | [diff] [blame] | 340 | * |
| 341 | * Update warnings counter(s) if requested. |
| 342 | * |
Eric Sandeen | df42ce64 | 2020-05-21 13:07:01 -0700 | [diff] [blame] | 343 | * Timelimits for the super user set the relative time the other users |
| 344 | * can be over quota for this file system. If it is zero a default is |
| 345 | * used. Ditto for the default soft and hard limit values (already |
| 346 | * done, above), and for warnings. |
| 347 | * |
| 348 | * For other IDs, userspace can bump out the grace period if over |
| 349 | * the soft limit. |
| 350 | */ |
Eric Sandeen | df42ce64 | 2020-05-21 13:07:01 -0700 | [diff] [blame] | 351 | |
Darrick J. Wong | d1520de | 2020-07-14 10:37:33 -0700 | [diff] [blame] | 352 | /* Blocks on the data device. */ |
| 353 | hard = (newlim->d_fieldmask & QC_SPC_HARD) ? |
| 354 | (xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_spc_hardlimit) : |
| 355 | dqp->q_blk.hardlimit; |
| 356 | soft = (newlim->d_fieldmask & QC_SPC_SOFT) ? |
| 357 | (xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_spc_softlimit) : |
| 358 | dqp->q_blk.softlimit; |
| 359 | res = &dqp->q_blk; |
| 360 | qlim = id == 0 ? &defq->blk : NULL; |
| 361 | |
| 362 | if (xfs_setqlim_limits(mp, res, qlim, hard, soft, "blk")) |
| 363 | xfs_dquot_set_prealloc_limits(dqp); |
| 364 | if (newlim->d_fieldmask & QC_SPC_WARNS) |
| 365 | xfs_setqlim_warns(res, qlim, newlim->d_spc_warns); |
| 366 | if (newlim->d_fieldmask & QC_SPC_TIMER) |
Darrick J. Wong | 11d8a91 | 2020-08-17 09:58:36 -0700 | [diff] [blame] | 367 | xfs_setqlim_timer(mp, res, qlim, newlim->d_spc_timer); |
Darrick J. Wong | d1520de | 2020-07-14 10:37:33 -0700 | [diff] [blame] | 368 | |
| 369 | /* Blocks on the realtime device. */ |
| 370 | hard = (newlim->d_fieldmask & QC_RT_SPC_HARD) ? |
| 371 | (xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_rt_spc_hardlimit) : |
| 372 | dqp->q_rtb.hardlimit; |
| 373 | soft = (newlim->d_fieldmask & QC_RT_SPC_SOFT) ? |
| 374 | (xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_rt_spc_softlimit) : |
| 375 | dqp->q_rtb.softlimit; |
| 376 | res = &dqp->q_rtb; |
| 377 | qlim = id == 0 ? &defq->rtb : NULL; |
| 378 | |
| 379 | xfs_setqlim_limits(mp, res, qlim, hard, soft, "rtb"); |
| 380 | if (newlim->d_fieldmask & QC_RT_SPC_WARNS) |
| 381 | xfs_setqlim_warns(res, qlim, newlim->d_rt_spc_warns); |
| 382 | if (newlim->d_fieldmask & QC_RT_SPC_TIMER) |
Darrick J. Wong | 11d8a91 | 2020-08-17 09:58:36 -0700 | [diff] [blame] | 383 | xfs_setqlim_timer(mp, res, qlim, newlim->d_rt_spc_timer); |
Darrick J. Wong | d1520de | 2020-07-14 10:37:33 -0700 | [diff] [blame] | 384 | |
| 385 | /* Inodes */ |
| 386 | hard = (newlim->d_fieldmask & QC_INO_HARD) ? |
| 387 | (xfs_qcnt_t) newlim->d_ino_hardlimit : |
| 388 | dqp->q_ino.hardlimit; |
| 389 | soft = (newlim->d_fieldmask & QC_INO_SOFT) ? |
| 390 | (xfs_qcnt_t) newlim->d_ino_softlimit : |
| 391 | dqp->q_ino.softlimit; |
| 392 | res = &dqp->q_ino; |
| 393 | qlim = id == 0 ? &defq->ino : NULL; |
| 394 | |
| 395 | xfs_setqlim_limits(mp, res, qlim, hard, soft, "ino"); |
| 396 | if (newlim->d_fieldmask & QC_INO_WARNS) |
| 397 | xfs_setqlim_warns(res, qlim, newlim->d_ino_warns); |
| 398 | if (newlim->d_fieldmask & QC_INO_TIMER) |
Darrick J. Wong | 11d8a91 | 2020-08-17 09:58:36 -0700 | [diff] [blame] | 399 | xfs_setqlim_timer(mp, res, qlim, newlim->d_ino_timer); |
Eric Sandeen | df42ce64 | 2020-05-21 13:07:01 -0700 | [diff] [blame] | 400 | |
| 401 | if (id != 0) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 402 | /* |
| 403 | * If the user is now over quota, start the timelimit. |
| 404 | * The user will not be 'warned'. |
| 405 | * Note that we keep the timers ticking, whether enforcement |
| 406 | * is on or off. We don't really want to bother with iterating |
| 407 | * over all ondisk dquots and turning the timers on/off. |
| 408 | */ |
Darrick J. Wong | c8c753e | 2020-07-14 10:37:33 -0700 | [diff] [blame] | 409 | xfs_qm_adjust_dqtimers(dqp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 410 | } |
Darrick J. Wong | 985a78f | 2020-07-14 10:37:13 -0700 | [diff] [blame] | 411 | dqp->q_flags |= XFS_DQFLAG_DIRTY; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 412 | xfs_trans_log_dquot(tp, dqp); |
| 413 | |
Christoph Hellwig | 7039331 | 2015-06-04 13:48:08 +1000 | [diff] [blame] | 414 | error = xfs_trans_commit(tp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 415 | |
Dave Chinner | f648167 | 2013-05-21 18:02:00 +1000 | [diff] [blame] | 416 | out_rele: |
| 417 | xfs_qm_dqrele(dqp); |
| 418 | out_unlock: |
Christoph Hellwig | 8a7b8a8 | 2010-04-20 17:01:30 +1000 | [diff] [blame] | 419 | mutex_unlock(&q->qi_quotaofflock); |
David Chinner | e5720ee | 2008-04-10 12:21:18 +1000 | [diff] [blame] | 420 | return error; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 421 | } |
| 422 | |
Darrick J. Wong | 2e330e7 | 2018-05-04 15:30:20 -0700 | [diff] [blame] | 423 | /* Fill out the quota context. */ |
| 424 | static void |
| 425 | xfs_qm_scall_getquota_fill_qc( |
Christoph Hellwig | 18535a7 | 2012-02-20 02:28:16 +0000 | [diff] [blame] | 426 | struct xfs_mount *mp, |
Darrick J. Wong | 1a7ed27 | 2020-07-15 17:53:43 -0700 | [diff] [blame] | 427 | xfs_dqtype_t type, |
Darrick J. Wong | 2e330e7 | 2018-05-04 15:30:20 -0700 | [diff] [blame] | 428 | const struct xfs_dquot *dqp, |
| 429 | struct qc_dqblk *dst) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 430 | { |
| 431 | memset(dst, 0, sizeof(*dst)); |
Darrick J. Wong | d3537cf | 2020-07-14 10:37:31 -0700 | [diff] [blame] | 432 | dst->d_spc_hardlimit = XFS_FSB_TO_B(mp, dqp->q_blk.hardlimit); |
| 433 | dst->d_spc_softlimit = XFS_FSB_TO_B(mp, dqp->q_blk.softlimit); |
Darrick J. Wong | 19dce7e | 2020-07-14 10:37:32 -0700 | [diff] [blame] | 434 | dst->d_ino_hardlimit = dqp->q_ino.hardlimit; |
| 435 | dst->d_ino_softlimit = dqp->q_ino.softlimit; |
Darrick J. Wong | 784e80f | 2020-07-14 10:37:30 -0700 | [diff] [blame] | 436 | dst->d_space = XFS_FSB_TO_B(mp, dqp->q_blk.reserved); |
| 437 | dst->d_ino_count = dqp->q_ino.reserved; |
Darrick J. Wong | 19dce7e | 2020-07-14 10:37:32 -0700 | [diff] [blame] | 438 | dst->d_spc_timer = dqp->q_blk.timer; |
| 439 | dst->d_ino_timer = dqp->q_ino.timer; |
Darrick J. Wong | c8c45fb | 2020-07-14 10:37:31 -0700 | [diff] [blame] | 440 | dst->d_ino_warns = dqp->q_ino.warnings; |
| 441 | dst->d_spc_warns = dqp->q_blk.warnings; |
Darrick J. Wong | d3537cf | 2020-07-14 10:37:31 -0700 | [diff] [blame] | 442 | dst->d_rt_spc_hardlimit = XFS_FSB_TO_B(mp, dqp->q_rtb.hardlimit); |
| 443 | dst->d_rt_spc_softlimit = XFS_FSB_TO_B(mp, dqp->q_rtb.softlimit); |
Darrick J. Wong | 784e80f | 2020-07-14 10:37:30 -0700 | [diff] [blame] | 444 | dst->d_rt_space = XFS_FSB_TO_B(mp, dqp->q_rtb.reserved); |
Darrick J. Wong | 19dce7e | 2020-07-14 10:37:32 -0700 | [diff] [blame] | 445 | dst->d_rt_spc_timer = dqp->q_rtb.timer; |
Darrick J. Wong | c8c45fb | 2020-07-14 10:37:31 -0700 | [diff] [blame] | 446 | dst->d_rt_spc_warns = dqp->q_rtb.warnings; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 | |
| 448 | /* |
| 449 | * Internally, we don't reset all the timers when quota enforcement |
Nathan Scott | c41564b | 2006-03-29 08:55:14 +1000 | [diff] [blame] | 450 | * gets turned off. No need to confuse the user level code, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 451 | * so return zeroes in that case. |
| 452 | */ |
Darrick J. Wong | dbcbc7b | 2020-07-15 17:48:31 -0700 | [diff] [blame] | 453 | if (!xfs_dquot_is_enforced(dqp)) { |
Jan Kara | 14bf61f | 2014-10-09 16:03:13 +0200 | [diff] [blame] | 454 | dst->d_spc_timer = 0; |
| 455 | dst->d_ino_timer = 0; |
| 456 | dst->d_rt_spc_timer = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 457 | } |
| 458 | |
| 459 | #ifdef DEBUG |
Darrick J. Wong | dbcbc7b | 2020-07-15 17:48:31 -0700 | [diff] [blame] | 460 | if (xfs_dquot_is_enforced(dqp) && dqp->q_id != 0) { |
Jan Kara | 14bf61f | 2014-10-09 16:03:13 +0200 | [diff] [blame] | 461 | if ((dst->d_space > dst->d_spc_softlimit) && |
| 462 | (dst->d_spc_softlimit > 0)) { |
| 463 | ASSERT(dst->d_spc_timer != 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | } |
Darrick J. Wong | d3537cf | 2020-07-14 10:37:31 -0700 | [diff] [blame] | 465 | if ((dst->d_ino_count > dqp->q_ino.softlimit) && |
| 466 | (dqp->q_ino.softlimit > 0)) { |
Jan Kara | 14bf61f | 2014-10-09 16:03:13 +0200 | [diff] [blame] | 467 | ASSERT(dst->d_ino_timer != 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 468 | } |
| 469 | } |
| 470 | #endif |
Darrick J. Wong | 2e330e7 | 2018-05-04 15:30:20 -0700 | [diff] [blame] | 471 | } |
| 472 | |
| 473 | /* Return the quota information for the dquot matching id. */ |
| 474 | int |
| 475 | xfs_qm_scall_getquota( |
| 476 | struct xfs_mount *mp, |
| 477 | xfs_dqid_t id, |
Darrick J. Wong | 1a7ed27 | 2020-07-15 17:53:43 -0700 | [diff] [blame] | 478 | xfs_dqtype_t type, |
Darrick J. Wong | 2e330e7 | 2018-05-04 15:30:20 -0700 | [diff] [blame] | 479 | struct qc_dqblk *dst) |
| 480 | { |
| 481 | struct xfs_dquot *dqp; |
| 482 | int error; |
| 483 | |
Darrick J. Wong | 01e8f37 | 2021-08-06 11:05:42 -0700 | [diff] [blame] | 484 | /* Flush inodegc work at the start of a quota reporting scan. */ |
| 485 | if (id == 0) |
| 486 | xfs_inodegc_flush(mp); |
| 487 | |
Darrick J. Wong | 2e330e7 | 2018-05-04 15:30:20 -0700 | [diff] [blame] | 488 | /* |
Darrick J. Wong | 30ab2dc | 2018-05-04 15:30:24 -0700 | [diff] [blame] | 489 | * Try to get the dquot. We don't want it allocated on disk, so don't |
| 490 | * set doalloc. If it doesn't exist, we'll get ENOENT back. |
Darrick J. Wong | 2e330e7 | 2018-05-04 15:30:20 -0700 | [diff] [blame] | 491 | */ |
Darrick J. Wong | 30ab2dc | 2018-05-04 15:30:24 -0700 | [diff] [blame] | 492 | error = xfs_qm_dqget(mp, id, type, false, &dqp); |
Darrick J. Wong | 2e330e7 | 2018-05-04 15:30:20 -0700 | [diff] [blame] | 493 | if (error) |
| 494 | return error; |
| 495 | |
| 496 | /* |
| 497 | * If everything's NULL, this dquot doesn't quite exist as far as |
| 498 | * our utility programs are concerned. |
| 499 | */ |
| 500 | if (XFS_IS_DQUOT_UNINITIALIZED(dqp)) { |
| 501 | error = -ENOENT; |
| 502 | goto out_put; |
| 503 | } |
| 504 | |
| 505 | xfs_qm_scall_getquota_fill_qc(mp, type, dqp, dst); |
| 506 | |
Christoph Hellwig | 18535a7 | 2012-02-20 02:28:16 +0000 | [diff] [blame] | 507 | out_put: |
| 508 | xfs_qm_dqput(dqp); |
| 509 | return error; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 510 | } |
| 511 | |
Darrick J. Wong | 2e330e7 | 2018-05-04 15:30:20 -0700 | [diff] [blame] | 512 | /* |
| 513 | * Return the quota information for the first initialized dquot whose id |
| 514 | * is at least as high as id. |
| 515 | */ |
| 516 | int |
| 517 | xfs_qm_scall_getquota_next( |
| 518 | struct xfs_mount *mp, |
| 519 | xfs_dqid_t *id, |
Darrick J. Wong | 1a7ed27 | 2020-07-15 17:53:43 -0700 | [diff] [blame] | 520 | xfs_dqtype_t type, |
Darrick J. Wong | 2e330e7 | 2018-05-04 15:30:20 -0700 | [diff] [blame] | 521 | struct qc_dqblk *dst) |
| 522 | { |
| 523 | struct xfs_dquot *dqp; |
| 524 | int error; |
| 525 | |
Darrick J. Wong | 01e8f37 | 2021-08-06 11:05:42 -0700 | [diff] [blame] | 526 | /* Flush inodegc work at the start of a quota reporting scan. */ |
| 527 | if (*id == 0) |
| 528 | xfs_inodegc_flush(mp); |
| 529 | |
Darrick J. Wong | 2e330e7 | 2018-05-04 15:30:20 -0700 | [diff] [blame] | 530 | error = xfs_qm_dqget_next(mp, *id, type, &dqp); |
| 531 | if (error) |
| 532 | return error; |
| 533 | |
| 534 | /* Fill in the ID we actually read from disk */ |
Darrick J. Wong | c51df73 | 2020-07-14 10:37:30 -0700 | [diff] [blame] | 535 | *id = dqp->q_id; |
Darrick J. Wong | 2e330e7 | 2018-05-04 15:30:20 -0700 | [diff] [blame] | 536 | |
| 537 | xfs_qm_scall_getquota_fill_qc(mp, type, dqp, dst); |
| 538 | |
| 539 | xfs_qm_dqput(dqp); |
| 540 | return error; |
| 541 | } |