remarkable-linux/fs/xfs
David Chinner a7444053fb [XFS] Account for allocated blocks when expanding directories
When we create a directory, we reserve a number of blocks for the maximum
possible expansion of of the directory due to various btree splits,
freespace allocation, etc. Unfortunately, each allocation is not reflected
in the total number of blocks still available to the transaction, so the
maximal reservation is used over and over again.

This leads to problems where an allocation group has only enough blocks
for *some* of the allocations required for the directory modification.
After the first N allocations, the remaining blocks in the allocation
group drops below the total reservation, and subsequent allocations fail
because the allocator will not allow the allocation to proceed if the AG
does not have the enough blocks available for the entire allocation total.

This results in an ENOSPC occurring after an allocation has already
occurred. This results in aborting the directory operation (leaving the
directory in an inconsistent state) and cancelling a dirty transaction,
which results in a filesystem shutdown.

Avoid the problem by reflecting the number of blocks allocated in any
directory expansion in the total number of blocks available to the
modification in progress. This prevents a directory modification from
being aborted part way through with an ENOSPC.

SGI-PV: 988144

SGI-Modid: xfs-linux-melb:xfs-kern:32340a

Signed-off-by: David Chinner <david@fromorbit.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
2008-10-30 17:38:12 +11:00
..
linux-2.6 [XFS] Prevent looping in xfs_sync_inodes_ag 2008-10-30 17:38:00 +11:00
quota [XFS] Kill xfs_sync() 2008-10-30 17:16:11 +11:00
support [XFS] Show buffer address with debug hexdump on corruption 2008-10-30 17:05:58 +11:00
Kconfig [XFS] allow enabling CONFIG_XFS_DEBUG 2008-04-29 16:07:48 +10:00
Makefile [XFS] move sync code to its own file 2008-10-30 17:06:08 +11:00
xfs.h [XFS] make btree tracing generic 2008-10-30 16:55:13 +11:00
xfs_acl.c [XFS] kill bhv_vnode_t 2008-08-13 16:22:40 +10:00
xfs_acl.h [XFS] kill bhv_vnode_t 2008-08-13 16:22:40 +10:00
xfs_ag.h [XFS] mark inodes for reclaim via a tag in the inode radix tree 2008-10-30 17:37:26 +11:00
xfs_alloc.c [XFS] Always use struct xfs_btree_block instead of short / longform 2008-10-30 17:14:34 +11:00
xfs_alloc.h [XFS] Sync up kernel and user-space headers 2008-10-30 17:05:38 +11:00
xfs_alloc_btree.c [XFS] Always use struct xfs_btree_block instead of short / longform 2008-10-30 17:14:34 +11:00
xfs_alloc_btree.h [XFS] Always use struct xfs_btree_block instead of short / longform 2008-10-30 17:14:34 +11:00
xfs_arch.h [XFS] Sync up kernel and user-space headers 2008-10-30 17:05:38 +11:00
xfs_attr.c [XFS] Move xfs_attr_rolltrans to xfs_trans_roll 2008-08-13 16:05:49 +10:00
xfs_attr.h [XFS] Move attr log alloc size calculator to another function. 2008-08-13 16:03:35 +10:00
xfs_attr_leaf.c [XFS] Move xfs_attr_rolltrans to xfs_trans_roll 2008-08-13 16:05:49 +10:00
xfs_attr_leaf.h [XFS] Move xfs_attr_rolltrans to xfs_trans_roll 2008-08-13 16:05:49 +10:00
xfs_attr_sf.h [XFS] 2008-07-28 16:58:35 +10:00
xfs_bit.c [XFS] Use the generic bitops rather than implementing them ourselves. 2008-08-13 15:41:12 +10:00
xfs_bit.h [XFS] Sync up kernel and user-space headers 2008-10-30 17:05:38 +11:00
xfs_bmap.c [XFS] Move XFS_BMAP_SANITY_CHECK out of line. 2008-10-30 17:14:43 +11:00
xfs_bmap.h [XFS] Sync up kernel and user-space headers 2008-10-30 17:05:38 +11:00
xfs_bmap_btree.c [XFS] Always use struct xfs_btree_block instead of short / longform 2008-10-30 17:14:34 +11:00
xfs_bmap_btree.h [XFS] Move XFS_BMAP_SANITY_CHECK out of line. 2008-10-30 17:14:43 +11:00
xfs_btree.c [XFS] Always use struct xfs_btree_block instead of short / longform 2008-10-30 17:14:34 +11:00
xfs_btree.h [XFS] Always use struct xfs_btree_block instead of short / longform 2008-10-30 17:14:34 +11:00
xfs_btree_trace.c [XFS] make btree tracing generic 2008-10-30 16:58:50 +11:00
xfs_btree_trace.h [XFS] make btree tracing generic 2008-10-30 16:58:50 +11:00
xfs_buf_item.c [XFS] Fix use-after-free with buffers 2008-09-17 16:52:13 +10:00
xfs_buf_item.h [XFS] Fix up sparse warnings. 2008-02-07 18:14:38 +11:00
xfs_clnt.h [XFS] Fix up noattr2 so that it will properly update the versionnum and 2008-07-28 16:58:05 +10:00
xfs_da_btree.c [XFS] Account for allocated blocks when expanding directories 2008-10-30 17:38:12 +11:00
xfs_da_btree.h [XFS] Sync up kernel and user-space headers 2008-10-30 17:05:38 +11:00
xfs_dfrag.c [XFS] Prevent lockdep false positives when locking two inodes. 2008-09-17 16:51:21 +10:00
xfs_dfrag.h [XFS] Add parameters to xfs_bmapi() and xfs_bunmapi() to have them report 2006-06-09 14:48:12 +10:00
xfs_dinode.h [XFS] Always use struct xfs_btree_block instead of short / longform 2008-10-30 17:14:34 +11:00
xfs_dir2.c [XFS] Account for allocated blocks when expanding directories 2008-10-30 17:38:12 +11:00
xfs_dir2.h [XFS] Return case-insensitive match for dentry cache 2008-07-28 16:58:40 +10:00
xfs_dir2_block.c [XFS] Return case-insensitive match for dentry cache 2008-07-28 16:58:40 +10:00
xfs_dir2_block.h [XFS] use filldir internally 2007-10-15 16:49:49 +10:00
xfs_dir2_data.c [XFS] Name operation vector for hash and compare 2008-07-28 16:58:36 +10:00
xfs_dir2_data.h [XFS] Reduce shouting by removing unnecessary macros from dir2 code. 2007-07-14 15:37:02 +10:00
xfs_dir2_leaf.c [XFS] Fix CI lookup in leaf-form directories 2008-07-28 16:59:06 +10:00
xfs_dir2_leaf.h [XFS] use filldir internally 2007-10-15 16:49:49 +10:00
xfs_dir2_node.c [XFS] Fix returning case-preserved name with CI node form directories 2008-07-28 16:59:01 +10:00
xfs_dir2_node.h [XFS] Reduce shouting by removing unnecessary macros from dir2 code. 2007-07-14 15:37:02 +10:00
xfs_dir2_sf.c [XFS] Return case-insensitive match for dentry cache 2008-07-28 16:58:40 +10:00
xfs_dir2_sf.h [XFS] Pack some shortform dir2 structures for the ARM old ABI 2008-07-28 16:58:50 +10:00
xfs_dir2_trace.c [XFS] Add op_flags field and helpers to xfs_da_args 2008-07-28 16:58:37 +10:00
xfs_dir2_trace.h [XFS] Update license/copyright notices to match the prefered SGI 2005-11-02 14:58:39 +11:00
xfs_dmapi.h removed unused #include <linux/version.h>'s 2008-08-23 12:14:12 -07:00
xfs_dmops.c [XFS] fixups after behavior removal merge into mainline git 2007-10-19 17:14:45 +10:00
xfs_error.c [XFS] kill INDUCE_IO_ERROR 2008-08-13 16:17:37 +10:00
xfs_error.h [XFS] kill INDUCE_IO_ERROR 2008-08-13 16:17:37 +10:00
xfs_extfree_item.c [XFS] Remove unused arg from kmem_free() 2008-07-28 16:58:07 +10:00
xfs_extfree_item.h [XFS] cleanup the field types of some item format structures 2006-09-28 10:55:43 +10:00
xfs_filestream.c [XFS] Use KM_NOFS for debug trace buffers 2008-08-13 16:51:57 +10:00
xfs_filestream.h [XFS] Concurrent Multi-File Data Streams 2007-07-14 15:40:53 +10:00
xfs_fs.h [XFS] attrmulti cleanup 2008-07-28 16:59:09 +10:00
xfs_fsops.c [XFS] Always use struct xfs_btree_block instead of short / longform 2008-10-30 17:14:34 +11:00
xfs_fsops.h [XFS] Write log dummy record when freezing filesystem 2006-01-11 15:30:08 +11:00
xfs_ialloc.c [XFS] implement generic xfs_btree_get_rec 2008-10-30 16:58:11 +11:00
xfs_ialloc.h [XFS] Sync up kernel and user-space headers 2008-10-30 17:05:38 +11:00
xfs_ialloc_btree.c [XFS] Always use struct xfs_btree_block instead of short / longform 2008-10-30 17:14:34 +11:00
xfs_ialloc_btree.h [XFS] Always use struct xfs_btree_block instead of short / longform 2008-10-30 17:14:34 +11:00
xfs_iget.c [XFS] kill deleted inodes list 2008-10-30 17:37:49 +11:00
xfs_imap.h [XFS] Sync up kernel and user-space headers 2008-10-30 17:05:38 +11:00
xfs_inode.c [XFS] kill deleted inodes list 2008-10-30 17:37:49 +11:00
xfs_inode.h [XFS] kill deleted inodes list 2008-10-30 17:37:49 +11:00
xfs_inode_item.c [XFS] replace inode flush semaphore with a completion 2008-08-13 16:41:16 +10:00
xfs_inode_item.h [XFS] Sync up kernel and user-space headers 2008-10-30 17:05:38 +11:00
xfs_inum.h [XFS] Update license/copyright notices to match the prefered SGI 2005-11-02 14:58:39 +11:00
xfs_iomap.c [XFS] use minleft when allocating in xfs_bmbt_split() 2008-07-28 16:59:10 +10:00
xfs_iomap.h [XFS] kill unnessecary ioops indirection 2008-02-07 16:44:14 +11:00
xfs_itable.c [XFS] implement generic xfs_btree_increment 2008-10-30 16:55:45 +11:00
xfs_itable.h [XFS] Fix XFS_IOC_FSBULKSTAT{,_SINGLE} & XFS_IOC_FSINUMBERS in compat mode 2007-07-14 15:42:50 +10:00
xfs_log.c Fix barrier fail detection in XFS 2008-10-10 11:08:07 -07:00
xfs_log.h [XFS] cleanup xfs_mountfs 2008-08-13 16:49:32 +10:00
xfs_log_priv.h [XFS] Move memory allocations for log tracing out of the critical path 2008-09-17 16:45:37 +10:00
xfs_log_recover.c [XFS] Always use struct xfs_btree_block instead of short / longform 2008-10-30 17:14:34 +11:00
xfs_log_recover.h [XFS] Update license/copyright notices to match the prefered SGI 2005-11-02 14:58:39 +11:00
xfs_mount.c [XFS] kill deleted inodes list 2008-10-30 17:37:49 +11:00
xfs_mount.h [XFS] kill deleted inodes list 2008-10-30 17:37:49 +11:00
xfs_mru_cache.c [XFS] streamline init/exit path 2008-07-28 16:59:25 +10:00
xfs_mru_cache.h [XFS] On-demand reaping of the MRU cache 2007-09-17 16:42:02 +10:00
xfs_qmops.c [XFS] Unwrap XFS_SB_LOCK. 2008-02-07 16:47:15 +11:00
xfs_quota.h [XFS] remove dependency of the quota module on behaviors 2007-10-16 11:43:26 +10:00
xfs_refcache.h [XFS] Cleanup cosmetic differences between source trees. 2005-11-03 16:14:31 +11:00
xfs_rename.c [XFS] Don't update mtime on rename source 2008-07-28 16:59:14 +10:00
xfs_rtalloc.c [XFS] Use the generic bitops rather than implementing them ourselves. 2008-08-13 15:41:12 +10:00
xfs_rtalloc.h [XFS] optimize XFS_IS_REALTIME_INODE w/o realtime config 2008-02-07 18:16:43 +11:00
xfs_rw.c [XFS] replace the XFS buf iodone semaphore with a completion 2008-08-13 16:36:11 +10:00
xfs_rw.h [XFS] optimize XFS_IS_REALTIME_INODE w/o realtime config 2008-02-07 18:16:43 +11:00
xfs_sb.h [XFS] XFS: ASCII case-insensitive support 2008-07-28 16:58:42 +10:00
xfs_trans.c [XFS] remove shouting-indirection macros from xfs_trans.h 2008-08-13 16:10:52 +10:00
xfs_trans.h [XFS] Sync up kernel and user-space headers 2008-10-30 17:05:38 +11:00
xfs_trans_ail.c [XFS] replace remaining __FUNCTION__ occurrences 2008-04-18 11:51:26 +10:00
xfs_trans_buf.c [XFS] remove shouting-indirection macros from xfs_trans.h 2008-08-13 16:10:52 +10:00
xfs_trans_extfree.c [XFS] Radix tree based inode caching 2007-10-15 16:50:50 +10:00
xfs_trans_inode.c [XFS] Remove unused arg from kmem_free() 2008-07-28 16:58:07 +10:00
xfs_trans_item.c [XFS] remove shouting-indirection macros from xfs_trans.h 2008-08-13 16:10:52 +10:00
xfs_trans_priv.h [XFS] Move AIL pushing into it's own thread 2008-02-07 18:22:51 +11:00
xfs_trans_space.h [XFS] Remove version 1 directory code. Never functioned on Linux, just 2006-06-20 13:04:51 +10:00
xfs_types.h [XFS] remove bhv_vname_t and xfs_rename code 2008-04-18 12:00:12 +10:00
xfs_utils.c [XFS] Avoid directly referencing the VFS inode. 2008-08-13 15:45:15 +10:00
xfs_utils.h [XFS] implement IHOLD/IRELE directly 2008-08-13 16:13:45 +10:00
xfs_vfsops.c [XFS] Move remaining quiesce code. 2008-10-30 17:16:21 +11:00
xfs_vfsops.h [XFS] Move remaining quiesce code. 2008-10-30 17:16:21 +11:00
xfs_vnodeops.c [XFS] kill deleted inodes list 2008-10-30 17:37:49 +11:00
xfs_vnodeops.h [XFS] Now that xfs_setattr is only used for attributes set from ->setattr 2008-07-28 16:59:37 +10:00