Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'xfs-5.12-fixes-3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux

Pull xfs fixes from Darrick Wong:
"A couple of minor corrections for the new idmapping functionality, and
a fix for a theoretical hang that could occur if we decide to abort a
mount after dirtying the quota inodes.

Summary:

- Fix quota accounting on creat() when id mapping is enabled

- Actually reclaim dirty quota inodes when mount fails

- Typo fixes for documentation

- Restrict both bulkstat calls on idmapped/namespaced mounts"

* tag 'xfs-5.12-fixes-3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
xfs: also reject BULKSTAT_SINGLE in a mount user namespace
docs: ABI: Fix the spelling oustanding to outstanding in the file sysfs-fs-xfs
xfs: force log and push AIL to clear pinned inodes when aborting mount
xfs: fix quota accounting when a mount is idmapped

+61 -54
+1 -1
Documentation/ABI/testing/sysfs-fs-xfs
··· 33 33 Description: 34 34 The current state of the log write grant head. It 35 35 represents the total log reservation of all currently 36 - oustanding transactions, including regrants due to 36 + outstanding transactions, including regrants due to 37 37 rolling transactions. The grant head is exported in 38 38 "cycle:bytes" format. 39 39 Users: xfstests
+8 -6
fs/xfs/xfs_inode.c
··· 1007 1007 /* 1008 1008 * Make sure that we have allocated dquot(s) on disk. 1009 1009 */ 1010 - error = xfs_qm_vop_dqalloc(dp, current_fsuid(), current_fsgid(), prid, 1011 - XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, 1012 - &udqp, &gdqp, &pdqp); 1010 + error = xfs_qm_vop_dqalloc(dp, fsuid_into_mnt(mnt_userns), 1011 + fsgid_into_mnt(mnt_userns), prid, 1012 + XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, 1013 + &udqp, &gdqp, &pdqp); 1013 1014 if (error) 1014 1015 return error; 1015 1016 ··· 1158 1157 /* 1159 1158 * Make sure that we have allocated dquot(s) on disk. 1160 1159 */ 1161 - error = xfs_qm_vop_dqalloc(dp, current_fsuid(), current_fsgid(), prid, 1162 - XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, 1163 - &udqp, &gdqp, &pdqp); 1160 + error = xfs_qm_vop_dqalloc(dp, fsuid_into_mnt(mnt_userns), 1161 + fsgid_into_mnt(mnt_userns), prid, 1162 + XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, 1163 + &udqp, &gdqp, &pdqp); 1164 1164 if (error) 1165 1165 return error; 1166 1166
+6
fs/xfs/xfs_itable.c
··· 168 168 }; 169 169 int error; 170 170 171 + if (breq->mnt_userns != &init_user_ns) { 172 + xfs_warn_ratelimited(breq->mp, 173 + "bulkstat not supported inside of idmapped mounts."); 174 + return -EINVAL; 175 + } 176 + 171 177 ASSERT(breq->icount == 1); 172 178 173 179 bc.buf = kmem_zalloc(sizeof(struct xfs_bulkstat),
+44 -46
fs/xfs/xfs_mount.c
··· 635 635 } 636 636 637 637 /* 638 + * Flush and reclaim dirty inodes in preparation for unmount. Inodes and 639 + * internal inode structures can be sitting in the CIL and AIL at this point, 640 + * so we need to unpin them, write them back and/or reclaim them before unmount 641 + * can proceed. 642 + * 643 + * An inode cluster that has been freed can have its buffer still pinned in 644 + * memory because the transaction is still sitting in a iclog. The stale inodes 645 + * on that buffer will be pinned to the buffer until the transaction hits the 646 + * disk and the callbacks run. Pushing the AIL will skip the stale inodes and 647 + * may never see the pinned buffer, so nothing will push out the iclog and 648 + * unpin the buffer. 649 + * 650 + * Hence we need to force the log to unpin everything first. However, log 651 + * forces don't wait for the discards they issue to complete, so we have to 652 + * explicitly wait for them to complete here as well. 653 + * 654 + * Then we can tell the world we are unmounting so that error handling knows 655 + * that the filesystem is going away and we should error out anything that we 656 + * have been retrying in the background. This will prevent never-ending 657 + * retries in AIL pushing from hanging the unmount. 658 + * 659 + * Finally, we can push the AIL to clean all the remaining dirty objects, then 660 + * reclaim the remaining inodes that are still in memory at this point in time. 661 + */ 662 + static void 663 + xfs_unmount_flush_inodes( 664 + struct xfs_mount *mp) 665 + { 666 + xfs_log_force(mp, XFS_LOG_SYNC); 667 + xfs_extent_busy_wait_all(mp); 668 + flush_workqueue(xfs_discard_wq); 669 + 670 + mp->m_flags |= XFS_MOUNT_UNMOUNTING; 671 + 672 + xfs_ail_push_all_sync(mp->m_ail); 673 + cancel_delayed_work_sync(&mp->m_reclaim_work); 674 + xfs_reclaim_inodes(mp); 675 + xfs_health_unmount(mp); 676 + } 677 + 678 + /* 638 679 * This function does the following on an initial mount of a file system: 639 680 * - reads the superblock from disk and init the mount struct 640 681 * - if we're a 32-bit kernel, do a size check on the superblock ··· 1049 1008 /* Clean out dquots that might be in memory after quotacheck. */ 1050 1009 xfs_qm_unmount(mp); 1051 1010 /* 1052 - * Cancel all delayed reclaim work and reclaim the inodes directly. 1011 + * Flush all inode reclamation work and flush the log. 1053 1012 * We have to do this /after/ rtunmount and qm_unmount because those 1054 1013 * two will have scheduled delayed reclaim for the rt/quota inodes. 1055 1014 * ··· 1059 1018 * qm_unmount_quotas and therefore rely on qm_unmount to release the 1060 1019 * quota inodes. 1061 1020 */ 1062 - cancel_delayed_work_sync(&mp->m_reclaim_work); 1063 - xfs_reclaim_inodes(mp); 1064 - xfs_health_unmount(mp); 1021 + xfs_unmount_flush_inodes(mp); 1065 1022 out_log_dealloc: 1066 - mp->m_flags |= XFS_MOUNT_UNMOUNTING; 1067 1023 xfs_log_mount_cancel(mp); 1068 1024 out_fail_wait: 1069 1025 if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) ··· 1101 1063 xfs_rtunmount_inodes(mp); 1102 1064 xfs_irele(mp->m_rootip); 1103 1065 1104 - /* 1105 - * We can potentially deadlock here if we have an inode cluster 1106 - * that has been freed has its buffer still pinned in memory because 1107 - * the transaction is still sitting in a iclog. The stale inodes 1108 - * on that buffer will be pinned to the buffer until the 1109 - * transaction hits the disk and the callbacks run. Pushing the AIL will 1110 - * skip the stale inodes and may never see the pinned buffer, so 1111 - * nothing will push out the iclog and unpin the buffer. Hence we 1112 - * need to force the log here to ensure all items are flushed into the 1113 - * AIL before we go any further. 1114 - */ 1115 - xfs_log_force(mp, XFS_LOG_SYNC); 1116 - 1117 - /* 1118 - * Wait for all busy extents to be freed, including completion of 1119 - * any discard operation. 1120 - */ 1121 - xfs_extent_busy_wait_all(mp); 1122 - flush_workqueue(xfs_discard_wq); 1123 - 1124 - /* 1125 - * We now need to tell the world we are unmounting. This will allow 1126 - * us to detect that the filesystem is going away and we should error 1127 - * out anything that we have been retrying in the background. This will 1128 - * prevent neverending retries in AIL pushing from hanging the unmount. 1129 - */ 1130 - mp->m_flags |= XFS_MOUNT_UNMOUNTING; 1131 - 1132 - /* 1133 - * Flush all pending changes from the AIL. 1134 - */ 1135 - xfs_ail_push_all_sync(mp->m_ail); 1136 - 1137 - /* 1138 - * Reclaim all inodes. At this point there should be no dirty inodes and 1139 - * none should be pinned or locked. Stop background inode reclaim here 1140 - * if it is still running. 1141 - */ 1142 - cancel_delayed_work_sync(&mp->m_reclaim_work); 1143 - xfs_reclaim_inodes(mp); 1144 - xfs_health_unmount(mp); 1066 + xfs_unmount_flush_inodes(mp); 1145 1067 1146 1068 xfs_qm_unmount(mp); 1147 1069
+2 -1
fs/xfs/xfs_symlink.c
··· 182 182 /* 183 183 * Make sure that we have allocated dquot(s) on disk. 184 184 */ 185 - error = xfs_qm_vop_dqalloc(dp, current_fsuid(), current_fsgid(), prid, 185 + error = xfs_qm_vop_dqalloc(dp, fsuid_into_mnt(mnt_userns), 186 + fsgid_into_mnt(mnt_userns), prid, 186 187 XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, 187 188 &udqp, &gdqp, &pdqp); 188 189 if (error)