mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-26 04:07:45 +03:00
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().
This commit is contained in:
+4
-20
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user