diff options
author | Marcel Telka <[email protected]> | 2016-01-10 23:31:24 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-01-11 10:29:48 -0800 |
commit | f3c9dca0937a7ca4fde2e47093cdae69f92dfb07 (patch) | |
tree | bad2d1b3ecbea4b850b5752f7c7d252c140e632e /module | |
parent | 53e0313506a4df6a39e9ac64e25f1e45e14af36a (diff) |
Illumos 4638 - Panic in ZFS via rfs3_setattr()/rfs3_write(): dirtying snapshot!
4638 Panic in ZFS via rfs3_setattr()/rfs3_write(): dirtying snapshot!
Reviewed by: Alek Pinchuk <[email protected]>
Reviewed by: Ilya Usvyatsky <[email protected]>
Reviewed by: Dan McDonald <[email protected]>
Reviewed by: Matthew Ahrens <[email protected]>
Reviewed by: Garrett D'Amore <[email protected]>
Approved by: Garrett D'Amore <[email protected]>
References:
https://www.illumos.org/issues/4638
https://github.com/illumos/illumos-gate/commit/2144b12
Porting notes:
- [module/zfs/zfs_vnops.c]
- 3558fd7 Prototype/structure update for Linux
- 2cf7f52 Linux compat 2.6.39: mount_nodev()
- Use zfs_is_readonly() wrapper
- Remove first line of comment which doesn't apply
Ported-by: kernelOfTruth [email protected]
Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'module')
-rw-r--r-- | module/zfs/zfs_vnops.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index 174c918ab..64412a69d 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright 2014 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2015 by Chunwei Chen. All rights reserved. */ @@ -622,6 +623,15 @@ zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr) &zp->z_pflags, 8); /* + * Callers might not be able to detect properly that we are read-only, + * so check it explicitly here. + */ + if (zfs_is_readonly(zsb)) { + ZFS_EXIT(zsb); + return (SET_ERROR(EROFS)); + } + + /* * If immutable or not appending then return EPERM */ if ((zp->z_pflags & (ZFS_IMMUTABLE | ZFS_READONLY)) || @@ -4378,6 +4388,15 @@ zfs_space(struct inode *ip, int cmd, flock64_t *bfp, int flag, return (SET_ERROR(EINVAL)); } + /* + * Callers might not be able to detect properly that we are read-only, + * so check it explicitly here. + */ + if (zfs_is_readonly(zsb)) { + ZFS_EXIT(zsb); + return (SET_ERROR(EROFS)); + } + if ((error = convoff(ip, bfp, 0, offset))) { ZFS_EXIT(zsb); return (error); |