Skip to content

Commit

Permalink
xfs: add CRC checks to remote symlinks
Browse files Browse the repository at this point in the history
Add a header to the remote symlink block, containing location and
owner information, as well as CRCs and LSN fields. This requires
verifiers to be added to the remote symlink buffers for CRC enabled
filesystems.

This also fixes a bug reading multiple block symlinks, where the second
block overwrites the first block when copying out the link name.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
  • Loading branch information
Dave Chinner authored and Ben Myers committed Apr 27, 2013
1 parent 19de735 commit f948dd7
Show file tree
Hide file tree
Showing 4 changed files with 283 additions and 43 deletions.
4 changes: 3 additions & 1 deletion fs/xfs/xfs_buf_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ extern kmem_zone_t *xfs_buf_item_zone;
#define XFS_BLF_AGFL_BUF (1<<7)
#define XFS_BLF_AGI_BUF (1<<8)
#define XFS_BLF_DINO_BUF (1<<9)
#define XFS_BLF_SYMLINK_BUF (1<<10)

#define XFS_BLF_TYPE_MASK \
(XFS_BLF_UDQUOT_BUF | \
Expand All @@ -58,7 +59,8 @@ extern kmem_zone_t *xfs_buf_item_zone;
XFS_BLF_AGF_BUF | \
XFS_BLF_AGFL_BUF | \
XFS_BLF_AGI_BUF | \
XFS_BLF_DINO_BUF)
XFS_BLF_DINO_BUF | \
XFS_BLF_SYMLINK_BUF)

#define XFS_BLF_CHUNK 128
#define XFS_BLF_SHIFT 7
Expand Down
9 changes: 9 additions & 0 deletions fs/xfs/xfs_log_recover.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "xfs_cksum.h"
#include "xfs_trace.h"
#include "xfs_icache.h"
#include "xfs_symlink.h"

STATIC int
xlog_find_zeroed(
Expand Down Expand Up @@ -2002,6 +2003,14 @@ xlog_recover_do_reg_buffer(
}
bp->b_ops = &xfs_inode_buf_ops;
break;
case XFS_BLF_SYMLINK_BUF:
if (*(__be32 *)bp->b_addr != cpu_to_be32(XFS_SYMLINK_MAGIC)) {
xfs_warn(mp, "Bad symlink block magic!");
ASSERT(0);
break;
}
bp->b_ops = &xfs_symlink_buf_ops;
break;
default:
break;
}
Expand Down
Loading

0 comments on commit f948dd7

Please sign in to comment.