Skip to content

ocfs2: fix metadata reservation for xattr value trees

Joseph Qi lkml ocfs2-devel 1 version Applied

Status from this message: [merged mm-nonmm-stable] ocfs2-reserve-xattr-value-tree-metadata-only-once.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 0 repliesApplied 3/3

Patches in v1 All 3 applied

#Subject and filesSizeRepliesApplied
1/3ocfs2: reserve metadata for a new xattr block and its value treefs/ocfs2/xattr.c+7 -10 repliesApplied
2/3ocfs2: reserve value tree metadata when moving an xattr into the inodefs/ocfs2/xattr.c+8 -00 repliesApplied
3/3ocfs2: reserve xattr value tree metadata only oncefs/ocfs2/xattr.c+15 -20 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] ocfs2: fix metadata reservation for xattr value trees

ocfs2_calc_xattr_set_need() reserves too little metadata for a new xattr value's extent tree on three paths. The reservation cannot be topped up once the transaction has started, so ocfs2_add_clusters_in_btree() gives up with RESTART_META when the value root fills and nothing is left. ocfs2_xattr_extend_allocation() turns that into -ENOSPC, after ocfs2_xa_cleanup_value_truncate() has dropped the entry and leaked the clusters already handed out; before commit 0cdc7dde00ec ("ocfs2: fix missing metadata reservation for large xattrs") it was a BUG_ON() instead. It takes a fragmented cluster allocator to get there, since the first extent always fits in the root.

Patch 1 fixes the create side of meta_guess: commit 3ed2be719eb9 ("ocfs2:
allow for more than one data extent when creating xattr") replaced the block reserved for the new xattr block with the two the value tree needs instead of adding them together.

Patch 2 fixes the arm that moves an xattr back into the inode, which charges credits for a value tree but no metadata for one.

Patch 3 drops a second copy of the same reservation on the path that falls through to meta_guess. That one is cleanup rather than a fix and is not for stable, and it must not be backported without patch 1: the duplicate it removes is what currently covers the shortfall patch 1 fixes.

Based on linux-next-20261008.

Joseph Qi (3):
ocfs2: reserve metadata for a new xattr block and its value tree
ocfs2: reserve value tree metadata when moving an xattr into the inode
ocfs2: reserve xattr value tree metadata only once

 fs/ocfs2/xattr.c | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)
Signature · 1 line
2.39.3