[mcgrof-next:20210813-sysfs-fixes-v8 4/10] fs/kernfs/file.c:262:69: error: macro "kernfs_debug_should_wait" passed 2 arguments, but takes just 1

From: kernel test robot
Date: Fri Aug 13 2021 - 22:56:52 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git 20210813-sysfs-fixes-v8
head: f5b8aadeca76656caad8bccc795bfe7b0730230a
commit: 039380571a670bd61d4192cbabbfcdff60c7f630 [4/10] kernfs: add initial failure injection support
config: nios2-defconfig (attached as .config)
compiler: nios2-linux-gcc (GCC) 11.2.0
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/mcgrof/linux-next.git/commit/?id=039380571a670bd61d4192cbabbfcdff60c7f630
git remote add mcgrof-next https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git
git fetch --no-tags mcgrof-next 20210813-sysfs-fixes-v8
git checkout 039380571a670bd61d4192cbabbfcdff60c7f630
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=nios2 SHELL=/bin/bash

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

All errors (new ones prefixed by >>):

fs/kernfs/file.c: In function 'kernfs_fop_write_iter':
>> fs/kernfs/file.c:262:69: error: macro "kernfs_debug_should_wait" passed 2 arguments, but takes just 1
262 | if (kernfs_debug_should_wait(kernfs_fop_write_iter, at_start))
| ^
In file included from fs/kernfs/file.c:19:
fs/kernfs/kernfs-internal.h:218: note: macro "kernfs_debug_should_wait" defined here
218 | #define kernfs_debug_should_wait(when) (false)
|
>> fs/kernfs/file.c:262:13: error: 'kernfs_debug_should_wait' undeclared (first use in this function); did you mean 'kernfs_debug_wait'?
262 | if (kernfs_debug_should_wait(kernfs_fop_write_iter, at_start))
| ^~~~~~~~~~~~~~~~~~~~~~~~
| kernfs_debug_wait
fs/kernfs/file.c:262:13: note: each undeclared identifier is reported only once for each function it appears in
fs/kernfs/file.c:286:73: error: macro "kernfs_debug_should_wait" passed 2 arguments, but takes just 1
286 | if (kernfs_debug_should_wait(kernfs_fop_write_iter, before_mutex))
| ^
In file included from fs/kernfs/file.c:19:
fs/kernfs/kernfs-internal.h:218: note: macro "kernfs_debug_should_wait" defined here
218 | #define kernfs_debug_should_wait(when) (false)
|
fs/kernfs/file.c:295:72: error: macro "kernfs_debug_should_wait" passed 2 arguments, but takes just 1
295 | if (kernfs_debug_should_wait(kernfs_fop_write_iter, after_mutex))
| ^
In file included from fs/kernfs/file.c:19:
fs/kernfs/kernfs-internal.h:218: note: macro "kernfs_debug_should_wait" defined here
218 | #define kernfs_debug_should_wait(when) (false)
|
fs/kernfs/file.c:304:73: error: macro "kernfs_debug_should_wait" passed 2 arguments, but takes just 1
304 | if (kernfs_debug_should_wait(kernfs_fop_write_iter, after_active))
| ^
In file included from fs/kernfs/file.c:19:
fs/kernfs/kernfs-internal.h:218: note: macro "kernfs_debug_should_wait" defined here
218 | #define kernfs_debug_should_wait(when) (false)
|


vim +/kernfs_debug_should_wait +262 fs/kernfs/file.c

244
245 /*
246 * Copy data in from userland and pass it to the matching kernfs write
247 * operation.
248 *
249 * There is no easy way for us to know if userspace is only doing a partial
250 * write, so we don't support them. We expect the entire buffer to come on
251 * the first write. Hint: if you're writing a value, first read the file,
252 * modify only the the value you're changing, then write entire buffer
253 * back.
254 */
255 static ssize_t kernfs_fop_write_iter(struct kiocb *iocb, struct iov_iter *iter)
256 {
257 struct kernfs_open_file *of = kernfs_of(iocb->ki_filp);
258 ssize_t len = iov_iter_count(iter);
259 const struct kernfs_ops *ops;
260 char *buf;
261
> 262 if (kernfs_debug_should_wait(kernfs_fop_write_iter, at_start))
263 kernfs_debug_wait();
264
265 if (of->atomic_write_len) {
266 if (len > of->atomic_write_len)
267 return -E2BIG;
268 } else {
269 len = min_t(size_t, len, PAGE_SIZE);
270 }
271
272 buf = of->prealloc_buf;
273 if (buf)
274 mutex_lock(&of->prealloc_mutex);
275 else
276 buf = kmalloc(len + 1, GFP_KERNEL);
277 if (!buf)
278 return -ENOMEM;
279
280 if (copy_from_iter(buf, len, iter) != len) {
281 len = -EFAULT;
282 goto out_free;
283 }
284 buf[len] = '\0'; /* guarantee string termination */
285
286 if (kernfs_debug_should_wait(kernfs_fop_write_iter, before_mutex))
287 kernfs_debug_wait();
288
289 /*
290 * @of->mutex nests outside active ref and is used both to ensure that
291 * the ops aren't called concurrently for the same open file.
292 */
293 mutex_lock(&of->mutex);
294
295 if (kernfs_debug_should_wait(kernfs_fop_write_iter, after_mutex))
296 kernfs_debug_wait();
297
298 if (!kernfs_get_active(of->kn)) {
299 mutex_unlock(&of->mutex);
300 len = -ENODEV;
301 goto out_free;
302 }
303
304 if (kernfs_debug_should_wait(kernfs_fop_write_iter, after_active))
305 kernfs_debug_wait();
306
307 ops = kernfs_ops(of->kn);
308 if (ops->write)
309 len = ops->write(of, buf, len, iocb->ki_pos);
310 else
311 len = -EINVAL;
312
313 kernfs_put_active(of->kn);
314 mutex_unlock(&of->mutex);
315
316 if (len > 0)
317 iocb->ki_pos += len;
318
319 out_free:
320 if (buf == of->prealloc_buf)
321 mutex_unlock(&of->prealloc_mutex);
322 else
323 kfree(buf);
324 return len;
325 }
326

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip