diff options
author | Brian Behlendorf <[email protected]> | 2011-03-29 23:04:39 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2011-04-07 09:51:57 -0700 |
commit | c85b224fafacafa49817101f26f0a9760a8d05d1 (patch) | |
tree | 4e08918675d6590cd332e51162c9ecccb9794091 /module/zfs/zpl_inode.c | |
parent | d433c206515e567c52ce09589033405a0ae3716e (diff) |
Call d_instantiate before unlocking inode
Under Linux a dentry referencing an inode must be instantiated before
the inode is unlocked. To accomplish this without overly modifing
the core ZFS code the dentry it passed via the vattr_t. There are
cases such as replay when a dentry is not available. In which case
it is obviously not initialized at inode creation time, if a dentry
is needed it will be spliced as when required via d_lookup().
Diffstat (limited to 'module/zfs/zpl_inode.c')
-rw-r--r-- | module/zfs/zpl_inode.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/module/zfs/zpl_inode.c b/module/zfs/zpl_inode.c index fcc19b004..029a4038b 100644 --- a/module/zfs/zpl_inode.c +++ b/module/zfs/zpl_inode.c @@ -66,14 +66,10 @@ zpl_create(struct inode *dir, struct dentry *dentry, int mode, vap->va_mask = ATTR_MODE; vap->va_uid = crgetfsuid(cr); vap->va_gid = crgetfsgid(cr); + vap->va_dentry = dentry; error = -zfs_create(dir, (char *)dentry->d_name.name, vap, 0, mode, &ip, cr, 0, NULL); - if (error) - goto out; - - d_instantiate(dentry, ip); -out: kmem_free(vap, sizeof(vattr_t)); crfree(cr); ASSERT3S(error, <=, 0); @@ -96,14 +92,10 @@ zpl_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) vap->va_rdev = rdev; vap->va_uid = crgetfsuid(cr); vap->va_gid = crgetfsgid(cr); + vap->va_dentry = dentry; error = -zfs_create(dir, (char *)dentry->d_name.name, vap, 0, mode, &ip, cr, 0, NULL); - if (error) - goto out; - - d_instantiate(dentry, ip); -out: kmem_free(vap, sizeof(vattr_t)); crfree(cr); ASSERT3S(error, <=, 0); @@ -139,13 +131,9 @@ zpl_mkdir(struct inode *dir, struct dentry *dentry, int mode) vap->va_mask = ATTR_MODE; vap->va_uid = crgetfsuid(cr); vap->va_gid = crgetfsgid(cr); + vap->va_dentry = dentry; error = -zfs_mkdir(dir, dname(dentry), vap, &ip, cr, 0, NULL); - if (error) - goto out; - - d_instantiate(dentry, ip); -out: kmem_free(vap, sizeof(vattr_t)); crfree(cr); ASSERT3S(error, <=, 0); @@ -264,13 +252,9 @@ zpl_symlink(struct inode *dir, struct dentry *dentry, const char *name) vap->va_mask = ATTR_MODE; vap->va_uid = crgetfsuid(cr); vap->va_gid = crgetfsgid(cr); + vap->va_dentry = dentry; error = -zfs_symlink(dir, dname(dentry), vap, (char *)name, &ip, cr, 0); - if (error) - goto out; - - d_instantiate(dentry, ip); -out: kmem_free(vap, sizeof(vattr_t)); crfree(cr); ASSERT3S(error, <=, 0); |