]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: rename MAXPATHLEN to XFS_SYMLINK_MAXLEN
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 31 Jul 2017 20:08:12 +0000 (15:08 -0500)
committerEric Sandeen <sandeen@redhat.com>
Mon, 31 Jul 2017 20:08:12 +0000 (15:08 -0500)
Source kernel commit: 6eb0b8df9f74f33d1a69100117630a7a87a9cc96

XFS has a maximum symlink target length of 1024 bytes; this is a
holdover from the Irix days.  Unfortunately, the constant establishing
this is 'MAXPATHLEN' and is /not/ the same as the Linux MAXPATHLEN,
which is 4096.

The kernel enforces its 1024 byte MAXPATHLEN on symlink targets, but
xfsprogs picks up the (Linux) system 4096 byte MAXPATHLEN, which means
that xfs_repair doesn't complain about oversized symlinks.

Since this is an on-disk format constraint, put the define in the XFS
namespace and move everything over to use the new name.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_format.h
libxfs/xfs_symlink_remote.c
libxfs/xfs_trans_resv.c

index a53f035ff9e4985e764877422a1d04fb2fab0cd2..79a72bb741ce7be4cc9be93829ca85ec9e3e1855 100644 (file)
@@ -1211,6 +1211,7 @@ struct xfs_dsymlink_hdr {
 
 #define XFS_SYMLINK_CRC_OFF    offsetof(struct xfs_dsymlink_hdr, sl_crc)
 
+#define XFS_SYMLINK_MAXLEN     1024
 /*
  * The maximum pathlen is 1024 bytes. Since the minimum file system
  * blocksize is 512 bytes, we can get a max of 3 extents back from
index 04c744624f1511019133ff0523d008fff7098909..d638530beb59f63452b59dc0ffe94e8695895b64 100644 (file)
@@ -110,7 +110,7 @@ xfs_symlink_verify(
        if (bp->b_bn != be64_to_cpu(dsl->sl_blkno))
                return false;
        if (be32_to_cpu(dsl->sl_offset) +
-                               be32_to_cpu(dsl->sl_bytes) >= MAXPATHLEN)
+                               be32_to_cpu(dsl->sl_bytes) >= XFS_SYMLINK_MAXLEN)
                return false;
        if (dsl->sl_owner == 0)
                return false;
index 5152a5b2be9c4bed70247ad58433a5157be1a690..d35a45f8fa74a13d85fb2c1666a53f6eb14b5ae0 100644 (file)
@@ -476,14 +476,14 @@ xfs_calc_mkdir_reservation(
 /*
  * Making a new symplink is the same as creating a new file, but
  * with the added blocks for remote symlink data which can be up to 1kB in
- * length (MAXPATHLEN).
+ * length (XFS_SYMLINK_MAXLEN).
  */
 STATIC uint
 xfs_calc_symlink_reservation(
        struct xfs_mount        *mp)
 {
        return xfs_calc_create_reservation(mp) +
-              xfs_calc_buf_res(1, MAXPATHLEN);
+              xfs_calc_buf_res(1, XFS_SYMLINK_MAXLEN);
 }
 
 /*