mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-03-11 04:46:18 +03:00
Fix zfs_open() to skip zil_async_to_sync() for the snapshot
Fix zfs_open() to skip zil_async_to_sync() for the snapshot, as it won't have any transactions. zfsvfs->z_log is NULL for the snapshot. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com> Signed-off-by: Jitendra Patidar <jitendra.patidar@nutanix.com> Closes #18091
This commit is contained in:
parent
c77f17b750
commit
2301755dfb
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user