From patchwork Thu Jul 14 09:54:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102019 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1439803qga; Thu, 14 Jul 2016 02:55:53 -0700 (PDT) X-Received: by 10.98.64.93 with SMTP id n90mr11194351pfa.29.1468490153666; Thu, 14 Jul 2016 02:55:53 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id oo4si2217884pac.59.2016.07.14.02.55.53; Thu, 14 Jul 2016 02:55:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751163AbcGNJzj (ORCPT + 30 others); Thu, 14 Jul 2016 05:55:39 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:52115 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751058AbcGNJzY (ORCPT ); Thu, 14 Jul 2016 05:55:24 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0MYeLS-1brnZh3QsE-00VTzs; Thu, 14 Jul 2016 11:55:15 +0200 From: Arnd Bergmann To: Miklos Szeredi Cc: Arnd Bergmann , Konstantin Khlebnikov , Vivek Goyal , linux-unionfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ovl: fix link error without POSIX ACL Date: Thu, 14 Jul 2016 11:54:58 +0200 Message-Id: <20160714095512.768359-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:JEGWRI5/n5nKX9INYHCYQ+e09f6b2ueXbxe13OXAjreQSUub6mW f6fIQPYH67Ych12mMXS1YpGmH+5sgf6G+FmXOrvpFNxzEVWNWLT7R59W60w86kXvGTZeHI4 eLnE4r8IlzoByPHI3mbG/rZip25Mj0LPiTffIwXH8dGmX93koGFdcgsGtOmVDoSRKrlLqAb 36jhzc3YSyZkbsd2kAeFA== X-UI-Out-Filterresults: notjunk:1; V01:K0:sZD6+MGHIHc=:7BNi9pvV3P34tvxi/6Lp7R 6x2LQAvS+jsp67L6xdoYwbhg7XCJCjRxzLzw3/b/36mhNdFsYoWsoSMI4oGivQdfLW6YAq73c A299lQCOnArWUTaaTUu+sYweHEpIIhWgePR/1vvUEE8Q9tXtdUZ5TTUTKoqv3x+4urSSI5wO8 iVrSyCaHga7NeyhJmXACIOca4Rklp75KasNdw/od2wf1zEnyxWfGj8iFuUKBXyZcaZc+T5PT2 0Bx6drAxiLxNz8k8oqmMZ5Gr0/Xo8M3yuhi1eGncubxOmaaf6WPKuYIDFU8psVjNJ0dfoWHUv qYyun/TTIbEb+ZVtpHNEGTHBODgzTuyb/hVJT+2b9wt2tgJ45byPHnhvO6C1NgfgWgGVgyNYH fFBg6a1SVKhZcRowbzyd3O8vUBe/D8FwNYdm04ItQRZXzIE5Y34uTNN8Hb3C8Lnb1TOG+siDV ZWtAuO43w9u54+HE8a5YeE2weJ2YDr+xfztQrTOsbaeOVYS/M1LxedRWWs6qvTauVhAYTrKjJ 7gJFfXiKG686PNSpGQRN80X03ESoY3a1B4CcvZcLb+5tPf836vcz77h9dAnTdVaYh/m4jdZU5 6r+R6NxCrZXO4i+dSd+vlfdXanLHrBRjdMDSsHbaDk8oFIbXYZ+qI1UlJabaM4JLIrRivx4Pu uQN0XPSGfzIWS04QH7X9KRYjRS0WHeNmgDGyDnSc6jf0i0H2Q64vypRynwISsY76OQQE= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The latest fix for ACL on overlayfs introduced a link error: fs/built-in.o: In function `ovl_posix_acl_xattr_set': file.c:(.text+0x6b320): undefined reference to `posix_acl_from_xattr' posix_acl_from_xattr doesn't have a 'static inline' implementation when CONFIG_FS_POSIX_ACL is disabled, and I could not come up with an obvious way to do it. This instead avoids the link error by defining two sets of ACL operations and letting the compiler drop one of the two at compile time depending on CONFIG_FS_POSIX_ACL. This avoids all references to the ACL code, also leading to smaller code. Signed-off-by: Arnd Bergmann Fixes: f9bc66ad93b8 ("ovl: fix POSIX ACL setting") --- fs/overlayfs/super.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) -- 2.9.0 diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 17f17885a530..9709f32d13d3 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -1056,6 +1056,12 @@ static const struct xattr_handler *ovl_xattr_handlers[] = { NULL }; +static const struct xattr_handler *ovl_xattr_noacl_handlers[] = { + &ovl_own_xattr_handler, + &ovl_other_xattr_handler, + NULL, +}; + static int ovl_fill_super(struct super_block *sb, void *data, int silent) { struct path upperpath = { NULL, NULL }; @@ -1268,7 +1274,10 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) sb->s_magic = OVERLAYFS_SUPER_MAGIC; sb->s_op = &ovl_super_operations; - sb->s_xattr = ovl_xattr_handlers; + if (IS_ENABLED(CONFIG_FS_POSIX_ACL)) + sb->s_xattr = ovl_xattr_handlers; + else + sb->s_xattr = ovl_xattr_noacl_handlers; sb->s_root = root_dentry; sb->s_fs_info = ufs; sb->s_flags |= MS_POSIXACL;