[LU-14735] out_tx_xattr_set_exec() ENOSPC handling Created: 04/Jun/21  Updated: 16/Jun/21

Status: Open
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: John Hammond Assignee: WC Triage
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Related
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

In out_tx_xattr_set_exec() if dt_xattr_set() returns -ENOSPC then we assume that it was because the xattr was too big to store:

again:
                rc = dt_xattr_set(env, dt_obj, ldata.ld_buf,
                                  arg->u.xattr_set.name, arg->u.xattr_set.flags,
                                  th);
                if (unlikely(rc == -ENOSPC && linkea)) {
                        rc = linkea_overflow_shrink(&ldata);
                        if (likely(rc > 0)) {
                                arg->u.xattr_set.buf.lb_len = rc;
                                goto again;
                        }
                }

unlock:

But the error may be because we could not create an agent inode in the REMOTE_PARENT_DIR.

diff --git a/lustre/osd-ldiskfs/osd_compat.c b/lustre/osd-ldiskfs/osd_compat.c
index 5cbfa75..43e7531 100644
--- a/lustre/osd-ldiskfs/osd_compat.c
+++ b/lustre/osd-ldiskfs/osd_compat.c
@@ -283,8 +283,12 @@ int osd_add_to_remote_parent(const struct lu_env *env, struct osd_device *osd,
        dentry = osd_child_dentry_by_inode(env, parent->d_inode,
                                           name, strlen(name));
	inode_lock(parent->d_inode);
-       rc = osd_ldiskfs_add_entry(info, osd, oh->ot_handle, dentry,
-                                  obj->oo_inode, NULL);
+
+       if (OBD_FAIL_CHECK(0x8000))
+               rc = -ENOSPC;
+       else
+               rc = osd_ldiskfs_add_entry(info, osd, oh->ot_handle, dentry,
+                                          obj->oo_inode, NULL);
        if (!rc && S_ISDIR(obj->oo_inode->i_mode))
		ldiskfs_inc_count(oh->ot_handle, parent->d_inode);
	else if (unlikely(rc == -EEXIST))


# lctl set_param fail_loc=0x80008000
fail_loc=0x80008000
# lfs mkdir -i 0 -c -1 /mnt/lustre/d0
# lfs getdirstripe /mnt/lustre/d0
lmv_stripe_count: 4 lmv_stripe_offset: 0 lmv_hash_type: fnv_1a_64
mdtidx           FID[seq:oid:ver]
     0           [0x200000400:0x2:0x0]
     1           [0x240000403:0x2:0x0]
     2           [0x280000403:0x2:0x0]
     3           [0x2c0000403:0x2:0x0]
# sync
# dmesg
[73071.843829] Lustre: *** cfs_fail_loc=8000, val=0***
[73071.844549] LustreError: 6850:0:(osd_handler.c:4647:osd_xattr_handle_linkea()) lustre-MDT0001: failed to create agent entry for [0x240000403:0x2:0x0]: rc = -28

# debugfs -R 'ls REMOTE_PARENT_DIR' /dev/mapper/mds1_flakey
 25001  (12) .    2  (4084) ..
# debugfs -R 'ls REMOTE_PARENT_DIR' /dev/mapper/mds2_flakey
 25001  (12) .    2  (4084) ..
# debugfs -R 'ls REMOTE_PARENT_DIR' /dev/mapper/mds3_flakey
 25001  (12) .    2  (12) ..    25046  (4072) 0x280000403:0x2:0x0
# debugfs -R 'ls REMOTE_PARENT_DIR' /dev/mapper/mds4_flakey
 25001  (12) .    2  (12) ..    25046  (4072) 0x2c0000403:0x2:0x0

In this case the error is not propagated.


Generated at Sat Feb 10 03:12:19 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.