Commit f1b4324b authored by Chuck Silvers's avatar Chuck Silvers
Browse files

ffs: fix vn_read_from_obj() usage for PAGE_SIZE > block size

vn_read_from_obj() requires that all pages of a vnode (except the last
partial page) be either completely valid or completely invalid,
but for file systems with block size smaller than PAGE_SIZE,
partially valid pages may exist anywhere in the file.
Do not enable the vn_read_from_obj() path in this case.

Reviewed by:	mckusick, kib, markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D34836
parent 5d3fe02c
......@@ -801,6 +801,7 @@ ffs_reload(struct mount *mp, int flags)
sblockloc = fs->fs_sblockloc;
bcopy(newfs, fs, (u_int)fs->fs_sbsize);
brelse(bp);
ump->um_bsize = fs->fs_bsize;
ump->um_maxsymlinklen = fs->fs_maxsymlinklen;
ffs_oldfscompat_read(fs, VFSTOUFS(mp), sblockloc);
UFS_LOCK(ump);
......@@ -1064,6 +1065,7 @@ ffs_mountfs(odevvp, mp, td)
vfs_rel(nmp);
vfs_getnewfsid(mp);
}
ump->um_bsize = fs->fs_bsize;
ump->um_maxsymlinklen = fs->fs_maxsymlinklen;
MNT_ILOCK(mp);
mp->mnt_flag |= MNT_LOCAL;
......
......@@ -314,7 +314,8 @@ ufs_open(struct vop_open_args *ap)
ip = VTOI(vp);
vnode_create_vobject(vp, DIP(ip, i_size), ap->a_td);
if (vp->v_type == VREG && (vn_irflag_read(vp) & VIRF_PGREAD) == 0) {
if (vp->v_type == VREG && (vn_irflag_read(vp) & VIRF_PGREAD) == 0 &&
ip->i_ump->um_bsize >= PAGE_SIZE) {
vn_irflag_set_cond(vp, VIRF_PGREAD);
}
......
......@@ -96,6 +96,7 @@ struct ufsmount {
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 */
u_long um_bsize; /* (c) fs block size */
uint64_t um_maxsymlinklen; /* (c) max size of short
symlink */
struct mtx um_lock; /* (c) Protects ufsmount & fs */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment