aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/zpl_inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'module/zfs/zpl_inode.c')
-rw-r--r--module/zfs/zpl_inode.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/module/zfs/zpl_inode.c b/module/zfs/zpl_inode.c
index c009807cb..fc6231b88 100644
--- a/module/zfs/zpl_inode.c
+++ b/module/zfs/zpl_inode.c
@@ -40,12 +40,15 @@ zpl_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
cred_t *cr = CRED();
struct inode *ip;
int error;
+ fstrans_cookie_t cookie;
if (dlen(dentry) > ZFS_MAXNAMELEN)
return (ERR_PTR(-ENAMETOOLONG));
crhold(cr);
+ cookie = spl_fstrans_mark();
error = -zfs_lookup(dir, dname(dentry), &ip, 0, cr, NULL, NULL);
+ spl_fstrans_unmark(cookie);
ASSERT3S(error, <=, 0);
crfree(cr);
@@ -95,12 +98,15 @@ zpl_create(struct inode *dir, struct dentry *dentry, zpl_umode_t mode,
struct inode *ip;
vattr_t *vap;
int error;
+ fstrans_cookie_t cookie;
crhold(cr);
vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP);
zpl_vap_init(vap, dir, mode, cr);
+ cookie = spl_fstrans_mark();
error = -zfs_create(dir, dname(dentry), vap, 0, mode, &ip, cr, 0, NULL);
+ spl_fstrans_unmark(cookie);
if (error == 0) {
VERIFY0(zpl_xattr_security_init(ip, dir, &dentry->d_name));
VERIFY0(zpl_init_acl(ip, dir));
@@ -122,6 +128,7 @@ zpl_mknod(struct inode *dir, struct dentry *dentry, zpl_umode_t mode,
struct inode *ip;
vattr_t *vap;
int error;
+ fstrans_cookie_t cookie;
/*
* We currently expect Linux to supply rdev=0 for all sockets
@@ -135,7 +142,9 @@ zpl_mknod(struct inode *dir, struct dentry *dentry, zpl_umode_t mode,
zpl_vap_init(vap, dir, mode, cr);
vap->va_rdev = rdev;
+ cookie = spl_fstrans_mark();
error = -zfs_create(dir, dname(dentry), vap, 0, mode, &ip, cr, 0, NULL);
+ spl_fstrans_unmark(cookie);
if (error == 0) {
VERIFY0(zpl_xattr_security_init(ip, dir, &dentry->d_name));
VERIFY0(zpl_init_acl(ip, dir));
@@ -154,9 +163,12 @@ zpl_unlink(struct inode *dir, struct dentry *dentry)
{
cred_t *cr = CRED();
int error;
+ fstrans_cookie_t cookie;
crhold(cr);
+ cookie = spl_fstrans_mark();
error = -zfs_remove(dir, dname(dentry), cr);
+ spl_fstrans_unmark(cookie);
crfree(cr);
ASSERT3S(error, <=, 0);
@@ -170,12 +182,15 @@ zpl_mkdir(struct inode *dir, struct dentry *dentry, zpl_umode_t mode)
vattr_t *vap;
struct inode *ip;
int error;
+ fstrans_cookie_t cookie;
crhold(cr);
vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP);
zpl_vap_init(vap, dir, mode | S_IFDIR, cr);
+ cookie = spl_fstrans_mark();
error = -zfs_mkdir(dir, dname(dentry), vap, &ip, cr, 0, NULL);
+ spl_fstrans_unmark(cookie);
if (error == 0) {
VERIFY0(zpl_xattr_security_init(ip, dir, &dentry->d_name));
VERIFY0(zpl_init_acl(ip, dir));
@@ -194,9 +209,12 @@ zpl_rmdir(struct inode * dir, struct dentry *dentry)
{
cred_t *cr = CRED();
int error;
+ fstrans_cookie_t cookie;
crhold(cr);
+ cookie = spl_fstrans_mark();
error = -zfs_rmdir(dir, dname(dentry), NULL, cr, 0);
+ spl_fstrans_unmark(cookie);
crfree(cr);
ASSERT3S(error, <=, 0);
@@ -208,6 +226,7 @@ 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
@@ -220,7 +239,9 @@ zpl_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
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);
@@ -233,6 +254,7 @@ zpl_setattr(struct dentry *dentry, struct iattr *ia)
cred_t *cr = CRED();
vattr_t *vap;
int error;
+ fstrans_cookie_t cookie;
error = inode_change_ok(ip, ia);
if (error)
@@ -249,7 +271,9 @@ zpl_setattr(struct dentry *dentry, struct iattr *ia)
vap->va_mtime = ia->ia_mtime;
vap->va_ctime = ia->ia_ctime;
+ cookie = spl_fstrans_mark();
error = -zfs_setattr(ip, vap, 0, cr);
+ spl_fstrans_unmark(cookie);
if (!error && (ia->ia_valid & ATTR_MODE))
error = zpl_chmod_acl(ip);
@@ -266,9 +290,12 @@ zpl_rename(struct inode *sdip, struct dentry *sdentry,
{
cred_t *cr = CRED();
int error;
+ fstrans_cookie_t cookie;
crhold(cr);
+ cookie = spl_fstrans_mark();
error = -zfs_rename(sdip, dname(sdentry), tdip, dname(tdentry), cr, 0);
+ spl_fstrans_unmark(cookie);
crfree(cr);
ASSERT3S(error, <=, 0);
@@ -282,12 +309,15 @@ zpl_symlink(struct inode *dir, struct dentry *dentry, const char *name)
vattr_t *vap;
struct inode *ip;
int error;
+ fstrans_cookie_t cookie;
crhold(cr);
vap = kmem_zalloc(sizeof (vattr_t), KM_SLEEP);
zpl_vap_init(vap, dir, S_IFLNK | S_IRWXUGO, cr);
+ cookie = spl_fstrans_mark();
error = -zfs_symlink(dir, dname(dentry), vap, (char *)name, &ip, cr, 0);
+ spl_fstrans_unmark(cookie);
if (error == 0) {
VERIFY0(zpl_xattr_security_init(ip, dir, &dentry->d_name));
d_instantiate(dentry, ip);
@@ -309,6 +339,7 @@ zpl_follow_link(struct dentry *dentry, struct nameidata *nd)
uio_t uio;
char *link;
int error;
+ fstrans_cookie_t cookie;
crhold(cr);
@@ -320,7 +351,9 @@ zpl_follow_link(struct dentry *dentry, struct nameidata *nd)
uio.uio_resid = (MAXPATHLEN - 1);
uio.uio_segflg = UIO_SYSSPACE;
+ cookie = spl_fstrans_mark();
error = -zfs_readlink(ip, &uio, cr);
+ spl_fstrans_unmark(cookie);
if (error) {
kmem_free(link, MAXPATHLEN);
nd_set_link(nd, ERR_PTR(error));
@@ -347,6 +380,7 @@ zpl_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
cred_t *cr = CRED();
struct inode *ip = old_dentry->d_inode;
int error;
+ fstrans_cookie_t cookie;
if (ip->i_nlink >= ZFS_LINK_MAX)
return (-EMLINK);
@@ -355,7 +389,9 @@ zpl_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
ip->i_ctime = CURRENT_TIME_SEC;
igrab(ip); /* Use ihold() if available */
+ cookie = spl_fstrans_mark();
error = -zfs_link(dir, ip, dname(dentry), cr);
+ spl_fstrans_unmark(cookie);
if (error) {
iput(ip);
goto out;
@@ -375,6 +411,7 @@ zpl_truncate_range(struct inode *ip, loff_t start, loff_t end)
{
cred_t *cr = CRED();
flock64_t bf;
+ fstrans_cookie_t cookie;
ASSERT3S(start, <=, end);
@@ -392,7 +429,9 @@ zpl_truncate_range(struct inode *ip, loff_t start, loff_t end)
bf.l_start = start;
bf.l_len = end - start;
bf.l_pid = 0;
+ cookie = spl_fstrans_mark();
zfs_space(ip, F_FREESP, &bf, FWRITE, start, cr);
+ spl_fstrans_unmark(cookie);
crfree(cr);
}