WSL2-Linux-Kernel/fs/xfs
Dave Chinner d2e448d5fd xfs: add CRC protection to remote attributes
There are two ways of doing this - the first is to add a CRC to the
remote attribute entry in the attribute block. The second is to
treat them similar to the remote symlink, where each fragment has
it's own header and identifies fragment location in the attribute.

The problem with the CRC in the remote attr entry is that we cannot
identify the owner of the metadata from the metadata blocks
themselves, or where the blocks fit into the remote attribute. The
down side to this approach is that we never know when the attribute
has been read from disk or not and so we have to verify it every
time it is read, and we must calculate it during the create
transaction and log it. We do not log CRCs for any other metadata,
and so this creates a unique set of coherency problems that, in
general, are best avoided.

Adding an identifying header to each allocated block allows us to
identify each fragment and where in the attribute it is located. It
enables us to rebuild the remote attribute from just the raw blocks
containing the attribute. It also provides us to do per-block CRCs
verification at IO time rather than during the transaction context
that creates it or every time it is read into a user buffer. Hence
it avoids all the problems that an external, logged CRC has, and
provides all the benefits of self identifying metadata.

The only complexity is that we have to add a header per fragment,
and we don't know how many fragments will be needed prior to
allocations. If we take the symlink example, the header is 56 bytes
and hence for a 4k block size filesystem, in the worst case 16
headers requires 1 extra block for the 64k attribute data. For 512
byte filesystems the worst case is an extra block for every 9
fragments (i.e. 16 extra blocks in the worse case). This will be
very rare and so it's not really a major concern.

Because allocation is done in two steps - the first finds a hole
large enough in the attribute file, the second does the allocation -
we only need to find a hole big enough for a worst case allocation.
We only need to allocate enough extra blocks for number of headers
required by the fragments, and we can calculate that as we go....

