summaryrefslogtreecommitdiffstats
path: root/module/zfs/zpl_ctldir.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2013-12-04 13:50:34 -0800
committerBrian Behlendorf <[email protected]>2013-12-06 09:42:39 -0800
commit90ee9ed32faa31174c673165c876b92272a93c72 (patch)
tree3988271441d443055f4f8b863dfb79edba24134f /module/zfs/zpl_ctldir.c
parent99e349db92008ee61dad5a612056cf0fdecb3896 (diff)
Fix 'zfs diff' shares error
When creating a dataset with ZoL a zsb->z_shares_dir ZAP object will not be created because shares are unimplemented. Instead ZoL just sets zsb->z_shares_dir to zero to indicate there are no shares. However, if you import a pool which was created with a different ZFS implementation then the shares ZAP object may exist. Code was added to handle this case but it clearly wasn't sufficiently tested with other ZFS pools. There was a bug in the zpl_shares_getattr() function which passed the wrong inode to zfs_getattr_fast() for the case where are shares ZAP object does exist. This causes an EIO to be returned to stat64() which in turn causes 'zfs diff' to fail. This fix is the pass the correct inode after a sucessful zfs_zget(). Additionally, only put away the references if we were able to get one. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Graham Booker <https://github.com/gbooker> Signed-off-by: timemaster67 <https://github.com/timemaster67> Closes #1426 Closes #481
Diffstat (limited to 'module/zfs/zpl_ctldir.c')
-rw-r--r--module/zfs/zpl_ctldir.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/module/zfs/zpl_ctldir.c b/module/zfs/zpl_ctldir.c
index 96157ec78..8afe8bfdb 100644
--- a/module/zfs/zpl_ctldir.c
+++ b/module/zfs/zpl_ctldir.c
@@ -497,10 +497,11 @@ zpl_shares_getattr(struct vfsmount *mnt, struct dentry *dentry,
}
error = -zfs_zget(zsb, zsb->z_shares_dir, &dzp);
- if (error == 0)
- error = -zfs_getattr_fast(dentry->d_inode, stat);
+ if (error == 0) {
+ error = -zfs_getattr_fast(ZTOI(dzp), stat);
+ iput(ZTOI(dzp));
+ }
- iput(ZTOI(dzp));
ZFS_EXIT(zsb);
ASSERT3S(error, <=, 0);