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 X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 CB5E7C35247 for ; Thu, 6 Feb 2020 21:45:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A56C521775 for ; Thu, 6 Feb 2020 21:45:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727526AbgBFVpU (ORCPT ); Thu, 6 Feb 2020 16:45:20 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:33278 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726765AbgBFVpU (ORCPT ); Thu, 6 Feb 2020 16:45:20 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1izoxa-008U4X-9h; Thu, 06 Feb 2020 21:45:18 +0000 Date: Thu, 6 Feb 2020 21:45:18 +0000 From: Al Viro To: Amir Goldstein Cc: linux-fsdevel@vger.kernel.org, Christoph Hellwig , "J . Bruce Fields" Subject: Re: [PATCH] exportfs: fix handling of rename race in reconnect_one() Message-ID: <20200206214518.GB23230@ZenIV.linux.org.uk> References: <20200126220800.32397-1-amir73il@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200126220800.32397-1-amir73il@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Mon, Jan 27, 2020 at 12:08:00AM +0200, Amir Goldstein wrote: > If a disconnected dentry gets looked up and renamed between the > call to exportfs_get_name() and lookup_one_len_unlocked(), and if also > lookup_one_len_unlocked() returns ERR_PTR(-ENOENT), maybe because old > parent was deleted, we return an error, although dentry may be connected. > > Commit 909e22e05353 ("exportfs: fix 'passing zero to ERR_PTR()' > warning") changes this behavior from always returning success, > regardless if dentry was reconnected by somoe other task, to always > returning a failure. > > Change the lookup error handling to match that of exportfs_get_name() > error handling and return success after getting -ENOENT and verifying > that some other task has connected the dentry for us. It's not that simple, unfortunately. For one thing, lookup_one_len_unlocked() will normally return a negative dentry, not ERR_PTR(-ENOENT). For another, it *can* fail for any number of other reasons (-ENOMEM, for example), without anyone having ever looked it up. So I agree that the damn thing needs work, but I don't believe that this is the right fix.