aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJitendra Patidar <jitendra.patidar@nutanix.com>2026-01-06 18:58:56 +0000
committerGitHub <noreply@github.com>2026-01-06 18:58:56 +0000
commit2301755dfb2ac086780f9938a51d836862fddb6f (patch)
treed4bcf0b41188995c8f88b7ff2af45ff76ad552eb
parentc77f17b7505f8e698817cdcaca67b6e73d1b6d91 (diff)
-rw-r--r--module/os/freebsd/zfs/zfs_vnops_os.c5
-rw-r--r--module/os/linux/zfs/zfs_vnops_os.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/module/os/freebsd/zfs/zfs_vnops_os.c b/module/os/freebsd/zfs/zfs_vnops_os.c
index 9b90a2c3e431..032f9b8e149b 100644
--- a/module/os/freebsd/zfs/zfs_vnops_os.c
+++ b/module/os/freebsd/zfs/zfs_vnops_os.c
@@ -242,8 +242,9 @@ zfs_open(vnode_t **vpp, int flag, cred_t *cr)
* Keep a count of the synchronous opens in the znode. On first
* synchronous open we must convert all previous async transactions
* into sync to keep correct ordering.
+ * Skip it for snapshot, as it won't have any transactions.
*/
- if (flag & O_SYNC) {
+ if (!zfsvfs->z_issnap && (flag & O_SYNC)) {
if (atomic_inc_32_nv(&zp->z_sync_cnt) == 1)
zil_async_to_sync(zfsvfs->z_log, zp->z_id);
}
@@ -264,7 +265,7 @@ zfs_close(vnode_t *vp, int flag, int count, offset_t offset, cred_t *cr)
return (error);
/* Decrement the synchronous opens in the znode */
- if ((flag & O_SYNC) && (count == 1))
+ if (!zfsvfs->z_issnap && (flag & O_SYNC) && (count == 1))
atomic_dec_32(&zp->z_sync_cnt);
zfs_exit(zfsvfs, FTAG);
diff --git a/module/os/linux/zfs/zfs_vnops_os.c b/module/os/linux/zfs/zfs_vnops_os.c
index 6ec154504ba8..e65f81230124 100644
--- a/module/os/linux/zfs/zfs_vnops_os.c
+++ b/module/os/linux/zfs/zfs_vnops_os.c
@@ -200,8 +200,9 @@ zfs_open(struct inode *ip, int mode, int flag, cred_t *cr)
* Keep a count of the synchronous opens in the znode. On first
* synchronous open we must convert all previous async transactions
* into sync to keep correct ordering.
+ * Skip it for snapshot, as it won't have any transactions.
*/
- if (flag & O_SYNC) {
+ if (!zfsvfs->z_issnap && (flag & O_SYNC)) {
if (atomic_inc_32_nv(&zp->z_sync_cnt) == 1)
zil_async_to_sync(zfsvfs->z_log, zp->z_id);
}
@@ -222,7 +223,7 @@ zfs_close(struct inode *ip, int flag, cred_t *cr)
return (error);
/* Decrement the synchronous opens in the znode */
- if (flag & O_SYNC)
+ if (!zfsvfs->z_issnap && (flag & O_SYNC))
atomic_dec_32(&zp->z_sync_cnt);
zfs_exit(zfsvfs, FTAG);