[LU-11536] ofd_create_hdl returns 0 instead of ENOSPC causing ESTALE on MDS Created: 17/Oct/18  Updated: 03/Sep/21  Resolved: 12/Nov/18

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.12.0, Lustre 2.10.7

Type: Bug Priority: Major
Reporter: Sergey Cheremencev Assignee: Sergey Cheremencev
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by LU-11588 ofd_create_hdl() shouldn't overwrite ... Resolved
Related
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

 

During code analysis I found that LU-6401 brakes ENOSPC handling logic in OSP. 

osp_precreate_send() returns -ESTALE when OST can't precreate objects i.e. -ENOSPACE:

        if (osp_fid_diff(fid, &d->opd_pre_used_fid) <= 0) {
                CERROR("%s: precreate fid "DFID" < local used fid "DFID": rc = %d\n", d->opd_obd->obd_name,
                       PFID(fid), PFID(&d->opd_pre_used_fid), -ESTALE);
                GOTO(out_req, rc = -ESTALE);
        }

However it is not correct. In case of -ENOSPC on OST, MDS should get -ENOSPC.
For example osp_precreat_reserve() forces local commit to release space and waits for OBD_TIMEOUT.
I think "LU-6401 uapi: fix up lustre_ostid.h and lustre_fid.h" broke this logic:

@@ -1781,7 +1781,7 @@ static int ofd_create_hdl(struct tgt_session_info *tsi)
                         granted = 0;
                 }
 
-                ostid_set_id(&rep_oa->o_oi, ofd_seq_last_oid(oseq));
+                rc = ostid_set_id(&rep_oa->o_oi, ofd_seq_last_oid(oseq));
         }
         EXIT;

After the patch OST returns 0 in case when osp_precreate_objects() returns -ENOSPC.
 



 Comments   
Comment by Gerrit Updater [ 17/Oct/18 ]

Sergey Cheremencev (c17829@cray.com) uploaded a new patch: https://review.whamcloud.com/33390
Subject: LU-11536 ofd: ofd_create_hdl may return 0 in case of ENOSPC
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 6730d70e44daa6697cec861b7e37571eecb323a6

Comment by Gerrit Updater [ 02/Nov/18 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/33390/
Subject: LU-11536 ofd: ofd_create_hdl may return 0 in case of ENOSPC
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 1f97bb8e7236971aaf3029fe3699db9baf721da1

Comment by Peter Jones [ 12/Nov/18 ]

Landed for 2.12

Comment by Gerrit Updater [ 07/Jan/19 ]

Minh Diep (mdiep@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/33978
Subject: LU-11536 ofd: ofd_create_hdl may return 0 in case of ENOSPC
Project: fs/lustre-release
Branch: b2_10
Current Patch Set: 1
Commit: 2c94faf22b1f0dca526e9e7f489cec01cbffa10c

Comment by Gerrit Updater [ 16/Jan/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/33978/
Subject: LU-11536 ofd: ofd_create_hdl may return 0 in case of ENOSPC
Project: fs/lustre-release
Branch: b2_10
Current Patch Set:
Commit: 496ddb5b99394142bc158b3f8b0149bcb6b6eae0

Generated at Sat Feb 10 02:44:43 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.