Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109444991
D30325.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
9 KB
Referenced Files
None
Subscribers
None
D30325.diff
View Options
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c
--- a/sys/fs/cd9660/cd9660_vfsops.c
+++ b/sys/fs/cd9660/cd9660_vfsops.c
@@ -378,7 +378,6 @@
mp->mnt_data = isomp;
mp->mnt_stat.f_fsid.val[0] = dev2udev(dev);
mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;
- mp->mnt_maxsymlinklen = 0;
MNT_ILOCK(mp);
if (isverified)
mp->mnt_flag |= MNT_VERIFIED;
diff --git a/sys/fs/ext2fs/ext2_inode.c b/sys/fs/ext2fs/ext2_inode.c
--- a/sys/fs/ext2fs/ext2_inode.c
+++ b/sys/fs/ext2fs/ext2_inode.c
@@ -562,7 +562,7 @@
ip = VTOI(vp);
if (vp->v_type == VLNK &&
- ip->i_size < vp->v_mount->mnt_maxsymlinklen) {
+ ip->i_size < VFSTOEXT2(vp->v_mount)->um_e2fs->e2fs_maxsymlinklen) {
#ifdef INVARIANTS
if (length != 0)
panic("ext2_truncate: partial truncate of symlink");
diff --git a/sys/fs/ext2fs/ext2_vfsops.c b/sys/fs/ext2fs/ext2_vfsops.c
--- a/sys/fs/ext2fs/ext2_vfsops.c
+++ b/sys/fs/ext2fs/ext2_vfsops.c
@@ -924,6 +924,7 @@
*/
e2fs_maxcontig = MAX(1, maxphys / ump->um_e2fs->e2fs_bsize);
ump->um_e2fs->e2fs_contigsumsize = MIN(e2fs_maxcontig, EXT2_MAXCONTIG);
+ ump->um_e2fs->e2fs_maxsymlinklen = EXT2_MAXSYMLINKLEN;
if (ump->um_e2fs->e2fs_contigsumsize > 0) {
size = ump->um_e2fs->e2fs_gcount * sizeof(int32_t);
ump->um_e2fs->e2fs_maxcluster = malloc(size, M_EXT2MNT, M_WAITOK);
@@ -957,7 +958,6 @@
mp->mnt_data = ump;
mp->mnt_stat.f_fsid.val[0] = dev2udev(dev);
mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;
- mp->mnt_maxsymlinklen = EXT2_MAXSYMLINKLEN;
MNT_ILOCK(mp);
mp->mnt_flag |= MNT_LOCAL;
MNT_IUNLOCK(mp);
diff --git a/sys/fs/ext2fs/ext2_vnops.c b/sys/fs/ext2fs/ext2_vnops.c
--- a/sys/fs/ext2fs/ext2_vnops.c
+++ b/sys/fs/ext2fs/ext2_vnops.c
@@ -1533,7 +1533,7 @@
return (error);
vp = *vpp;
len = strlen(ap->a_target);
- if (len < vp->v_mount->mnt_maxsymlinklen) {
+ if (len < VFSTOEXT2(vp->v_mount)->um_e2fs->e2fs_maxsymlinklen) {
ip = VTOI(vp);
bcopy(ap->a_target, (char *)ip->i_shortlink, len);
ip->i_size = len;
@@ -1558,7 +1558,7 @@
int isize;
isize = ip->i_size;
- if (isize < vp->v_mount->mnt_maxsymlinklen) {
+ if (isize < VFSTOEXT2(vp->v_mount)->um_e2fs->e2fs_maxsymlinklen) {
uiomove((char *)ip->i_shortlink, isize, ap->a_uio);
return (0);
}
@@ -2075,7 +2075,8 @@
panic("%s: mode", "ext2_read");
if (vp->v_type == VLNK) {
- if ((int)ip->i_size < vp->v_mount->mnt_maxsymlinklen)
+ if ((int)ip->i_size <
+ VFSTOEXT2(vp->v_mount)->um_e2fs->e2fs_maxsymlinklen)
panic("%s: short symlink", "ext2_read");
} else if (vp->v_type != VREG && vp->v_type != VDIR)
panic("%s: type %d", "ext2_read", vp->v_type);
diff --git a/sys/fs/ext2fs/ext2fs.h b/sys/fs/ext2fs/ext2fs.h
--- a/sys/fs/ext2fs/ext2fs.h
+++ b/sys/fs/ext2fs/ext2fs.h
@@ -184,6 +184,7 @@
struct csum *e2fs_clustersum; /* cluster summary in each cyl group */
int32_t e2fs_uhash; /* 3 if hash should be signed, 0 if not */
uint32_t e2fs_csum_seed; /* sb checksum seed */
+ uint64_t e2fs_maxsymlinklen; /* max size of short symlink */
};
/* cluster summary information */
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -4464,8 +4464,6 @@
mp->mnt_lazyvnodelistsize);
db_printf(" mnt_writeopcount = %d (with %d in the struct)\n",
vfs_mount_fetch_counter(mp, MNT_COUNT_WRITEOPCOUNT), mp->mnt_writeopcount);
- db_printf(" mnt_maxsymlinklen = %jd\n",
- (uintmax_t)mp->mnt_maxsymlinklen);
db_printf(" mnt_iosize_max = %d\n", mp->mnt_iosize_max);
db_printf(" mnt_hashseed = %u\n", mp->mnt_hashseed);
db_printf(" mnt_lockref = %d (with %d in the struct)\n",
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -224,7 +224,6 @@
int mnt_writeopcount; /* (i) write syscalls pending */
struct vfsoptlist *mnt_opt; /* current mount options */
struct vfsoptlist *mnt_optnew; /* new options passed to fs */
- uint64_t mnt_maxsymlinklen; /* max size of short symlink */
struct statfs mnt_stat; /* cache of filesystem stats */
struct ucred *mnt_cred; /* credentials of mounter */
void * mnt_data; /* private data */
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c
--- a/sys/ufs/ffs/ffs_inode.c
+++ b/sys/ufs/ffs/ffs_inode.c
@@ -329,7 +329,7 @@
}
if ((flags & IO_NORMAL) == 0)
return (0);
- if (vp->v_type == VLNK && ip->i_size < vp->v_mount->mnt_maxsymlinklen) {
+ if (vp->v_type == VLNK && ip->i_size < ump->um_maxsymlinklen) {
#ifdef INVARIANTS
if (length != 0)
panic("ffs_truncate: partial truncate of symlink");
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -932,7 +932,7 @@
sblockloc = fs->fs_sblockloc;
bcopy(newfs, fs, (u_int)fs->fs_sbsize);
brelse(bp);
- mp->mnt_maxsymlinklen = fs->fs_maxsymlinklen;
+ ump->um_maxsymlinklen = fs->fs_maxsymlinklen;
ffs_oldfscompat_read(fs, VFSTOUFS(mp), sblockloc);
UFS_LOCK(ump);
if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) {
@@ -1192,7 +1192,7 @@
vfs_rel(nmp);
vfs_getnewfsid(mp);
}
- mp->mnt_maxsymlinklen = fs->fs_maxsymlinklen;
+ ump->um_maxsymlinklen = fs->fs_maxsymlinklen;
MNT_ILOCK(mp);
mp->mnt_flag |= MNT_LOCAL;
MNT_IUNLOCK(mp);
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -675,7 +675,7 @@
panic("ffs_read: mode");
if (vp->v_type == VLNK) {
- if ((int)ip->i_size < vp->v_mount->mnt_maxsymlinklen)
+ if ((int)ip->i_size < VFSTOUFS(vp->v_mount)->um_maxsymlinklen)
panic("ffs_read: short symlink");
} else if (vp->v_type != VREG && vp->v_type != VDIR)
panic("ffs_read: type %d", vp->v_type);
diff --git a/sys/ufs/ufs/ufs_dirhash.c b/sys/ufs/ufs/ufs_dirhash.c
--- a/sys/ufs/ufs/ufs_dirhash.c
+++ b/sys/ufs/ufs/ufs_dirhash.c
@@ -65,7 +65,6 @@
#define WRAPINCR(val, limit) (((val) + 1 == (limit)) ? 0 : ((val) + 1))
#define WRAPDECR(val, limit) (((val) == 0) ? ((limit) - 1) : ((val) - 1))
-#define OFSFMT(vp) ((vp)->v_mount->mnt_maxsymlinklen <= 0)
#define BLKFREE2IDX(n) ((n) > DH_NFSTATS ? DH_NFSTATS : (n))
static MALLOC_DEFINE(M_DIRHASH, "ufs_dirhash", "UFS directory hash tables");
diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c
--- a/sys/ufs/ufs/ufs_lookup.c
+++ b/sys/ufs/ufs/ufs_lookup.c
@@ -76,9 +76,6 @@
SYSCTL_INT(_debug, OID_AUTO, dircheck, CTLFLAG_RW, &dirchk, 0, "");
-/* true if old FS format...*/
-#define OFSFMT(vp) ((vp)->v_mount->mnt_maxsymlinklen <= 0)
-
static int
ufs_delete_denied(struct vnode *vdp, struct vnode *tdp, struct ucred *cred,
struct thread *td)
@@ -440,8 +437,7 @@
* reclen in ndp->ni_ufs area, and release
* directory buffer.
*/
- if (vdp->v_mount->mnt_maxsymlinklen > 0 &&
- ep->d_type == DT_WHT) {
+ if (!OFSFMT(vdp) && ep->d_type == DT_WHT) {
slotstatus = FOUND;
slotoffset = i_offset;
slotsize = ep->d_reclen;
@@ -854,7 +850,7 @@
bcopy(cnp->cn_nameptr, newdirp->d_name, namelen);
- if (ITOV(ip)->v_mount->mnt_maxsymlinklen > 0)
+ if (!OFSFMT(ITOV(ip)))
newdirp->d_type = IFTODT(ip->i_mode);
else {
newdirp->d_type = 0;
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -1155,7 +1155,7 @@
switch (ap->a_flags) {
case LOOKUP:
/* 4.4 format directories support whiteout operations */
- if (dvp->v_mount->mnt_maxsymlinklen > 0)
+ if (!OFSFMT(dvp))
return (0);
return (EOPNOTSUPP);
@@ -1164,7 +1164,7 @@
#ifdef INVARIANTS
if ((cnp->cn_flags & SAVENAME) == 0)
panic("ufs_whiteout: missing name");
- if (dvp->v_mount->mnt_maxsymlinklen <= 0)
+ if (OFSFMT(dvp))
panic("ufs_whiteout: old format filesystem");
#endif
@@ -1178,7 +1178,7 @@
case DELETE:
/* remove an existing directory whiteout */
#ifdef INVARIANTS
- if (dvp->v_mount->mnt_maxsymlinklen <= 0)
+ if (OFSFMT(dvp))
panic("ufs_whiteout: old format filesystem");
#endif
@@ -2083,7 +2083,7 @@
/*
* Initialize directory with "." and ".." from static template.
*/
- if (dvp->v_mount->mnt_maxsymlinklen > 0)
+ if (!OFSFMT(dvp))
dtp = &mastertemplate;
else
dtp = (struct dirtemplate *)&omastertemplate;
@@ -2287,7 +2287,7 @@
return (error);
vp = *vpp;
len = strlen(ap->a_target);
- if (len < vp->v_mount->mnt_maxsymlinklen) {
+ if (len < VFSTOUFS(vp->v_mount)->um_maxsymlinklen) {
ip = VTOI(vp);
bcopy(ap->a_target, SHORTLINK(ip), len);
ip->i_size = len;
@@ -2377,7 +2377,7 @@
}
#if BYTE_ORDER == LITTLE_ENDIAN
/* Old filesystem format. */
- if (vp->v_mount->mnt_maxsymlinklen <= 0) {
+ if (OFSFMT(vp)) {
dstdp.d_namlen = dp->d_type;
dstdp.d_type = dp->d_namlen;
} else
@@ -2458,7 +2458,7 @@
doff_t isize;
isize = ip->i_size;
- if (isize < vp->v_mount->mnt_maxsymlinklen)
+ if (isize < VFSTOUFS(vp->v_mount)->um_maxsymlinklen)
return (uiomove(SHORTLINK(ip), isize, ap->a_uio));
return (VOP_READ(vp, ap->a_uio, 0, ap->a_cred));
}
diff --git a/sys/ufs/ufs/ufsmount.h b/sys/ufs/ufs/ufsmount.h
--- a/sys/ufs/ufs/ufsmount.h
+++ b/sys/ufs/ufs/ufsmount.h
@@ -100,6 +100,8 @@
u_long um_nindir; /* (c) indirect ptrs per blk */
u_long um_bptrtodb; /* (c) indir disk block ptr */
u_long um_seqinc; /* (c) inc between seq blocks */
+ uint64_t um_maxsymlinklen; /* (c) max size of short
+ symlink */
struct mtx um_lock; /* (c) Protects ufsmount & fs */
pid_t um_fsckpid; /* (u) PID can do fsck sysctl */
struct mount_softdeps *um_softdep; /* (c) softdep mgmt structure */
@@ -194,4 +196,7 @@
#define blkptrtodb(ump, b) ((b) << (ump)->um_bptrtodb)
#define is_sequential(ump, a, b) ((b) == (a) + ump->um_seqinc)
+/* true if old FS format...*/
+#define OFSFMT(vp) (VFSTOUFS((vp)->v_mount)->um_maxsymlinklen <= 0)
+
#endif
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Feb 6, 3:59 AM (21 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16486479
Default Alt Text
D30325.diff (9 KB)
Attached To
Mode
D30325: Move mnt_maxsymlinklen into appropriate fs mount data structures
Attached
Detach File
Event Timeline
Log In to Comment