summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorperrin <none@none>2006-05-05 13:50:51 -0700
committerperrin <none@none>2006-05-05 13:50:51 -0700
commit5263255c044f0cccd4447065df09c36017620859 (patch)
tree0ce5dd709df7bbf95501619da063e88915b14c86
parent489f952b4388bd1ea1feff97164a4416e0c621ea (diff)
downloadillumos-gate-5263255c044f0cccd4447065df09c36017620859.tar.gz
6422565 Data corruption possible with range lock for dmu_sync()
-rw-r--r--usr/src/uts/common/fs/zfs/zfs_vnops.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr/src/uts/common/fs/zfs/zfs_vnops.c b/usr/src/uts/common/fs/zfs/zfs_vnops.c
index 6edb60c7b0..e5562396fc 100644
--- a/usr/src/uts/common/fs/zfs/zfs_vnops.c
+++ b/usr/src/uts/common/fs/zfs/zfs_vnops.c
@@ -879,7 +879,12 @@ zfs_get_data(void *arg, lr_write_t *lr, char *buf)
* blocksize after we get the lock in case it's changed!
*/
for (;;) {
- boff = off & ~(zp->z_blksz - 1);
+ if (ISP2(zp->z_blksz)) {
+ boff = P2ALIGN_TYPED(off, zp->z_blksz,
+ uint64_t);
+ } else {
+ boff = 0;
+ }
dlen = zp->z_blksz;
rl = zfs_range_lock(zp, boff, dlen, RL_READER);
if (zp->z_blksz == dlen)