Hence it really only makes sense to use the same model as for
symlinks - it doesn't add that much complexity, does not require an
attribute tree format change, and does not require logging
calculated CRC values.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
2013-04-27 12:58:53 -05:00
..
Kconfig
Makefile xfs: split remote attribute code out 2013-04-27 12:49:32 -05:00
kmem.c
kmem.h
mrlock.h
time.h
uuid.c
uuid.h
xfs.h
xfs_acl.c
xfs_acl.h
xfs_ag.h xfs: add CRC checks to the AGI 2013-04-21 14:57:43 -05:00
xfs_alloc.c xfs: add CRC checks to the AGFL 2013-04-21 14:55:34 -05:00
xfs_alloc.h
xfs_alloc_btree.c xfs: add support for large btree blocks 2013-04-21 14:53:46 -05:00
xfs_alloc_btree.h xfs: add support for large btree blocks 2013-04-21 14:53:46 -05:00
xfs_aops.c xfs: Fix WARN_ON(delalloc) in xfs_vm_releasepage() 2013-03-22 16:12:37 -05:00
xfs_aops.h
xfs_attr.c xfs: split remote attribute code out 2013-04-27 12:49:32 -05:00
xfs_attr.h xfs: split remote attribute code out 2013-04-27 12:49:32 -05:00
xfs_attr_leaf.c xfs: split remote attribute code out 2013-04-27 12:49:32 -05:00
xfs_attr_leaf.h xfs: add CRCs to attr leaf blocks 2013-04-27 12:45:01 -05:00
xfs_attr_remote.c xfs: add CRC protection to remote attributes 2013-04-27 12:58:53 -05:00
xfs_attr_remote.h xfs: add CRC protection to remote attributes 2013-04-27 12:58:53 -05:00
xfs_attr_sf.h
xfs_bit.c
xfs_bit.h
xfs_bmap.c xfs: add CRCs to dir2/da node blocks 2013-04-27 12:33:38 -05:00
xfs_bmap.h
xfs_bmap_btree.c xfs: add support for large btree blocks 2013-04-21 14:53:46 -05:00
xfs_bmap_btree.h xfs: add support for large btree blocks 2013-04-21 14:53:46 -05:00
xfs_btree.c xfs: add support for large btree blocks 2013-04-21 14:53:46 -05:00
xfs_btree.h xfs: add support for large btree blocks 2013-04-21 14:53:46 -05:00
xfs_buf.c xfs: ensure we capture IO errors correctly 2013-03-14 15:56:53 -05:00
xfs_buf.h
xfs_buf_item.c
xfs_buf_item.h xfs: add CRC checks to remote symlinks 2013-04-27 11:49:28 -05:00
xfs_cksum.h
xfs_da_btree.c xfs: add CRCs to attr leaf blocks 2013-04-27 12:45:01 -05:00
xfs_da_btree.h xfs: add CRCs to attr leaf blocks 2013-04-27 12:45:01 -05:00
xfs_dfrag.c
xfs_dfrag.h
xfs_dinode.h xfs: add version 3 inode format with CRCs 2013-04-21 15:03:33 -05:00
xfs_dir2.c
xfs_dir2.h
xfs_dir2_block.c xfs: add CRC checking to dir2 leaf blocks 2013-04-27 12:19:53 -05:00
xfs_dir2_data.c xfs: add CRC checking to dir2 data blocks 2013-04-27 12:00:00 -05:00
xfs_dir2_format.h xfs: shortform directory offsets change for dir3 format 2013-04-27 12:24:32 -05:00
xfs_dir2_leaf.c xfs: add CRC checking to dir2 leaf blocks 2013-04-27 12:19:53 -05:00
xfs_dir2_node.c xfs: add CRCs to dir2/da node blocks 2013-04-27 12:33:38 -05:00
xfs_dir2_priv.h xfs: add CRC checking to dir2 leaf blocks 2013-04-27 12:19:53 -05:00
xfs_dir2_sf.c xfs: shortform directory offsets change for dir3 format 2013-04-27 12:24:32 -05:00
xfs_discard.c
xfs_discard.h
xfs_dquot.c xfs: add CRC checks for quota blocks 2013-04-21 14:58:22 -05:00
xfs_dquot.h xfs: xfs_dquot prealloc throttling watermarks and low free space 2013-03-22 16:06:30 -05:00
xfs_dquot_item.c
xfs_dquot_item.h
xfs_error.c xfs: increase hexdump output in xfs_corruption_error 2013-04-21 14:48:41 -05:00
xfs_error.h
xfs_export.c
xfs_export.h
xfs_extent_busy.c
xfs_extent_busy.h
xfs_extfree_item.c xfs: don't free EFIs before the EFDs are committed 2013-04-05 13:25:35 -05:00
xfs_extfree_item.h xfs: don't free EFIs before the EFDs are committed 2013-04-05 13:25:35 -05:00
xfs_file.c xfs: add CRC checking to dir2 data blocks 2013-04-27 12:00:00 -05:00
xfs_filestream.c
xfs_filestream.h
xfs_fs.h
xfs_fsops.c xfs: add CRC checks to the AGI 2013-04-21 14:57:43 -05:00
xfs_fsops.h
xfs_globals.c
xfs_ialloc.c xfs: add version 3 inode format with CRCs 2013-04-21 15:03:33 -05:00
xfs_ialloc.h
xfs_ialloc_btree.c xfs: add support for large btree blocks 2013-04-21 14:53:46 -05:00
xfs_ialloc_btree.h xfs: add support for large btree blocks 2013-04-21 14:53:46 -05:00
xfs_icache.c
xfs_icache.h
xfs_inode.c xfs: add version 3 inode format with CRCs 2013-04-21 15:03:33 -05:00
xfs_inode.h xfs: add version 3 inode format with CRCs 2013-04-21 15:03:33 -05:00
xfs_inode_item.c xfs: add version 3 inode format with CRCs 2013-04-21 15:03:33 -05:00
xfs_inode_item.h
xfs_inum.h
xfs_ioctl.c
xfs_ioctl.h
xfs_ioctl32.c
xfs_ioctl32.h
xfs_iomap.c xfs: xfs_iomap_prealloc_size() tracepoint 2013-03-22 16:07:56 -05:00
xfs_iomap.h
xfs_iops.c
xfs_iops.h
xfs_itable.c
xfs_itable.h
xfs_linux.h xfs: Add ratelimited printk for different alert levels 2013-04-03 13:20:39 -05:00
xfs_log.c xfs: rename random32() to prandom_u32() 2013-03-07 12:33:57 -06:00
xfs_log.h
xfs_log_cil.c xfs: Update xfs_log_commit_cil() comments 2013-04-16 13:20:03 -05:00
xfs_log_priv.h xfs: Remove the obsolete XLOG_CIL_HARD_SPACE_LIMIT() macros 2013-04-16 13:18:33 -05:00
xfs_log_recover.c xfs: add CRC checks to remote symlinks 2013-04-27 11:49:28 -05:00
xfs_log_recover.h
xfs_message.c
xfs_message.h xfs: Add ratelimited printk for different alert levels 2013-04-03 13:20:39 -05:00
xfs_mount.c
xfs_mount.h xfs: Remove obsoleted m_inode_shrink from xfs_mount structure 2013-03-14 15:55:32 -05:00
xfs_mru_cache.c
xfs_mru_cache.h
xfs_qm.c xfs: add CRC checks for quota blocks 2013-04-21 14:58:22 -05:00
xfs_qm.h xfs: add CRC checks for quota blocks 2013-04-21 14:58:22 -05:00
xfs_qm_bhv.c
xfs_qm_syscalls.c xfs: xfs_dquot prealloc throttling watermarks and low free space 2013-03-22 16:06:30 -05:00
xfs_quota.h xfs: add CRC checks for quota blocks 2013-04-21 14:58:22 -05:00
xfs_quota_priv.h
xfs_quotaops.c
xfs_rename.c
xfs_rtalloc.c
xfs_rtalloc.h
xfs_sb.h
xfs_stats.c
xfs_stats.h
xfs_super.c
xfs_super.h
xfs_symlink.c xfs: add CRC checks to remote symlinks 2013-04-27 11:49:28 -05:00
xfs_symlink.h xfs: add CRC checks to remote symlinks 2013-04-27 11:49:28 -05:00
xfs_sysctl.c
xfs_sysctl.h
xfs_trace.c xfs: add CRCs to dir2/da node blocks 2013-04-27 12:33:38 -05:00
xfs_trace.h xfs: xfs_iomap_prealloc_size() tracepoint 2013-03-22 16:07:56 -05:00
xfs_trans.c
xfs_trans.h xfs: add support for large btree blocks 2013-04-21 14:53:46 -05:00
xfs_trans_ail.c
xfs_trans_buf.c xfs: add version 3 inode format with CRCs 2013-04-21 15:03:33 -05:00
xfs_trans_dquot.c xfs: pass xfs_dquot to xfs_qm_adjust_dqlimits() instead of xfs_disk_dquot_t 2013-03-22 16:05:52 -05:00
xfs_trans_extfree.c
xfs_trans_inode.c
xfs_trans_priv.h
xfs_trans_space.h
xfs_types.h
xfs_utils.c
xfs_utils.h
xfs_vnode.h
xfs_vnodeops.c xfs: split out symlink code into it's own file. 2013-04-21 15:38:04 -05:00
xfs_vnodeops.h
xfs_xattr.c