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

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

Pull xfs fixes from Darrick Wong:
"Here are a few more bug fixes & cleanups for 4.15-rc4:

- clean up duplicate includes

- remove ancient 'no-alloc' crap code that occasionally caused hard
fs shutdowns due to lack of proper space reservations

- fix regression in FIEMAP behavior when reporting xattr extents"

* tag 'xfs-4.15-fixes-5' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
xfs: make iomap_begin functions trim iomaps consistently
xfs: remove "no-allocation" reservations for file creations
fs: xfs: remove duplicate includes

+15 -57
+3 -7
fs/xfs/libxfs/xfs_ialloc.c
··· 920 920 xfs_ialloc_ag_select( 921 921 xfs_trans_t *tp, /* transaction pointer */ 922 922 xfs_ino_t parent, /* parent directory inode number */ 923 - umode_t mode, /* bits set to indicate file type */ 924 - int okalloc) /* ok to allocate more space */ 923 + umode_t mode) /* bits set to indicate file type */ 925 924 { 926 925 xfs_agnumber_t agcount; /* number of ag's in the filesystem */ 927 926 xfs_agnumber_t agno; /* current ag number */ ··· 976 977 xfs_perag_put(pag); 977 978 return agno; 978 979 } 979 - 980 - if (!okalloc) 981 - goto nextag; 982 980 983 981 if (!pag->pagf_init) { 984 982 error = xfs_alloc_pagf_init(mp, tp, agno, flags); ··· 1676 1680 struct xfs_trans *tp, 1677 1681 xfs_ino_t parent, 1678 1682 umode_t mode, 1679 - int okalloc, 1680 1683 struct xfs_buf **IO_agbp, 1681 1684 xfs_ino_t *inop) 1682 1685 { ··· 1687 1692 int noroom = 0; 1688 1693 xfs_agnumber_t start_agno; 1689 1694 struct xfs_perag *pag; 1695 + int okalloc = 1; 1690 1696 1691 1697 if (*IO_agbp) { 1692 1698 /* ··· 1703 1707 * We do not have an agbp, so select an initial allocation 1704 1708 * group for inode allocation. 1705 1709 */ 1706 - start_agno = xfs_ialloc_ag_select(tp, parent, mode, okalloc); 1710 + start_agno = xfs_ialloc_ag_select(tp, parent, mode); 1707 1711 if (start_agno == NULLAGNUMBER) { 1708 1712 *inop = NULLFSINO; 1709 1713 return 0;
-1
fs/xfs/libxfs/xfs_ialloc.h
··· 81 81 struct xfs_trans *tp, /* transaction pointer */ 82 82 xfs_ino_t parent, /* parent inode (directory) */ 83 83 umode_t mode, /* mode bits for new inode */ 84 - int okalloc, /* ok to allocate more space */ 85 84 struct xfs_buf **agbp, /* buf for a.g. inode header */ 86 85 xfs_ino_t *inop); /* inode number allocated */ 87 86
-1
fs/xfs/scrub/scrub.c
··· 46 46 #include "scrub/scrub.h" 47 47 #include "scrub/common.h" 48 48 #include "scrub/trace.h" 49 - #include "scrub/scrub.h" 50 49 #include "scrub/btree.h" 51 50 52 51 /*
-1
fs/xfs/scrub/trace.c
··· 26 26 #include "xfs_mount.h" 27 27 #include "xfs_defer.h" 28 28 #include "xfs_da_format.h" 29 - #include "xfs_defer.h" 30 29 #include "xfs_inode.h" 31 30 #include "xfs_btree.h" 32 31 #include "xfs_trans.h"
+7 -26
fs/xfs/xfs_inode.c
··· 749 749 xfs_nlink_t nlink, 750 750 dev_t rdev, 751 751 prid_t prid, 752 - int okalloc, 753 752 xfs_buf_t **ialloc_context, 754 753 xfs_inode_t **ipp) 755 754 { ··· 764 765 * Call the space management code to pick 765 766 * the on-disk inode to be allocated. 766 767 */ 767 - error = xfs_dialloc(tp, pip ? pip->i_ino : 0, mode, okalloc, 768 + error = xfs_dialloc(tp, pip ? pip->i_ino : 0, mode, 768 769 ialloc_context, &ino); 769 770 if (error) 770 771 return error; ··· 956 957 xfs_nlink_t nlink, 957 958 dev_t rdev, 958 959 prid_t prid, /* project id */ 959 - int okalloc, /* ok to allocate new space */ 960 960 xfs_inode_t **ipp, /* pointer to inode; it will be 961 961 locked. */ 962 962 int *committed) ··· 986 988 * transaction commit so that no other process can steal 987 989 * the inode(s) that we've just allocated. 988 990 */ 989 - code = xfs_ialloc(tp, dp, mode, nlink, rdev, prid, okalloc, 990 - &ialloc_context, &ip); 991 + code = xfs_ialloc(tp, dp, mode, nlink, rdev, prid, &ialloc_context, 992 + &ip); 991 993 992 994 /* 993 995 * Return an error if we were unable to allocate a new inode. ··· 1059 1061 * this call should always succeed. 1060 1062 */ 1061 1063 code = xfs_ialloc(tp, dp, mode, nlink, rdev, prid, 1062 - okalloc, &ialloc_context, &ip); 1064 + &ialloc_context, &ip); 1063 1065 1064 1066 /* 1065 1067 * If we get an error at this point, return to the caller ··· 1180 1182 xfs_flush_inodes(mp); 1181 1183 error = xfs_trans_alloc(mp, tres, resblks, 0, 0, &tp); 1182 1184 } 1183 - if (error == -ENOSPC) { 1184 - /* No space at all so try a "no-allocation" reservation */ 1185 - resblks = 0; 1186 - error = xfs_trans_alloc(mp, tres, 0, 0, 0, &tp); 1187 - } 1188 1185 if (error) 1189 1186 goto out_release_inode; 1190 1187 ··· 1196 1203 if (error) 1197 1204 goto out_trans_cancel; 1198 1205 1199 - if (!resblks) { 1200 - error = xfs_dir_canenter(tp, dp, name); 1201 - if (error) 1202 - goto out_trans_cancel; 1203 - } 1204 - 1205 1206 /* 1206 1207 * A newly created regular or special file just has one directory 1207 1208 * entry pointing to them, but a directory also the "." entry 1208 1209 * pointing to itself. 1209 1210 */ 1210 - error = xfs_dir_ialloc(&tp, dp, mode, is_dir ? 2 : 1, rdev, 1211 - prid, resblks > 0, &ip, NULL); 1211 + error = xfs_dir_ialloc(&tp, dp, mode, is_dir ? 2 : 1, rdev, prid, &ip, 1212 + NULL); 1212 1213 if (error) 1213 1214 goto out_trans_cancel; 1214 1215 ··· 1327 1340 tres = &M_RES(mp)->tr_create_tmpfile; 1328 1341 1329 1342 error = xfs_trans_alloc(mp, tres, resblks, 0, 0, &tp); 1330 - if (error == -ENOSPC) { 1331 - /* No space at all so try a "no-allocation" reservation */ 1332 - resblks = 0; 1333 - error = xfs_trans_alloc(mp, tres, 0, 0, 0, &tp); 1334 - } 1335 1343 if (error) 1336 1344 goto out_release_inode; 1337 1345 ··· 1335 1353 if (error) 1336 1354 goto out_trans_cancel; 1337 1355 1338 - error = xfs_dir_ialloc(&tp, dp, mode, 1, 0, 1339 - prid, resblks > 0, &ip, NULL); 1356 + error = xfs_dir_ialloc(&tp, dp, mode, 1, 0, prid, &ip, NULL); 1340 1357 if (error) 1341 1358 goto out_trans_cancel; 1342 1359
+1 -1
fs/xfs/xfs_inode.h
··· 428 428 xfs_extlen_t xfs_get_cowextsz_hint(struct xfs_inode *ip); 429 429 430 430 int xfs_dir_ialloc(struct xfs_trans **, struct xfs_inode *, umode_t, 431 - xfs_nlink_t, dev_t, prid_t, int, 431 + xfs_nlink_t, dev_t, prid_t, 432 432 struct xfs_inode **, int *); 433 433 434 434 /* from xfs_file.c */
+1 -1
fs/xfs/xfs_iomap.c
··· 1213 1213 1214 1214 ASSERT(ip->i_d.di_aformat != XFS_DINODE_FMT_LOCAL); 1215 1215 error = xfs_bmapi_read(ip, offset_fsb, end_fsb - offset_fsb, &imap, 1216 - &nimaps, XFS_BMAPI_ENTIRE | XFS_BMAPI_ATTRFORK); 1216 + &nimaps, XFS_BMAPI_ATTRFORK); 1217 1217 out_unlock: 1218 1218 xfs_iunlock(ip, lockmode); 1219 1219
+2 -2
fs/xfs/xfs_qm.c
··· 793 793 return error; 794 794 795 795 if (need_alloc) { 796 - error = xfs_dir_ialloc(&tp, NULL, S_IFREG, 1, 0, 0, 1, ip, 797 - &committed); 796 + error = xfs_dir_ialloc(&tp, NULL, S_IFREG, 1, 0, 0, ip, 797 + &committed); 798 798 if (error) { 799 799 xfs_trans_cancel(tp); 800 800 return error;
-2
fs/xfs/xfs_reflink.c
··· 49 49 #include "xfs_alloc.h" 50 50 #include "xfs_quota_defs.h" 51 51 #include "xfs_quota.h" 52 - #include "xfs_btree.h" 53 - #include "xfs_bmap_btree.h" 54 52 #include "xfs_reflink.h" 55 53 #include "xfs_iomap.h" 56 54 #include "xfs_rmap_btree.h"
+1 -14
fs/xfs/xfs_symlink.c
··· 232 232 resblks = XFS_SYMLINK_SPACE_RES(mp, link_name->len, fs_blocks); 233 233 234 234 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_symlink, resblks, 0, 0, &tp); 235 - if (error == -ENOSPC && fs_blocks == 0) { 236 - resblks = 0; 237 - error = xfs_trans_alloc(mp, &M_RES(mp)->tr_symlink, 0, 0, 0, 238 - &tp); 239 - } 240 235 if (error) 241 236 goto out_release_inode; 242 237 ··· 255 260 goto out_trans_cancel; 256 261 257 262 /* 258 - * Check for ability to enter directory entry, if no space reserved. 259 - */ 260 - if (!resblks) { 261 - error = xfs_dir_canenter(tp, dp, link_name); 262 - if (error) 263 - goto out_trans_cancel; 264 - } 265 - /* 266 263 * Initialize the bmap freelist prior to calling either 267 264 * bmapi or the directory create code. 268 265 */ ··· 264 277 * Allocate an inode for the symlink. 265 278 */ 266 279 error = xfs_dir_ialloc(&tp, dp, S_IFLNK | (mode & ~S_IFMT), 1, 0, 267 - prid, resblks > 0, &ip, NULL); 280 + prid, &ip, NULL); 268 281 if (error) 269 282 goto out_trans_cancel; 270 283
-1
fs/xfs/xfs_trace.c
··· 24 24 #include "xfs_mount.h" 25 25 #include "xfs_defer.h" 26 26 #include "xfs_da_format.h" 27 - #include "xfs_defer.h" 28 27 #include "xfs_inode.h" 29 28 #include "xfs_btree.h" 30 29 #include "xfs_da_btree.h"