diff options
author | Tony Hutter <[email protected]> | 2018-04-09 14:24:46 -0700 |
---|---|---|
committer | Tony Hutter <[email protected]> | 2018-04-09 17:29:59 -0400 |
commit | 9a2e90c9fc469d377c14eb863952261f9ec12d2c (patch) | |
tree | ad0c8f54c806d3941260755befa1915d82db86ab /module/zfs/zfs_vnops.c | |
parent | 240ccfc13adb46faf3d6e5e17e25a9769dd06733 (diff) |
Revert "Handle zap_add() failures in mixed ... "
This reverts commit cc63068e95ee725cce03b1b7ce50179825a6cda5.
Under certain circumstances this change can result in an ENOSPC
error when adding new files to a directory. See #7401 for full
details.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Issue #7401
Closes #7416
Diffstat (limited to 'module/zfs/zfs_vnops.c')
-rw-r--r-- | module/zfs/zfs_vnops.c | 73 |
1 files changed, 18 insertions, 55 deletions
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index 8a7ad702c..6f6ce79db 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -1443,22 +1443,10 @@ top: } zfs_mknode(dzp, vap, tx, cr, 0, &zp, &acl_ids); - error = zfs_link_create(dl, zp, tx, ZNEW); - if (error != 0) { - /* - * Since, we failed to add the directory entry for it, - * delete the newly created dnode. - */ - zfs_znode_delete(zp, tx); - remove_inode_hash(ZTOI(zp)); - zfs_acl_ids_free(&acl_ids); - dmu_tx_commit(tx); - goto out; - } - if (fuid_dirtied) zfs_fuid_sync(zfsvfs, tx); + (void) zfs_link_create(dl, zp, tx, ZNEW); txtype = zfs_log_create_txtype(Z_FILE, vsecp, vap); if (flag & FIGNORECASE) txtype |= TX_CI; @@ -2049,18 +2037,13 @@ top: */ zfs_mknode(dzp, vap, tx, cr, 0, &zp, &acl_ids); + if (fuid_dirtied) + zfs_fuid_sync(zfsvfs, tx); + /* * Now put new name in parent dir. */ - error = zfs_link_create(dl, zp, tx, ZNEW); - if (error != 0) { - zfs_znode_delete(zp, tx); - remove_inode_hash(ZTOI(zp)); - goto out; - } - - if (fuid_dirtied) - zfs_fuid_sync(zfsvfs, tx); + (void) zfs_link_create(dl, zp, tx, ZNEW); *ipp = ZTOI(zp); @@ -2070,7 +2053,6 @@ top: zfs_log_create(zilog, tx, txtype, dzp, zp, dirname, vsecp, acl_ids.z_fuidp, vap); -out: zfs_acl_ids_free(&acl_ids); dmu_tx_commit(tx); @@ -2080,14 +2062,10 @@ out: if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS) zil_commit(zilog, 0); - if (error != 0) { - iput(ZTOI(zp)); - } else { - zfs_inode_update(dzp); - zfs_inode_update(zp); - } + zfs_inode_update(dzp); + zfs_inode_update(zp); ZFS_EXIT(zfsvfs); - return (error); + return (0); } /* @@ -3705,13 +3683,6 @@ top: VERIFY3U(zfs_link_destroy(tdl, szp, tx, ZRENAMING, NULL), ==, 0); } - } else { - /* - * If we had removed the existing target, subsequent - * call to zfs_link_create() to add back the same entry - * but, the new dnode (szp) should not fail. - */ - ASSERT(tzp == NULL); } } @@ -3882,18 +3853,14 @@ top: /* * Insert the new object into the directory. */ - error = zfs_link_create(dl, zp, tx, ZNEW); - if (error != 0) { - zfs_znode_delete(zp, tx); - remove_inode_hash(ZTOI(zp)); - } else { - if (flags & FIGNORECASE) - txtype |= TX_CI; - zfs_log_symlink(zilog, tx, txtype, dzp, zp, name, link); + (void) zfs_link_create(dl, zp, tx, ZNEW); - zfs_inode_update(dzp); - zfs_inode_update(zp); - } + if (flags & FIGNORECASE) + txtype |= TX_CI; + zfs_log_symlink(zilog, tx, txtype, dzp, zp, name, link); + + zfs_inode_update(dzp); + zfs_inode_update(zp); zfs_acl_ids_free(&acl_ids); @@ -3901,14 +3868,10 @@ top: zfs_dirent_unlock(dl); - if (error == 0) { - *ipp = ZTOI(zp); + *ipp = ZTOI(zp); - if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS) - zil_commit(zilog, 0); - } else { - iput(ZTOI(zp)); - } + if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS) + zil_commit(zilog, 0); ZFS_EXIT(zfsvfs); return (error); |