summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub/tempfile.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-12-04 18:04:11 -0800
committerDarrick J. Wong <djwong@kernel.org>2021-12-15 17:29:32 -0800
commit851df07d9599471df909c4ff0e3cf33f4b9619f0 (patch)
tree390175cf6ee12df70340e9e1d23742882a01bce3 /fs/xfs/scrub/tempfile.c
parente659750c94e5a1c7b9398396e47ee00749d8973e (diff)
xfs: convert symlink repair to use swapextrepair-symlink-swapext_2021-12-15
Convert the symlink repair code to use extent swapping. This means we can eliminate the problem of symlinks with crosslinked blocks. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/scrub/tempfile.c')
-rw-r--r--fs/xfs/scrub/tempfile.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/xfs/scrub/tempfile.c b/fs/xfs/scrub/tempfile.c
index eaa5449bf945..540bbd03a59c 100644
--- a/fs/xfs/scrub/tempfile.c
+++ b/fs/xfs/scrub/tempfile.c
@@ -22,6 +22,7 @@
#include "xfs_swapext.h"
#include "xfs_defer.h"
#include "xfs_swapext.h"
+#include "xfs_symlink_remote.h"
#include "scrub/scrub.h"
#include "scrub/common.h"
#include "scrub/repair.h"
@@ -117,6 +118,10 @@ xrep_tempfile_create(
error = xfs_dir_init(tp, sc->tempip, dp);
if (error)
goto out_trans_cancel;
+ } else if (S_ISLNK(VFS_I(sc->tempip)->i_mode)) {
+ error = xfs_symlink_write_target(tp, sc->tempip, ".", 1, 0, 0);
+ if (error)
+ goto out_trans_cancel;
}
/*
@@ -433,10 +438,11 @@ xrep_tempfile_swapext_prep_request(
req->req_flags |= XFS_SWAP_REQ_SET_SIZES;
/*
- * If we're repairing xattrs or directories, always try to convert ip2
- * to short format after swapping.
+ * If we're repairing symlinks, xattrs, or directories, always try to
+ * convert ip2 to short format after swapping.
*/
- if (whichfork == XFS_ATTR_FORK || S_ISDIR(VFS_I(sc->ip)->i_mode))
+ if (whichfork == XFS_ATTR_FORK || S_ISDIR(VFS_I(sc->ip)->i_mode) ||
+ S_ISLNK(VFS_I(sc->ip)->i_mode))
req->req_flags |= XFS_SWAP_REQ_FILE2_CVT_SF;
return 0;