mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Fix link count of root inode when snapdir is visible
Given how zfs_getattr() is implemented, zfs_getattr_fast() (used by ->getattr() of zpl inodes) also needs to consider an additional link count if "snapdir" property is set to "visible". Without this, # of directories in root inode of each dataset doesn't match the link count when snapdir is visible. Reviewed-by: Richard Yao <ryao@gentoo.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@osnexus.com> Closes #8727
This commit is contained in:
parent
e2dddb7e58
commit
97aa3ba44f
@ -2657,6 +2657,12 @@ zfs_getattr_fast(struct inode *ip, struct kstat *sp)
|
||||
mutex_enter(&zp->z_lock);
|
||||
|
||||
generic_fillattr(ip, sp);
|
||||
/*
|
||||
* +1 link count for root inode with visible '.zfs' directory.
|
||||
*/
|
||||
if ((zp->z_id == zfsvfs->z_root) && zfs_show_ctldir(zp))
|
||||
if (sp->nlink < ZFS_LINK_MAX)
|
||||
sp->nlink++;
|
||||
|
||||
sa_object_size(zp->z_sa_hdl, &blksize, &nblocks);
|
||||
sp->blksize = blksize;
|
||||
|
Loading…
Reference in New Issue
Block a user