[LU-6195] osd-zfs: osd_declare_object_destroy() calls dmu_tx_hold_zap() with wrong keys Created: 02/Feb/15  Updated: 10/Oct/21  Resolved: 10/Oct/21

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.7.0
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Isaac Huang (Inactive) Assignee: Isaac Huang (Inactive)
Resolution: Won't Fix Votes: 0
Labels: None

Issue Links:
Related
is related to LU-5242 Test hang sanity test_132, test_133: ... Resolved
is related to LU-6160 all test builds should enable SPL/ZFS... Resolved
Severity: 3
Rank (Obsolete): 17318

 Description   

In osd_declare_object_destroy():

        /* declare that we'll remove object from fid-dnode mapping */
        zapid = osd_get_name_n_idx(env, osd, fid, buf);
        dmu_tx_hold_bonus(oh->ot_tx, zapid);
        dmu_tx_hold_zap(oh->ot_tx, zapid, 0, buf);

        /* declare that we'll remove object from inode accounting ZAPs */
        dmu_tx_hold_bonus(oh->ot_tx, osd->od_iusr_oid);
        dmu_tx_hold_zap(oh->ot_tx, osd->od_iusr_oid, 0, buf);
        dmu_tx_hold_bonus(oh->ot_tx, osd->od_igrp_oid);
        dmu_tx_hold_zap(oh->ot_tx, osd->od_igrp_oid, 0, buf);

The buf holds string representation of the FID, so it's wrong to use it in dmu_tx_hold_zap() calls for osd->od_iusr_oid and osd->od_igrp_oid where the keys should be obj->oo_attr.la_uid and obj->oo_attr.la_gid.

Same mistake in osd_declare_object_create().



 Comments   
Comment by Alex Zhuravlev [ 02/Feb/15 ]

didn't we plan to replace this code with in-zfs accounting?

Comment by Isaac Huang (Inactive) [ 02/Feb/15 ]

Yes, but it's going be a while until we have in-zfs accounting.

Comment by Isaac Huang (Inactive) [ 02/Feb/15 ]

Looks like just replace buf with NULL, and zap_count_write() will use worst-case estimate - should be good enough until we have in-zfs accounting.

Comment by Gerrit Updater [ 05/Feb/15 ]

Isaac Huang (he.huang@intel.com) uploaded a new patch: http://review.whamcloud.com/13656
Subject: LU-6195 osd-zfs: dmu_tx_hold_zap() called with wrong keys
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: fd8fb80c6f71fedc476e82008fd309f9f4f8b418

Generated at Sat Feb 10 01:58:05 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.