[CFT][PATCH] symlinks - against -pre4

Alexander Viro (viro@math.psu.edu)
Tue, 14 Dec 1999 01:07:30 -0500 (EST)


Rediffed against -pre4.

> added missing SetPageUptodate to NCPFS part (thanks, Petr ;-) and
> into AFFS/EFS parts. The rest was OK.

Still there, it didn't make into -pre3. Submitted, indeed.

New: hopefully correct handling of fast symlinks on UFS. Please, help
testing. Interesting versions: SunOS (links with the length from 50 to 64
- check if SunOS will not barf on them) and 4.4BSD (ditto).

Patch is small enough, so...

diff -urN linux-2.3.32-pre4/fs/affs/symlink.c linux-bird.symlink/fs/affs/symlink.c
--- linux-2.3.32-pre4/fs/affs/symlink.c Mon Dec 13 20:07:02 1999
+++ linux-bird.symlink/fs/affs/symlink.c Mon Dec 13 20:24:33 1999
@@ -60,6 +60,7 @@
}
link[i] = '\0';
affs_brelse(bh);
+ SetPageUptodate(page);
kunmap(page);
UnlockPage(page);
return 0;
diff -urN linux-2.3.32-pre4/fs/efs/symlink.c linux-bird.symlink/fs/efs/symlink.c
--- linux-2.3.32-pre4/fs/efs/symlink.c Mon Dec 13 20:07:02 1999
+++ linux-bird.symlink/fs/efs/symlink.c Mon Dec 13 20:24:33 1999
@@ -37,6 +37,7 @@
brelse(bh);
}
link[size] = '\0';
+ SetPageUptodate(page);
kunmap(page);
UnlockPage(page);
return 0;
diff -urN linux-2.3.32-pre4/fs/ncpfs/symlink.c linux-bird.symlink/fs/ncpfs/symlink.c
--- linux-2.3.32-pre4/fs/ncpfs/symlink.c Mon Dec 13 20:07:03 1999
+++ linux-bird.symlink/fs/ncpfs/symlink.c Mon Dec 13 20:24:33 1999
@@ -81,6 +81,7 @@
kfree(link);
if (error)
goto fail;
+ SetPageUptodate(page);
kunmap(page);
UnlockPage(page);
return 0;
diff -urN linux-2.3.32-pre4/fs/ufs/namei.c linux-bird.symlink/fs/ufs/namei.c
--- linux-2.3.32-pre4/fs/ufs/namei.c Mon Dec 13 20:07:04 1999
+++ linux-bird.symlink/fs/ufs/namei.c Mon Dec 13 20:50:46 1999
@@ -764,7 +764,7 @@

err = -ENAMETOOLONG;
l = strlen(symname)+1;
- if (l > dir->i_sb->s_blocksize)
+ if (l > sb->s_blocksize)
goto out;

err = -EIO;
@@ -774,8 +774,7 @@
}
inode->i_mode = S_IFLNK | S_IRWXUGO;

- /***if (l > sizeof (inode->u.ufs_i.i_data)) {***/
- if (1) {
+ if (l > sb->u.ufs_sb.s_uspi->s_maxsymlinklen) {
/* slow symlink */
inode->i_op = &ufs_symlink_inode_operations;
err = block_symlink(inode, symname, l);
diff -urN linux-2.3.32-pre4/fs/ufs/super.c linux-bird.symlink/fs/ufs/super.c
--- linux-2.3.32-pre4/fs/ufs/super.c Thu Nov 11 22:08:02 1999
+++ linux-bird.symlink/fs/ufs/super.c Mon Dec 13 21:53:11 1999
@@ -497,6 +497,7 @@
uspi->s_fshift = 10;
uspi->s_sbsize = super_block_size = 2048;
uspi->s_sbbase = 0;
+ uspi->s_maxsymlinklen = 56;
flags |= UFS_DE_OLD | UFS_UID_EFT | UFS_ST_SUN | UFS_CG_SUN;
break;

@@ -507,6 +508,7 @@
uspi->s_fshift = 10;
uspi->s_sbsize = super_block_size = 2048;
uspi->s_sbbase = 0;
+ uspi->s_maxsymlinklen = 56;
flags |= UFS_DE_OLD | UFS_UID_EFT | UFS_ST_SUNx86 | UFS_CG_SUN;
break;

@@ -760,6 +762,10 @@
uspi->s_bpf = uspi->s_fsize << 3;
uspi->s_bpfshift = uspi->s_fshift + 3;
uspi->s_bpfmask = uspi->s_bpf - 1;
+ if ((sb->u.ufs_sb.s_mount_opt & UFS_MOUNT_UFSTYPE) ==
+ UFS_MOUNT_UFSTYPE_44BSD)
+ uspi->s_maxsymlinklen =
+ SWAB32(usb3->fs_u2.fs_44.fs_maxsymlinklen);

sb->u.ufs_sb.s_flags = flags;
sb->u.ufs_sb.s_swab = swab;
diff -urN linux-2.3.32-pre4/include/linux/ufs_fs_sb.h linux-bird.symlink/include/linux/ufs_fs_sb.h
--- linux-2.3.32-pre4/include/linux/ufs_fs_sb.h Mon Nov 22 08:50:18 1999
+++ linux-bird.symlink/include/linux/ufs_fs_sb.h Mon Dec 13 20:48:02 1999
@@ -107,6 +107,8 @@
__u32 s_bpf; /* bits per fragment */
__u32 s_bpfshift; /* bits per fragment shift*/
__u32 s_bpfmask; /* bits per fragment mask */
+
+ __u32 s_maxsymlinklen;/* upper limit on fast symlinks' size */
};


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/