aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/zfs_vnops.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2014-07-15 13:29:57 -0700
committerBrian Behlendorf <[email protected]>2014-07-17 15:15:07 -0700
commit1e8db7710220332808920a582e5794d6fc37b109 (patch)
tree5480855f5bc841e32703bc7cf4f0835b212f3077 /module/zfs/zfs_vnops.c
parenta5778ea2427bd340e3b4f697d9b6e1452bd71909 (diff)
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 <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2405
Diffstat (limited to 'module/zfs/zfs_vnops.c')
-rw-r--r--module/zfs/zfs_vnops.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
index 91f743aaa..4f531733e 100644
--- a/module/zfs/zfs_vnops.c
+++ b/module/zfs/zfs_vnops.c
@@ -3965,7 +3965,8 @@ zfs_putpage(struct inode *ip, struct page *pp, struct writeback_control *wbc)
* writepages() normally handles the entire commit for
* performance reasons.
*/
- zil_commit(zsb->z_log, zp->z_id);
+ if (zsb->z_log != NULL)
+ zil_commit(zsb->z_log, zp->z_id);
}
ZFS_EXIT(zsb);