]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: pass the owner to xfs_symlink_write_target
authorDarrick J. Wong <djwong@kernel.org>
Mon, 29 Jul 2024 23:22:39 +0000 (16:22 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:01:00 +0000 (17:01 -0700)
Source kernel commit: ea8214c3195c2ed3a205dea42bbe7746712fc461

Require callers of xfs_symlink_write_target to pass the owner number
explicitly.  This sets us up for online repair to be able to write a
remote symlink target to sc->tempip with sc->ip's inumber in the block
heaader.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_symlink_remote.c
libxfs/xfs_symlink_remote.h
mkfs/proto.c

index fbcd1aebb67719ea3ea96c8abf0d6f8644ace797..2ad586f3926ad2309f54900c77bff73ae83baf86 100644 (file)
@@ -308,6 +308,7 @@ int
 xfs_symlink_write_target(
        struct xfs_trans        *tp,
        struct xfs_inode        *ip,
+       xfs_ino_t               owner,
        const char              *target_path,
        int                     pathlen,
        xfs_fsblock_t           fs_blocks,
@@ -362,8 +363,7 @@ xfs_symlink_write_target(
                byte_cnt = min(byte_cnt, pathlen);
 
                buf = bp->b_addr;
-               buf += xfs_symlink_hdr_set(mp, ip->i_ino, offset, byte_cnt,
-                               bp);
+               buf += xfs_symlink_hdr_set(mp, owner, offset, byte_cnt, bp);
 
                memcpy(buf, cur_chunk, byte_cnt);
 
index 83b89a1deb9f2c542e029dd9a76a7e3d9eec3516..c1672fe1f17bb29b997b12285a800f2c8a1c1202 100644 (file)
@@ -21,8 +21,8 @@ void xfs_symlink_local_to_remote(struct xfs_trans *tp, struct xfs_buf *bp,
 xfs_failaddr_t xfs_symlink_shortform_verify(void *sfp, int64_t size);
 int xfs_symlink_remote_read(struct xfs_inode *ip, char *link);
 int xfs_symlink_write_target(struct xfs_trans *tp, struct xfs_inode *ip,
-               const char *target_path, int pathlen, xfs_fsblock_t fs_blocks,
-               uint resblks);
+               xfs_ino_t owner, const char *target_path, int pathlen,
+               xfs_fsblock_t fs_blocks, uint resblks);
 int xfs_symlink_remote_truncate(struct xfs_trans *tp, struct xfs_inode *ip);
 
 #endif /* __XFS_SYMLINK_REMOTE_H */
index a923f9c1028b52dbf05d1af43126bd02e39c2218..5125ee44f4936b5bb15fcb988e4b6949c7fb8b86 100644 (file)
@@ -252,7 +252,8 @@ writesymlink(
        xfs_extlen_t            nb = XFS_B_TO_FSB(mp, len);
        int                     error;
 
-       error = -libxfs_symlink_write_target(tp, ip, buf, len, nb, nb);
+       error = -libxfs_symlink_write_target(tp, ip, ip->i_ino, buf, len, nb,
+                       nb);
        if (error) {
                fprintf(stderr,
        _("%s: error %d creating symlink to '%s'.\n"), progname, error, buf);