Skip to content

Commit 9ec3f79

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
xfs: don't increment m_generation for all errors in xfs_growfs_data
xfs_growfs_data needs to increment m_generation as soon as the primary superblock has been updated. As the update of the secondary superblocks was part of xfs_growfs_data_private that mean the incremented had to be done unconditionally once that was called. Later, commit 83a7f86 ("xfs: separate secondary sb update in growfs") split the secondary superblock update into a separate helper, so now the increment on error can be limited to failed calls to xfs_update_secondary_sbs. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Carlos Maiolino <[email protected]> Signed-off-by: Carlos Maiolino <[email protected]>
1 parent beba948 commit 9ec3f79

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

fs/xfs/xfs_fsops.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -311,20 +311,20 @@ xfs_growfs_data(
311311
/* we can't grow the data section when an internal RT section exists */
312312
if (in->newblocks != mp->m_sb.sb_dblocks && mp->m_sb.sb_rtstart) {
313313
error = -EINVAL;
314-
goto out_error;
314+
goto out_unlock;
315315
}
316316

317317
/* update imaxpct separately to the physical grow of the filesystem */
318318
if (in->imaxpct != mp->m_sb.sb_imax_pct) {
319319
error = xfs_growfs_imaxpct(mp, in->imaxpct);
320320
if (error)
321-
goto out_error;
321+
goto out_unlock;
322322
}
323323

324324
if (in->newblocks != mp->m_sb.sb_dblocks) {
325325
error = xfs_growfs_data_private(mp, in);
326326
if (error)
327-
goto out_error;
327+
goto out_unlock;
328328
}
329329

330330
/* Post growfs calculations needed to reflect new state in operations */
@@ -338,13 +338,12 @@ xfs_growfs_data(
338338
/* Update secondary superblocks now the physical grow has completed */
339339
error = xfs_update_secondary_sbs(mp);
340340

341-
out_error:
342341
/*
343-
* Increment the generation unconditionally, the error could be from
344-
* updating the secondary superblocks, in which case the new size
345-
* is live already.
342+
* Increment the generation unconditionally, after trying to update the
343+
* secondary superblocks, as the new size is live already at this point.
346344
*/
347345
mp->m_generation++;
346+
out_unlock:
348347
mutex_unlock(&mp->m_growlock);
349348
return error;
350349
}

0 commit comments

Comments
 (0)