mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Update inode under range lock
After a successful write the inode must be updated under the range lock. If it is updated after dropping the lock there exists a race where the znode and inode wile disagree about the file size. This could result in narrow window of time where read(2) is able to access data beyond what fstat(2) reports as the file size. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ned Bass <bass6@llnl.gov> Closes #3601
This commit is contained in:
parent
bd29109f1a
commit
2a53e2dacc
@ -897,6 +897,7 @@ zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr)
|
||||
uio_prefaultpages(MIN(n, max_blksz), uio);
|
||||
}
|
||||
|
||||
zfs_inode_update(zp);
|
||||
zfs_range_unlock(rl);
|
||||
|
||||
/*
|
||||
@ -912,7 +913,6 @@ zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr)
|
||||
zsb->z_os->os_sync == ZFS_SYNC_ALWAYS)
|
||||
zil_commit(zilog, zp->z_id);
|
||||
|
||||
zfs_inode_update(zp);
|
||||
ZFS_EXIT(zsb);
|
||||
return (0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user