[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202208182207.vey2v2am-lkp@intel.com>
Date: Thu, 18 Aug 2022 22:28:45 +0800
From: kernel test robot <lkp@...el.com>
To: Jeff Layton <jlayton@...nel.org>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [jlayton:iversion 6/7] fs/ext4/inode.c:5345:26: error: implicit
declaration of function 'IS_IVERSION'; did you mean 'IS_I_VERSION'?
tree: https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git iversion
head: 1a5c05a616d21465e6b43a7cd9e206d47e589659
commit: b4bea270a457a57b53ad5805645f5735e34de902 [6/7] ext4: fix i_version handling in ext4
config: um-i386_defconfig
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git/commit/?id=b4bea270a457a57b53ad5805645f5735e34de902
git remote add jlayton https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git
git fetch --no-tags jlayton iversion
git checkout b4bea270a457a57b53ad5805645f5735e34de902
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=um SUBARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>
Note: the jlayton/iversion HEAD 1a5c05a616d21465e6b43a7cd9e206d47e589659 builds fine.
It only hurts bisectability.
All errors (new ones prefixed by >>):
fs/ext4/inode.c: In function 'ext4_setattr':
>> fs/ext4/inode.c:5345:26: error: implicit declaration of function 'IS_IVERSION'; did you mean 'IS_I_VERSION'? [-Werror=implicit-function-declaration]
5345 | bool inc_ivers = IS_IVERSION(inode);
| ^~~~~~~~~~~
| IS_I_VERSION
cc1: some warnings being treated as errors
--
fs/ext4/xattr.c: In function 'ext4_xattr_set_handle':
>> fs/ext4/xattr.c:2415:21: error: implicit declaration of function 'IS_IVERSION'; did you mean 'IS_I_VERSION'? [-Werror=implicit-function-declaration]
2415 | if (IS_IVERSION(inode))
| ^~~~~~~~~~~
| IS_I_VERSION
cc1: some warnings being treated as errors
vim +5345 fs/ext4/inode.c
5313
5314 /*
5315 * ext4_setattr()
5316 *
5317 * Called from notify_change.
5318 *
5319 * We want to trap VFS attempts to truncate the file as soon as
5320 * possible. In particular, we want to make sure that when the VFS
5321 * shrinks i_size, we put the inode on the orphan list and modify
5322 * i_disksize immediately, so that during the subsequent flushing of
5323 * dirty pages and freeing of disk blocks, we can guarantee that any
5324 * commit will leave the blocks being flushed in an unused state on
5325 * disk. (On recovery, the inode will get truncated and the blocks will
5326 * be freed, so we have a strong guarantee that no future commit will
5327 * leave these blocks visible to the user.)
5328 *
5329 * Another thing we have to assure is that if we are in ordered mode
5330 * and inode is still attached to the committing transaction, we must
5331 * we start writeout of all the dirty pages which are being truncated.
5332 * This way we are sure that all the data written in the previous
5333 * transaction are already on disk (truncate waits for pages under
5334 * writeback).
5335 *
5336 * Called with inode->i_rwsem down.
5337 */
5338 int ext4_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
5339 struct iattr *attr)
5340 {
5341 struct inode *inode = d_inode(dentry);
5342 int error, rc = 0;
5343 int orphan = 0;
5344 const unsigned int ia_valid = attr->ia_valid;
> 5345 bool inc_ivers = IS_IVERSION(inode);
5346
5347 if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
5348 return -EIO;
5349
5350 if (unlikely(IS_IMMUTABLE(inode)))
5351 return -EPERM;
5352
5353 if (unlikely(IS_APPEND(inode) &&
5354 (ia_valid & (ATTR_MODE | ATTR_UID |
5355 ATTR_GID | ATTR_TIMES_SET))))
5356 return -EPERM;
5357
5358 error = setattr_prepare(mnt_userns, dentry, attr);
5359 if (error)
5360 return error;
5361
5362 error = fscrypt_prepare_setattr(dentry, attr);
5363 if (error)
5364 return error;
5365
5366 error = fsverity_prepare_setattr(dentry, attr);
5367 if (error)
5368 return error;
5369
5370 if (is_quota_modification(mnt_userns, inode, attr)) {
5371 error = dquot_initialize(inode);
5372 if (error)
5373 return error;
5374 }
5375
5376 if (i_uid_needs_update(mnt_userns, attr, inode) ||
5377 i_gid_needs_update(mnt_userns, attr, inode)) {
5378 handle_t *handle;
5379
5380 /* (user+group)*(old+new) structure, inode write (sb,
5381 * inode block, ? - but truncate inode update has it) */
5382 handle = ext4_journal_start(inode, EXT4_HT_QUOTA,
5383 (EXT4_MAXQUOTAS_INIT_BLOCKS(inode->i_sb) +
5384 EXT4_MAXQUOTAS_DEL_BLOCKS(inode->i_sb)) + 3);
5385 if (IS_ERR(handle)) {
5386 error = PTR_ERR(handle);
5387 goto err_out;
5388 }
5389
5390 /* dquot_transfer() calls back ext4_get_inode_usage() which
5391 * counts xattr inode references.
5392 */
5393 down_read(&EXT4_I(inode)->xattr_sem);
5394 error = dquot_transfer(mnt_userns, inode, attr);
5395 up_read(&EXT4_I(inode)->xattr_sem);
5396
5397 if (error) {
5398 ext4_journal_stop(handle);
5399 return error;
5400 }
5401 /* Update corresponding info in inode so that everything is in
5402 * one transaction */
5403 i_uid_update(mnt_userns, attr, inode);
5404 i_gid_update(mnt_userns, attr, inode);
5405 error = ext4_mark_inode_dirty(handle, inode);
5406 ext4_journal_stop(handle);
5407 if (unlikely(error)) {
5408 return error;
5409 }
5410 }
5411
5412 if (attr->ia_valid & ATTR_SIZE) {
5413 handle_t *handle;
5414 loff_t oldsize = inode->i_size;
5415 loff_t old_disksize;
5416 int shrink = (attr->ia_size < inode->i_size);
5417
5418 if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) {
5419 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
5420
5421 if (attr->ia_size > sbi->s_bitmap_maxbytes) {
5422 return -EFBIG;
5423 }
5424 }
5425 if (!S_ISREG(inode->i_mode)) {
5426 return -EINVAL;
5427 }
5428
5429 if (attr->ia_size == inode->i_size)
5430 inc_ivers = false;
5431
5432 if (shrink) {
5433 if (ext4_should_order_data(inode)) {
5434 error = ext4_begin_ordered_truncate(inode,
5435 attr->ia_size);
5436 if (error)
5437 goto err_out;
5438 }
5439 /*
5440 * Blocks are going to be removed from the inode. Wait
5441 * for dio in flight.
5442 */
5443 inode_dio_wait(inode);
5444 }
5445
5446 filemap_invalidate_lock(inode->i_mapping);
5447
5448 rc = ext4_break_layouts(inode);
5449 if (rc) {
5450 filemap_invalidate_unlock(inode->i_mapping);
5451 goto err_out;
5452 }
5453
5454 if (attr->ia_size != inode->i_size) {
5455 handle = ext4_journal_start(inode, EXT4_HT_INODE, 3);
5456 if (IS_ERR(handle)) {
5457 error = PTR_ERR(handle);
5458 goto out_mmap_sem;
5459 }
5460 if (ext4_handle_valid(handle) && shrink) {
5461 error = ext4_orphan_add(handle, inode);
5462 orphan = 1;
5463 }
5464 /*
5465 * Update c/mtime on truncate up, ext4_truncate() will
5466 * update c/mtime in shrink case below
5467 */
5468 if (!shrink) {
5469 inode->i_mtime = current_time(inode);
5470 inode->i_ctime = inode->i_mtime;
5471 }
5472
5473 if (shrink)
5474 ext4_fc_track_range(handle, inode,
5475 (attr->ia_size > 0 ? attr->ia_size - 1 : 0) >>
5476 inode->i_sb->s_blocksize_bits,
5477 EXT_MAX_BLOCKS - 1);
5478 else
5479 ext4_fc_track_range(
5480 handle, inode,
5481 (oldsize > 0 ? oldsize - 1 : oldsize) >>
5482 inode->i_sb->s_blocksize_bits,
5483 (attr->ia_size > 0 ? attr->ia_size - 1 : 0) >>
5484 inode->i_sb->s_blocksize_bits);
5485
5486 down_write(&EXT4_I(inode)->i_data_sem);
5487 old_disksize = EXT4_I(inode)->i_disksize;
5488 EXT4_I(inode)->i_disksize = attr->ia_size;
5489 rc = ext4_mark_inode_dirty(handle, inode);
5490 if (!error)
5491 error = rc;
5492 /*
5493 * We have to update i_size under i_data_sem together
5494 * with i_disksize to avoid races with writeback code
5495 * running ext4_wb_update_i_disksize().
5496 */
5497 if (!error)
5498 i_size_write(inode, attr->ia_size);
5499 else
5500 EXT4_I(inode)->i_disksize = old_disksize;
5501 up_write(&EXT4_I(inode)->i_data_sem);
5502 ext4_journal_stop(handle);
5503 if (error)
5504 goto out_mmap_sem;
5505 if (!shrink) {
5506 pagecache_isize_extended(inode, oldsize,
5507 inode->i_size);
5508 } else if (ext4_should_journal_data(inode)) {
5509 ext4_wait_for_tail_page_commit(inode);
5510 }
5511 }
5512
5513 /*
5514 * Truncate pagecache after we've waited for commit
5515 * in data=journal mode to make pages freeable.
5516 */
5517 truncate_pagecache(inode, inode->i_size);
5518 /*
5519 * Call ext4_truncate() even if i_size didn't change to
5520 * truncate possible preallocated blocks.
5521 */
5522 if (attr->ia_size <= oldsize) {
5523 rc = ext4_truncate(inode);
5524 if (rc)
5525 error = rc;
5526 }
5527 out_mmap_sem:
5528 filemap_invalidate_unlock(inode->i_mapping);
5529 }
5530
5531 if (!error) {
5532 if (inc_ivers)
5533 inode_inc_iversion(inode);
5534 setattr_copy(mnt_userns, inode, attr);
5535 mark_inode_dirty(inode);
5536 }
5537
5538 /*
5539 * If the call to ext4_truncate failed to get a transaction handle at
5540 * all, we need to clean up the in-core orphan list manually.
5541 */
5542 if (orphan && inode->i_nlink)
5543 ext4_orphan_del(NULL, inode);
5544
5545 if (!error && (ia_valid & ATTR_MODE))
5546 rc = posix_acl_chmod(mnt_userns, inode, inode->i_mode);
5547
5548 err_out:
5549 if (error)
5550 ext4_std_error(inode->i_sb, error);
5551 if (!error)
5552 error = rc;
5553 return error;
5554 }
5555
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (41289 bytes)
Powered by blists - more mailing lists