From patchwork Mon Jul 12 12:36:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kadashev X-Patchwork-Id: 12370951 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 695ECC07E9C for ; Mon, 12 Jul 2021 12:37:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4EF5D6101E for ; Mon, 12 Jul 2021 12:37:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233563AbhGLMj6 (ORCPT ); Mon, 12 Jul 2021 08:39:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233121AbhGLMj5 (ORCPT ); Mon, 12 Jul 2021 08:39:57 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE2F1C0613DD; Mon, 12 Jul 2021 05:37:08 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id i20so34280809ejw.4; Mon, 12 Jul 2021 05:37:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=c5iYjnhuOSvPsy5T4IiVkvk1EDH0D2rMauXYbVIBFd0=; b=bzd0vTKiN3xegMxG97DnMuDRHnikfGRib4kzVx9tyGhR2RLcomfNY4SEmK218x0Suw 7ujpWhDzcGuqDY7jGev1nkNOyXQ+prKD+CGNUHfHpbPu0QZtZfyfcyc2S62GM957Vc+w EiFSFFRbmYIP0m1GJnjifmGb8tjz/7ZdOzt0FCRfIm3aH6doPcCQTbMJzlDqhmCLVrnn G+uZOe/hr6BBhko9Hb+MLkg/XqJMk1iZPJdUoOu51aBDJJUGiupNR3dJy+J9w90qScsP U50kzd8H2eDP9T3fxrBY76SSYRF4XuuEOHpK2F4GmbCpcE7qv+FtsEiKcVLYkogZTr+a lqrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=c5iYjnhuOSvPsy5T4IiVkvk1EDH0D2rMauXYbVIBFd0=; b=VgbutmgMbKehjyVxBNfvv+mv9989hvTZn/XGPm91knteziLm1sGOlLjHWbMSLU6RUv AJs9WCF1LvdXtn0AleqPrGpz1dTH/vaM63D3IhGZpH9VG+wkay3oXES6HlDeJctMuWaZ icCdRaI6pf2Q9sHsLC108Nhq5PI4oBw58fVqGUfbLR/QHT6IFU3L1Lp7rYbL8gmvLqpH qvY1Z1IfmGrmc1cncyH+RLeZyd1F/7eZ8u5zSKkpzxbWotZgsYHG3CmDvWREinPCsxy7 soAQ7OFSIrAiJ5yB8LoTNdBzO9rqoWrqXoPfb8OmF2zHlpZlgTsiieq0Dd/b8ONz18h3 Okow== X-Gm-Message-State: AOAM532H9SSe3/8XLoSNjMho31ddzvGravPpZEOEgIcQrv23XXIICBLv 2O9NJ3hTxosZDIvcZUotpE8= X-Google-Smtp-Source: ABdhPJxUJt5aqytrAONF2ONicGDl5FRCMHPajn4YlG9oWoqYRKW9YxMqZ/xJTNbaItoX0G5cAq+fKA== X-Received: by 2002:a17:906:d1d1:: with SMTP id bs17mr52232917ejb.492.1626093427479; Mon, 12 Jul 2021 05:37:07 -0700 (PDT) Received: from carbon.v ([108.61.166.58]) by smtp.googlemail.com with ESMTPSA id y7sm6785216edc.86.2021.07.12.05.37.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 05:37:06 -0700 (PDT) From: Dmitry Kadashev To: Jens Axboe , Alexander Viro , Christian Brauner , Linus Torvalds Cc: linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Dmitry Kadashev Subject: [PATCH 0/7] namei: clean up retry logic in various do_* functions Date: Mon, 12 Jul 2021 19:36:42 +0700 Message-Id: <20210712123649.1102392-1-dkadashev@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Suggested by Linus in https://lore.kernel.org/io-uring/CAHk-=wh=cpt_tQCirzFZRPawRpbuFTZ2MxNpXiyUF+eBXF=+sw@mail.gmail.com/ This patchset does all the do_* functions one by one. The idea is to move the main logic to a helper function and handle stale retries / struct filename cleanups outside, which makes the logic easier to follow. There is one minor change in the behavior: filename_lookup() / filename_parentat() / filename_create() do their own retries on ESTALE (regardless of flags), and previously they were exempt from retries in the do_* functions (but they *were* called on retry - it's just the return code wasn't checked for ESTALE). And now the retry is done on the upper level, and so technically it could be called a behavior change. Hopefully it's an edge case where an additional check does not matter. On top of https://lore.kernel.org/io-uring/20210708063447.3556403-1-dkadashev@gmail.com/ Dmitry Kadashev (7): namei: clean up do_rmdir retry logic namei: clean up do_unlinkat retry logic namei: clean up do_mkdirat retry logic namei: clean up do_mknodat retry logic namei: clean up do_symlinkat retry logic namei: clean up do_linkat retry logic namei: clean up do_renameat retry logic fs/namei.c | 283 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 163 insertions(+), 120 deletions(-)