示例#1
0
文件: zpl_ctldir.c 项目: awein/zfs
/* ARGSUSED */
static int
zpl_shares_getattr(struct vfsmount *mnt, struct dentry *dentry,
    struct kstat *stat)
{
	struct inode *ip = dentry->d_inode;
	zfs_sb_t *zsb = ITOZSB(ip);
	znode_t *dzp;
	int error;

	ZFS_ENTER(zsb);

	if (zsb->z_shares_dir == 0) {
		error = simple_getattr(mnt, dentry, stat);
		stat->nlink = stat->size = 2;
		stat->atime = CURRENT_TIME;
		ZFS_EXIT(zsb);
		return (error);
	}

	error = -zfs_zget(zsb, zsb->z_shares_dir, &dzp);
	if (error == 0) {
		error = -zfs_getattr_fast(ZTOI(dzp), stat);
		iput(ZTOI(dzp));
	}

	//VN_RELE(ZTOI(dzp));
	ZFS_EXIT(zsb);
	ASSERT3S(error, <=, 0);

	return (error);
}
示例#2
0
文件: zpl_inode.c 项目: dun/zfs
static int
zpl_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
{
	boolean_t issnap = ITOZSB(dentry->d_inode)->z_issnap;
	int error;
	fstrans_cookie_t cookie;

	/*
	 * Ensure MNT_SHRINKABLE is set on snapshots to ensure they are
	 * unmounted automatically with the parent file system.  This
	 * is done on the first getattr because it's not easy to get the
	 * vfsmount structure at mount time.  This call path is explicitly
	 * marked unlikely to avoid any performance impact.  FWIW, ext4
	 * resorts to a similar trick for sysadmin convenience.
	 */
	if (unlikely(issnap && !(mnt->mnt_flags & MNT_SHRINKABLE)))
		mnt->mnt_flags |= MNT_SHRINKABLE;

	cookie = spl_fstrans_mark();
	error = -zfs_getattr_fast(dentry->d_inode, stat);
	spl_fstrans_unmark(cookie);
	ASSERT3S(error, <=, 0);

	return (error);
}
示例#3
0
文件: zpl_inode.c 项目: krauter/zfs
static int
zpl_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
{
    int error;

    error = -zfs_getattr_fast(dentry->d_inode, stat);
    ASSERT3S(error, <=, 0);

    return (error);
}
示例#4
0
static int
zpl_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
{
	int error;
	fstrans_cookie_t cookie;

	cookie = spl_fstrans_mark();
	error = -zfs_getattr_fast(dentry->d_inode, stat);
	spl_fstrans_unmark(cookie);
	ASSERT3S(error, <=, 0);

	return (error);
}