diff options
author | Brian Behlendorf <[email protected]> | 2015-07-16 13:35:04 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-07-17 09:18:22 -0700 |
commit | 2a53e2dacc7a7c0a8c63ff2eef3aff95f6ac80b1 (patch) | |
tree | bac21535610c22603ee4656d14edac1fe3b0fc63 | |
parent | bd29109f1ac5be68f7f7c8bcb49e1b706fe899f0 (diff) |
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 <[email protected]>
Signed-off-by: Ned Bass <[email protected]>
Closes #3601
-rw-r--r-- | module/zfs/zfs_vnops.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index 7780fe902..d69b34f18 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -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); } |