mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Fix a problem that occurs when truncating files on NFSv3 mounts: we need
to set np->n_size back to the desired size again after calling nfs_meta_setsize(), since it could end up in nfs_loadattrcache() getting called, which would change n_size back to the value it had before the truncate request was issued. The result of this bug is that the size info cached in the nfsnode becomes incorrect, lseek(fd, ofs, SEEK_END) seeks past the end of the file, stat() returns the wrong size, etc. PR: 41792 MFC after: 2 weeks
This commit is contained in:
parent
c9ae54eebb
commit
aae962d56e
1 changed files with 7 additions and 1 deletions
|
|
@ -662,7 +662,13 @@ nfs_setattr(struct vop_setattr_args *ap)
|
|||
return (error);
|
||||
}
|
||||
}
|
||||
np->n_vattr.va_size = vap->va_size;
|
||||
/*
|
||||
* np->n_size has already been set to vap->va_size
|
||||
* in nfs_meta_setsize(). We must set it again since
|
||||
* nfs_loadattrcache() could be called through
|
||||
* nfs_meta_setsize() and could modify np->n_size.
|
||||
*/
|
||||
np->n_vattr.va_size = np->n_size = vap->va_size;
|
||||
};
|
||||
} else if ((vap->va_mtime.tv_sec != VNOVAL ||
|
||||
vap->va_atime.tv_sec != VNOVAL) && (np->n_flag & NMODIFIED) &&
|
||||
|
|
|
|||
Loading…
Reference in a new issue