From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CC84C433EF for ; Tue, 29 Mar 2022 13:21:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233740AbiC2NWz (ORCPT ); Tue, 29 Mar 2022 09:22:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232255AbiC2NWz (ORCPT ); Tue, 29 Mar 2022 09:22:55 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59E2F21828 for ; Tue, 29 Mar 2022 06:21:12 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id pv16so35159954ejb.0 for ; Tue, 29 Mar 2022 06:21:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:from:date:message-id:subject:to; bh=FOOhbUKVkgv0Ptct8sGyxTKGaS/9DHZnnYIjEfjIyrc=; b=X5fukXJIS6YyD0Y34yXIXTT6Ozb3IbCJQEvZ9iOqfcetQDPcz+V7TT3I/456UkogN/ Z1weigmY1JWbfp4iWqYiiEhXvnrLSinV5TN1MdcW66XqddXsT1GaE3eClDBRstbrRcPA 8w8Pp4l0vZebG4r0klK1wbLgy3A3jolN3rkZk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=FOOhbUKVkgv0Ptct8sGyxTKGaS/9DHZnnYIjEfjIyrc=; b=aM+aGxYIcCob6fZfu4EIGZasDHkL1ZD6C3nb7J446duIRGeUIrgIqHuqlJmoJ8fy0z P7ybn732LNycx96gV4FdITlUMrN8wic+AI8Jlo6cK8fdz4dRMIhJz/Sbv5KOk1jxWzcs oLfpEO1apxxkWhqYTDLYaTN4f1jZI+ViNQdN0lqvNAP1pPF7q1gec6u3/3M9iuOo4Kh/ MDr62lxBSu8S+57H+b+1iqbWc3Lgmfv52D8LFs/N+V70AfXTuAHE9tfZL1Q3z8a88kcm kOkCNxo3UFEROAu5gEbEBrz5cW4uEUgbDt0Bb75Z6Mfv96wg4OmAQpl7ZXDqCUWo252/ svHQ== X-Gm-Message-State: AOAM5302DMZfZSZVv/ycd+UvbxovV4KB1F8XIXgPzWoJdhg2DDcdDHSP 1oTy1KyeAcKJtzfWoYRHXT5C4EVJetXN430qpmFkFYewEJXBhA== X-Google-Smtp-Source: ABdhPJzeeDeEzSzKAPcJ+VkDbDV1Qk0VvucCbCcHk7uhE7rxAFW7Y85mMjTVdh2bnWYcm7lvF5QjtLgMquMJpJ9VDg8= X-Received: by 2002:a17:907:9605:b0:6d7:24d1:f4ce with SMTP id gb5-20020a170907960500b006d724d1f4cemr34193969ejc.524.1648560070919; Tue, 29 Mar 2022 06:21:10 -0700 (PDT) MIME-Version: 1.0 From: Miklos Szeredi Date: Tue, 29 Mar 2022 15:20:59 +0200 Message-ID: Subject: io_uring_prep_openat_direct() and link/drain To: io-uring@vger.kernel.org Content-Type: multipart/mixed; boundary="0000000000006b3b4a05db5b4d72" Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org --0000000000006b3b4a05db5b4d72 Content-Type: text/plain; charset="UTF-8" Hi, I'm trying to read multiple files with io_uring and getting stuck, because the link and drain flags don't seem to do what they are documented to do. Kernel is v5.17 and liburing is compiled from the git tree at 7a3a27b6a384 ("add tests for nonblocking accept sockets"). Without those flags the attached example works some of the time, but that's probably accidental since ordering is not ensured. Adding the drain or link flags make it even worse (fail in casese that the unordered one didn't). What am I missing? Thanks, Miklos --0000000000006b3b4a05db5b4d72 Content-Type: text/x-csrc; charset="US-ASCII"; name="readfiles.c" Content-Disposition: attachment; filename="readfiles.c" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_l1c5xvt10 I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxmY250bC5oPgojaW5jbHVkZSA8c3RyaW5nLmg+ CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPGVyci5oPgojaW5jbHVkZSAibGlidXJpbmcu aCIKCiNkZWZpbmUgQ0hFQ0tfTkVHRVJSKF9leHByKSBcCgkoeyB0eXBlb2YoX2V4cHIpIF9yZXQg PSAoX2V4cHIpOyBpZiAoX3JldCA8IDApIHsgZXJybm8gPSAtX3JldDsgZXJyKDEsICNfZXhwcik7 IH0gX3JldDsgfSkKI2RlZmluZSBDSEVDS19OVUxMKF9leHByKSBcCgkoeyB0eXBlb2YoX2V4cHIp IF9yZXQgPSAoX2V4cHIpOyBpZiAoX3JldCA9PSBOVUxMKSB7IGVycngoMSwgI19leHByICIgcmV0 dXJuZWQgTlVMTCIpOyB9IF9yZXQ7IH0pCgoKaW50IG1haW4oaW50IGFyZ2MsIGNoYXIgKmFyZ3Zb XSkKewoJc3RydWN0IGlvX3VyaW5nIHJpbmc7CglpbnQgcmV0LCBvLCBpLCBqLCB4LCBudW0sIHNs b3Q7CglzdHJ1Y3QgaW9fdXJpbmdfc3FlICpzcWU7CglzdHJ1Y3QgaW9fdXJpbmdfY3FlICpjcWU7 CgljaGFyICpzLCAqKmJ1ZnM7CglpbnQgKmZkczsKCWNvbnN0IHNpemVfdCBidWZzaXplID0gMTMx MDcyOwoJY29uc3QgaW50IG9wc19wZXJfZmlsZSA9IDI7CgoJaWYgKGFyZ2MgPCAyKQoJCWVycngo MSwgInVzYWdlOiAlcyBmaWxlIFsuLi5dIiwgYXJndlswXSk7CgoJbnVtID0gYXJnYyAtIDE7Cgli dWZzID0gQ0hFQ0tfTlVMTChjYWxsb2MobnV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