Skip to content

Commit b3f4e84

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
xfs: distinguish extra split from real ENOSPC from xfs_attr_node_try_addname
Just like xfs_attr3_leaf_split, xfs_attr_node_try_addname can return -ENOSPC both for an actual failure to allocate a disk block, but also to signal the caller to convert the format of the attr fork. Use magic 1 to ask for the conversion here as well. Note that unlike the similar issue in xfs_attr3_leaf_split, this one was only found by code review. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Carlos Maiolino <[email protected]>
1 parent a5f7334 commit b3f4e84

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

fs/xfs/libxfs/xfs_attr.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ xfs_attr_node_addname(
597597
return error;
598598

599599
error = xfs_attr_node_try_addname(attr);
600-
if (error == -ENOSPC) {
600+
if (error == 1) {
601601
error = xfs_attr3_leaf_to_node(args);
602602
if (error)
603603
return error;
@@ -1386,9 +1386,12 @@ xfs_attr_node_addname_find_attr(
13861386
/*
13871387
* Add a name to a Btree-format attribute list.
13881388
*
1389-
* This will involve walking down the Btree, and may involve splitting
1390-
* leaf nodes and even splitting intermediate nodes up to and including
1391-
* the root node (a special case of an intermediate node).
1389+
* This will involve walking down the Btree, and may involve splitting leaf
1390+
* nodes and even splitting intermediate nodes up to and including the root
1391+
* node (a special case of an intermediate node).
1392+
*
1393+
* If the tree was still in single leaf format and needs to converted to
1394+
* real node format return 1 and let the caller handle that.
13921395
*/
13931396
static int
13941397
xfs_attr_node_try_addname(
@@ -1410,7 +1413,7 @@ xfs_attr_node_try_addname(
14101413
* out-of-line values so it looked like it *might*
14111414
* have been a b-tree. Let the caller deal with this.
14121415
*/
1413-
error = -ENOSPC;
1416+
error = 1;
14141417
goto out;
14151418
}
14161419

0 commit comments

Comments
 (0)