mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 19:28:53 +03:00
Fix zil_commit() NULL dereference
Update the current code to ensure inodes are never dirtied if they are part of a read-only file system or snapshot. If they do somehow get dirtied an attempt will make made to write them to disk. In the case of snapshots, which don't have a ZIL, this will result in a NULL dereference in zil_commit(). Signed-off-by: Richard Yao <ryao@gentoo.org> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #2405
This commit is contained in:
@@ -511,6 +511,21 @@ zfs_inode_update(znode_t *zp)
|
||||
spin_unlock(&ip->i_lock);
|
||||
}
|
||||
|
||||
/*
|
||||
* Safely mark an inode dirty. Inodes which are part of a read-only
|
||||
* file system or snapshot may not be dirtied.
|
||||
*/
|
||||
void
|
||||
zfs_mark_inode_dirty(struct inode *ip)
|
||||
{
|
||||
zfs_sb_t *zsb = ITOZSB(ip);
|
||||
|
||||
if (zfs_is_readonly(zsb) || dmu_objset_is_snapshot(zsb->z_os))
|
||||
return;
|
||||
|
||||
mark_inode_dirty(ip);
|
||||
}
|
||||
|
||||
static uint64_t empty_xattr;
|
||||
static uint64_t pad[4];
|
||||
static zfs_acl_phys_t acl_phys;
|
||||
|
||||
Reference in New Issue
Block a user