git: e59180ea09a1 - main - msdosfs: correct handling of vnode pager size on file extension error
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 13 Feb 2023 22:31:40 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e59180ea09a1d1d1463f2a269e94efa0f0b677c5 commit e59180ea09a1d1d1463f2a269e94efa0f0b677c5 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2023-02-10 04:58:43 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-02-13 22:29:19 +0000 msdosfs: correct handling of vnode pager size on file extension error If extension fails, vnode pager recorded size might be left increased. Only update vnode pager when extension is past the point of no rollback. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D38549 --- sys/fs/msdosfs/msdosfs_denode.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index 9a9916e39a67..6c38481681de 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -386,10 +386,8 @@ detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred) return (EINVAL); } - if (dep->de_FileSize < length) { - vnode_pager_setsize(DETOV(dep), length); + if (dep->de_FileSize < length) return (deextend(dep, length, cred)); - } /* * If the desired length is 0 then remember the starting cluster of @@ -530,6 +528,7 @@ deextend(struct denode *dep, u_long length, struct ucred *cred) return (error); } } + vnode_pager_setsize(DETOV(dep), length); dep->de_FileSize = length; dep->de_flag |= DE_UPDATE | DE_MODIFIED; return (deupdat(dep, !DOINGASYNC(DETOV(dep))));