|
@@ -124,14 +124,14 @@ xfs_growfs_rt_alloc(
|
|
XFS_GROWRTALLOC_LOG_RES(mp), 0,
|
|
XFS_GROWRTALLOC_LOG_RES(mp), 0,
|
|
XFS_TRANS_PERM_LOG_RES,
|
|
XFS_TRANS_PERM_LOG_RES,
|
|
XFS_DEFAULT_PERM_LOG_COUNT)))
|
|
XFS_DEFAULT_PERM_LOG_COUNT)))
|
|
- goto error_exit;
|
|
|
|
|
|
+ goto error_cancel;
|
|
cancelflags = XFS_TRANS_RELEASE_LOG_RES;
|
|
cancelflags = XFS_TRANS_RELEASE_LOG_RES;
|
|
/*
|
|
/*
|
|
* Lock the inode.
|
|
* Lock the inode.
|
|
*/
|
|
*/
|
|
if ((error = xfs_trans_iget(mp, tp, ino, 0,
|
|
if ((error = xfs_trans_iget(mp, tp, ino, 0,
|
|
XFS_ILOCK_EXCL, &ip)))
|
|
XFS_ILOCK_EXCL, &ip)))
|
|
- goto error_exit;
|
|
|
|
|
|
+ goto error_cancel;
|
|
XFS_BMAP_INIT(&flist, &firstblock);
|
|
XFS_BMAP_INIT(&flist, &firstblock);
|
|
/*
|
|
/*
|
|
* Allocate blocks to the bitmap file.
|
|
* Allocate blocks to the bitmap file.
|
|
@@ -144,14 +144,16 @@ xfs_growfs_rt_alloc(
|
|
if (!error && nmap < 1)
|
|
if (!error && nmap < 1)
|
|
error = XFS_ERROR(ENOSPC);
|
|
error = XFS_ERROR(ENOSPC);
|
|
if (error)
|
|
if (error)
|
|
- goto error_exit;
|
|
|
|
|
|
+ goto error_cancel;
|
|
/*
|
|
/*
|
|
* Free any blocks freed up in the transaction, then commit.
|
|
* Free any blocks freed up in the transaction, then commit.
|
|
*/
|
|
*/
|
|
error = xfs_bmap_finish(&tp, &flist, &committed);
|
|
error = xfs_bmap_finish(&tp, &flist, &committed);
|
|
if (error)
|
|
if (error)
|
|
- goto error_exit;
|
|
|
|
- xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
|
|
|
|
|
|
+ goto error_cancel;
|
|
|
|
+ error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
|
|
|
|
+ if (error)
|
|
|
|
+ goto error;
|
|
/*
|
|
/*
|
|
* Now we need to clear the allocated blocks.
|
|
* Now we need to clear the allocated blocks.
|
|
* Do this one block per transaction, to keep it simple.
|
|
* Do this one block per transaction, to keep it simple.
|
|
@@ -166,13 +168,13 @@ xfs_growfs_rt_alloc(
|
|
*/
|
|
*/
|
|
if ((error = xfs_trans_reserve(tp, 0,
|
|
if ((error = xfs_trans_reserve(tp, 0,
|
|
XFS_GROWRTZERO_LOG_RES(mp), 0, 0, 0)))
|
|
XFS_GROWRTZERO_LOG_RES(mp), 0, 0, 0)))
|
|
- goto error_exit;
|
|
|
|
|
|
+ goto error_cancel;
|
|
/*
|
|
/*
|
|
* Lock the bitmap inode.
|
|
* Lock the bitmap inode.
|
|
*/
|
|
*/
|
|
if ((error = xfs_trans_iget(mp, tp, ino, 0,
|
|
if ((error = xfs_trans_iget(mp, tp, ino, 0,
|
|
XFS_ILOCK_EXCL, &ip)))
|
|
XFS_ILOCK_EXCL, &ip)))
|
|
- goto error_exit;
|
|
|
|
|
|
+ goto error_cancel;
|
|
/*
|
|
/*
|
|
* Get a buffer for the block.
|
|
* Get a buffer for the block.
|
|
*/
|
|
*/
|
|
@@ -181,14 +183,16 @@ xfs_growfs_rt_alloc(
|
|
mp->m_bsize, 0);
|
|
mp->m_bsize, 0);
|
|
if (bp == NULL) {
|
|
if (bp == NULL) {
|
|
error = XFS_ERROR(EIO);
|
|
error = XFS_ERROR(EIO);
|
|
- goto error_exit;
|
|
|
|
|
|
+ goto error_cancel;
|
|
}
|
|
}
|
|
memset(XFS_BUF_PTR(bp), 0, mp->m_sb.sb_blocksize);
|
|
memset(XFS_BUF_PTR(bp), 0, mp->m_sb.sb_blocksize);
|
|
xfs_trans_log_buf(tp, bp, 0, mp->m_sb.sb_blocksize - 1);
|
|
xfs_trans_log_buf(tp, bp, 0, mp->m_sb.sb_blocksize - 1);
|
|
/*
|
|
/*
|
|
* Commit the transaction.
|
|
* Commit the transaction.
|
|
*/
|
|
*/
|
|
- xfs_trans_commit(tp, 0);
|
|
|
|
|
|
+ error = xfs_trans_commit(tp, 0);
|
|
|
|
+ if (error)
|
|
|
|
+ goto error;
|
|
}
|
|
}
|
|
/*
|
|
/*
|
|
* Go on to the next extent, if any.
|
|
* Go on to the next extent, if any.
|
|
@@ -196,8 +200,9 @@ xfs_growfs_rt_alloc(
|
|
oblocks = map.br_startoff + map.br_blockcount;
|
|
oblocks = map.br_startoff + map.br_blockcount;
|
|
}
|
|
}
|
|
return 0;
|
|
return 0;
|
|
-error_exit:
|
|
|
|
|
|
+error_cancel:
|
|
xfs_trans_cancel(tp, cancelflags);
|
|
xfs_trans_cancel(tp, cancelflags);
|
|
|
|
+error:
|
|
return error;
|
|
return error;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1876,6 +1881,7 @@ xfs_growfs_rt(
|
|
xfs_trans_t *tp; /* transaction pointer */
|
|
xfs_trans_t *tp; /* transaction pointer */
|
|
|
|
|
|
sbp = &mp->m_sb;
|
|
sbp = &mp->m_sb;
|
|
|
|
+ cancelflags = 0;
|
|
/*
|
|
/*
|
|
* Initial error checking.
|
|
* Initial error checking.
|
|
*/
|
|
*/
|
|
@@ -2042,13 +2048,15 @@ xfs_growfs_rt(
|
|
*/
|
|
*/
|
|
mp->m_rsumlevels = nrsumlevels;
|
|
mp->m_rsumlevels = nrsumlevels;
|
|
mp->m_rsumsize = nrsumsize;
|
|
mp->m_rsumsize = nrsumsize;
|
|
- /*
|
|
|
|
- * Commit the transaction.
|
|
|
|
- */
|
|
|
|
- xfs_trans_commit(tp, 0);
|
|
|
|
|
|
+
|
|
|
|
+ error = xfs_trans_commit(tp, 0);
|
|
|
|
+ if (error) {
|
|
|
|
+ tp = NULL;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- if (error)
|
|
|
|
|
|
+ if (error && tp)
|
|
xfs_trans_cancel(tp, cancelflags);
|
|
xfs_trans_cancel(tp, cancelflags);
|
|
|
|
|
|
/*
|
|
/*
|