From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C19E17C for ; Mon, 24 Apr 2023 13:28:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49008C433D2; Mon, 24 Apr 2023 13:28:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1682342911; bh=BEQTPXr/8cYA5q4VrjqOEP4ZXCIWiRu6WXnBgFt9u2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zQfHweqoOIFYPPqJqyfM7aaiElcWrxzQLHzSrQrxlgGl4j1Ssp01y1VhAaSbFtnFg 7UJPAGRdL5AGF+ZA4GIqP0/uYRQqPvewTQaBC8jCLyNgUopkokwEfB3c3Sq92MBGRF 2BRV8A3dPKocib31qyqFPzxeoS7nFW8wgHKXjyyA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jiachen Zhang , Zhang Tianci , Miklos Szeredi , Yang Bo Subject: [PATCH 6.1 85/98] fuse: always revalidate rename target dentry Date: Mon, 24 Apr 2023 15:17:48 +0200 Message-Id: <20230424131137.186268956@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230424131133.829259077@linuxfoundation.org> References: <20230424131133.829259077@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Jiachen Zhang commit ccc031e26afe60d2a5a3d93dabd9c978210825fb upstream. The previous commit df8629af2934 ("fuse: always revalidate if exclusive create") ensures that the dentries are revalidated on O_EXCL creates. This commit complements it by also performing revalidation for rename target dentries. Otherwise, a rename target file that only exists in kernel dentry cache but not in the filesystem will result in EEXIST if RENAME_NOREPLACE flag is used. Signed-off-by: Jiachen Zhang Signed-off-by: Zhang Tianci Signed-off-by: Miklos Szeredi Signed-off-by: Yang Bo Signed-off-by: Greg Kroah-Hartman --- fs/fuse/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -214,7 +214,7 @@ static int fuse_dentry_revalidate(struct if (inode && fuse_is_bad(inode)) goto invalid; else if (time_before64(fuse_dentry_time(entry), get_jiffies_64()) || - (flags & (LOOKUP_EXCL | LOOKUP_REVAL))) { + (flags & (LOOKUP_EXCL | LOOKUP_REVAL | LOOKUP_RENAME_TARGET))) { struct fuse_entry_out outarg; FUSE_ARGS(args); struct fuse_forget_link *forget;