[vfs-idmapping:fs.posix_acl.vfsuid 24/37] fs/posix_acl.c:111:19: warning: no previous prototype for function '__get_acl'

From: kernel test robot
Date: Fri Sep 09 2022 - 16:42:17 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping.git fs.posix_acl.vfsuid
head: d37e11d9b40fc35810217121aa3205b7975fd4c6
commit: 95fef95c76885cb97f319e5a5060964eb9e96126 [24/37] acl: add vfs_get_acl()
config: x86_64-randconfig-a005 (https://download.01.org/0day-ci/archive/20220910/202209100432.pAFEMvWb-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping.git/commit/?id=95fef95c76885cb97f319e5a5060964eb9e96126
git remote add vfs-idmapping https://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping.git
git fetch --no-tags vfs-idmapping fs.posix_acl.vfsuid
git checkout 95fef95c76885cb97f319e5a5060964eb9e96126
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> fs/posix_acl.c:111:19: warning: no previous prototype for function '__get_acl' [-Wmissing-prototypes]
struct posix_acl *__get_acl(struct user_namespace *mnt_userns,
^
fs/posix_acl.c:111:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
struct posix_acl *__get_acl(struct user_namespace *mnt_userns,
^
static
1 warning generated.


vim +/__get_acl +111 fs/posix_acl.c

110
> 111 struct posix_acl *__get_acl(struct user_namespace *mnt_userns,
112 struct dentry *dentry, struct inode *inode,
113 int type)
114 {
115 void *sentinel;
116 struct posix_acl **p;
117 struct posix_acl *acl;
118
119 /*
120 * The sentinel is used to detect when another operation like
121 * set_cached_acl() or forget_cached_acl() races with get_acl().
122 * It is guaranteed that is_uncached_acl(sentinel) is true.
123 */
124
125 acl = get_cached_acl(inode, type);
126 if (!is_uncached_acl(acl))
127 return acl;
128
129 if (!IS_POSIXACL(inode))
130 return NULL;
131
132 sentinel = uncached_acl_sentinel(current);
133 p = acl_by_type(inode, type);
134
135 /*
136 * If the ACL isn't being read yet, set our sentinel. Otherwise, the
137 * current value of the ACL will not be ACL_NOT_CACHED and so our own
138 * sentinel will not be set; another task will update the cache. We
139 * could wait for that other task to complete its job, but it's easier
140 * to just call ->get_acl to fetch the ACL ourself. (This is going to
141 * be an unlikely race.)
142 */
143 cmpxchg(p, ACL_NOT_CACHED, sentinel);
144
145 /*
146 * Normally, the ACL returned by ->get_{dentry_}acl will be cached.
147 * A filesystem can prevent that by calling
148 * forget_cached_acl(inode, type) in ->get_{dentry_}acl.
149 *
150 * If the filesystem doesn't have a get_{dentry_}acl() function at all,
151 * we'll just create the negative cache entry.
152 */
153 if (dentry) {
154 if (!inode->i_op->get_dentry_acl) {
155 set_cached_acl(inode, type, NULL);
156 return NULL;
157 }
158 acl = inode->i_op->get_dentry_acl(mnt_userns, dentry, type);
159 } else {
160 if (!inode->i_op->get_acl) {
161 set_cached_acl(inode, type, NULL);
162 return NULL;
163 }
164 acl = inode->i_op->get_acl(inode, type, false);
165 }
166
167 if (IS_ERR(acl)) {
168 /*
169 * Remove our sentinel so that we don't block future attempts
170 * to cache the ACL.
171 */
172 cmpxchg(p, sentinel, ACL_NOT_CACHED);
173 return acl;
174 }
175
176 /*
177 * Cache the result, but only if our sentinel is still in place.
178 */
179 posix_acl_dup(acl);
180 if (unlikely(cmpxchg(p, sentinel, acl) != sentinel))
181 posix_acl_release(acl);
182 return acl;
183 }
184

--
0-DAY CI Kernel Test Service
https://01.org/lkp