]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
xfs: set buf types when converting extent formats
authorDave Chinner <dchinner@redhat.com>
Wed, 21 Jan 2015 22:30:06 +0000 (09:30 +1100)
committerLuis Henriques <luis.henriques@canonical.com>
Tue, 24 Feb 2015 10:01:07 +0000 (10:01 +0000)
commit fe22d552b82d7cc7de1851233ae8bef579198637 upstream.

Conversion from local to extent format does not set the buffer type
correctly on the new extent buffer when a symlink data is moved out
of line.

Fix the symlink code and leave a comment in the generic bmap code
reminding us that the format-specific data copy needs to set the
destination buffer type appropriately.

Tested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
[ luis: backported to 3.16: libxfs infrastructure not available in 3.16 kernel ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
fs/xfs/xfs_bmap.c
fs/xfs/xfs_symlink_remote.c

index 75c3fe5f3d9d82a34c84139c56eb4028dd3f42d0..94a5c1914fb339d7ec7c4f7509564e81fb838a45 100644 (file)
@@ -976,7 +976,11 @@ xfs_bmap_local_to_extents(
        *firstblock = args.fsbno;
        bp = xfs_btree_get_bufl(args.mp, tp, args.fsbno, 0);
 
-       /* initialise the block and copy the data */
+       /*
+        * Initialise the block and copy the data
+        *
+        * Note: init_fn must set the buffer log item type correctly!
+        */
        init_fn(tp, bp, ip, ifp);
 
        /* account for the change in fork size and log everything */
index 23c2f2577c8d75fdd85660cb0aac0524318cd384..4c92ef63b11b203548164e6851ca08d13ffb7bfa 100644 (file)
@@ -180,6 +180,8 @@ xfs_symlink_local_to_remote(
        struct xfs_mount        *mp = ip->i_mount;
        char                    *buf;
 
+       xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SYMLINK_BUF);
+
        if (!xfs_sb_version_hascrc(&mp->m_sb)) {
                bp->b_ops = NULL;
                memcpy(bp->b_addr, ifp->if_u1.if_data, ifp->if_bytes);