From patchwork Thu Mar 25 16:56:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 408873 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=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham 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 76DACC433EB for ; Thu, 25 Mar 2021 16:57:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 56F9361A26 for ; Thu, 25 Mar 2021 16:57:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229758AbhCYQ4f (ORCPT ); Thu, 25 Mar 2021 12:56:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:35526 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbhCYQ4I (ORCPT ); Thu, 25 Mar 2021 12:56:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D1B0161A1E; Thu, 25 Mar 2021 16:56:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616691368; bh=vtCT04sR/zzYWQUtv9wSIxPGOTKdKlSuKj0we6esZ14=; h=From:To:Cc:Subject:Date:From; b=q2tpnx+frC2R82GB3PbsxtNfzA6RbHtMlIYrjggRVWQRnS9rsajH49t3074s8kTPA Gu3AS1juiMXqUcYOjU6TsKnwbZk3dvPBx+bJoGdMiVmmOElQbqjQJS4Ixo23lw/0+L Up4y06ktaFRn58f/ZgDQU5PJn6Zs1DaWUUKzLrZQUg0mu0iMenH9am0V6XtWFHi8td weCgpNcw6ogCo6hAZ1cRvjyBo17HFyyREekuQLS1tXzoAYlLcb2l5THKipHqzZIU31 2A5qw1ylzMB9+lY3ThToU2tYJWjWMX2qkBUx+ea+dVGVJ+VpspLITtelZU7gSDyyTo XPVKvIGEk33xg== From: Jeff Layton To: ceph-devel@vger.kernel.org Cc: idryomov@gmail.com, Luis Henriques Subject: [PATCH] ceph: only check pool permissions for regular files Date: Thu, 25 Mar 2021 12:56:06 -0400 Message-Id: <20210325165606.41943-1-jlayton@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org There is no need to do a ceph_pool_perm_check() on anything that isn't a regular file, as the MDS is what handles talking to the OSD in those cases. Just return 0 if it's not a regular file. Reported-by: Luis Henriques Signed-off-by: Jeff Layton Reviewed-by: Xiubo Li --- fs/ceph/addr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index d26a88aca014..07cbf21099b8 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -1940,6 +1940,10 @@ int ceph_pool_perm_check(struct inode *inode, int need) s64 pool; int ret, flags; + /* Only need to do this for regular files */ + if (!S_ISREG(inode->i_mode)) + return 0; + if (ci->i_vino.snap != CEPH_NOSNAP) { /* * Pool permission check needs to write to the first object.