tree: https://github.com/allisonhenderson/xfs_work.git delayed_attrs_v24_extended head: 65b46be2f965591671441cfd63f02f38befbec24 commit: b42dadea58e38ae95cfb71e9b760da30c0c088d3 [5/27] RFC xfs: Skip flip flags for delayed attrs config: alpha-buildonly-randconfig-r004-20210824 (attached as .config) compiler: alpha-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://github.com/allisonhenderson/xfs_work/commit/b42dadea58e38ae95cfb71e9b760da30c0c088d3 git remote add allisonhenderson-xfs_work https://github.com/allisonhenderson/xfs_work.git git fetch --no-tags allisonhenderson-xfs_work delayed_attrs_v24_extended git checkout b42dadea58e38ae95cfb71e9b760da30c0c088d3 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=alpha If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): fs/xfs/libxfs/xfs_attr.c: In function 'xfs_attr_set_iter': >> fs/xfs/libxfs/xfs_attr.c:481:20: warning: this statement may fall through [-Wimplicit-fallthrough=] 481 | if (!xfs_has_larp(mp)) { | ^ fs/xfs/libxfs/xfs_attr.c:496:9: note: here 496 | case XFS_DAS_FLIP_LFLAG: | ^~~~ fs/xfs/libxfs/xfs_attr.c:598:20: warning: this statement may fall through [-Wimplicit-fallthrough=] 598 | if (!xfs_has_larp(mp)) { | ^ fs/xfs/libxfs/xfs_attr.c:613:9: note: here 613 | case XFS_DAS_FLIP_NFLAG: | ^~~~ vim +481 fs/xfs/libxfs/xfs_attr.c 341 342 /* 343 * Set the attribute specified in @args. 344 * This routine is meant to function as a delayed operation, and may return 345 * -EAGAIN when the transaction needs to be rolled. Calling functions will need 346 * to handle this, and recall the function until a successful error code is 347 * returned. 348 */ 349 int 350 xfs_attr_set_iter( 351 struct xfs_delattr_context *dac, 352 struct xfs_buf **leaf_bp) 353 { 354 struct xfs_da_args *args = dac->da_args; 355 struct xfs_inode *dp = args->dp; 356 struct xfs_buf *bp = NULL; 357 int forkoff, error = 0; 358 struct xfs_mount *mp = args->dp->i_mount; 359 360 /* State machine switch */ 361 switch (dac->dela_state) { 362 case XFS_DAS_UNINIT: 363 /* 364 * If the fork is shortform, attempt to add the attr. If there 365 * is no space, this converts to leaf format and returns 366 * -EAGAIN with the leaf buffer held across the roll. The caller 367 * will deal with a transaction roll error, but otherwise 368 * release the hold once we return with a clean transaction. 369 */ 370 if (xfs_attr_is_shortform(dp)) 371 return xfs_attr_sf_addname(dac, leaf_bp); 372 if (*leaf_bp != NULL) { 373 xfs_trans_bhold_release(args->trans, *leaf_bp); 374 *leaf_bp = NULL; 375 } 376 377 if (xfs_attr_is_leaf(dp)) { 378 error = xfs_attr_leaf_try_add(args, *leaf_bp); 379 if (error == -ENOSPC) { 380 error = xfs_attr3_leaf_to_node(args); 381 if (error) 382 return error; 383 384 /* 385 * Finish any deferred work items and roll the 386 * transaction once more. The goal here is to 387 * call node_addname with the inode and 388 * transaction in the same state (inode locked 389 * and joined, transaction clean) no matter how 390 * we got to this step. 391 * 392 * At this point, we are still in 393 * XFS_DAS_UNINIT, but when we come back, we'll 394 * be a node, so we'll fall down into the node 395 * handling code below 396 */ 397 dac->flags |= XFS_DAC_DEFER_FINISH; 398 trace_xfs_attr_set_iter_return( 399 dac->dela_state, args->dp); 400 return -EAGAIN; 401 } else if (error) { 402 return error; 403 } 404 405 dac->dela_state = XFS_DAS_FOUND_LBLK; 406 } else { 407 error = xfs_attr_node_addname_find_attr(dac); 408 if (error) 409 return error; 410 411 error = xfs_attr_node_addname(dac); 412 if (error) 413 return error; 414 415 /* 416 * If addname was successful, and we dont need to alloc 417 * or remove anymore blks, we're done. 418 */ 419 if (!args->rmtblkno && 420 !(args->op_flags & XFS_DA_OP_RENAME)) 421 return 0; 422 423 dac->dela_state = XFS_DAS_FOUND_NBLK; 424 } 425 trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); 426 return -EAGAIN; 427 case XFS_DAS_FOUND_LBLK: 428 /* 429 * If there was an out-of-line value, allocate the blocks we 430 * identified for its storage and copy the value. This is done 431 * after we create the attribute so that we don't overflow the 432 * maximum size of a transaction and/or hit a deadlock. 433 */ 434 435 /* Open coded xfs_attr_rmtval_set without trans handling */ 436 if ((dac->flags & XFS_DAC_LEAF_ADDNAME_INIT) == 0) { 437 dac->flags |= XFS_DAC_LEAF_ADDNAME_INIT; 438 if (args->rmtblkno > 0) { 439 error = xfs_attr_rmtval_find_space(dac); 440 if (error) 441 return error; 442 } 443 } 444 445 /* 446 * Repeat allocating remote blocks for the attr value until 447 * blkcnt drops to zero. 448 */ 449 if (dac->blkcnt > 0) { 450 error = xfs_attr_rmtval_set_blk(dac); 451 if (error) 452 return error; 453 trace_xfs_attr_set_iter_return(dac->dela_state, 454 args->dp); 455 return -EAGAIN; 456 } 457 458 error = xfs_attr_rmtval_set_value(args); 459 if (error) 460 return error; 461 462 /* 463 * If this is not a rename, clear the incomplete flag and we're 464 * done. 465 */ 466 if (!(args->op_flags & XFS_DA_OP_RENAME)) { 467 if (args->rmtblkno > 0) 468 error = xfs_attr3_leaf_clearflag(args); 469 return error; 470 } 471 472 /* 473 * If this is an atomic rename operation, we must "flip" the 474 * incomplete flags on the "new" and "old" attribute/value pairs 475 * so that one disappears and one appears atomically. Then we 476 * must remove the "old" attribute/value pair. 477 * 478 * In a separate transaction, set the incomplete flag on the 479 * "old" attr and clear the incomplete flag on the "new" attr. 480 */ > 481 if (!xfs_has_larp(mp)) { 482 error = xfs_attr3_leaf_flipflags(args); 483 if (error) 484 return error; 485 /* 486 * Commit the flag value change and start the next trans 487 * in series. 488 */ 489 dac->dela_state = XFS_DAS_FLIP_LFLAG; 490 trace_xfs_attr_set_iter_return(dac->dela_state, 491 args->dp); 492 return -EAGAIN; 493 } 494 495 /* fallthrough */ 496 case XFS_DAS_FLIP_LFLAG: 497 /* 498 * Dismantle the "old" attribute/value pair by removing a 499 * "remote" value (if it exists). 500 */ 501 xfs_attr_restore_rmt_blk(args); 502 error = xfs_attr_rmtval_invalidate(args); 503 if (error) 504 return error; 505 506 fallthrough; 507 case XFS_DAS_RM_LBLK: 508 /* Set state in case xfs_attr_rmtval_remove returns -EAGAIN */ 509 dac->dela_state = XFS_DAS_RM_LBLK; 510 if (args->rmtblkno) { 511 error = xfs_attr_rmtval_remove(dac); 512 if (error == -EAGAIN) 513 trace_xfs_attr_set_iter_return( 514 dac->dela_state, args->dp); 515 if (error) 516 return error; 517 518 dac->dela_state = XFS_DAS_RD_LEAF; 519 trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); 520 return -EAGAIN; 521 } 522 523 fallthrough; 524 case XFS_DAS_RD_LEAF: 525 /* 526 * This is the last step for leaf format. Read the block with 527 * the old attr, remove the old attr, check for shortform 528 * conversion and return. 529 */ 530 error = xfs_attr3_leaf_read(args->trans, args->dp, args->blkno, 531 &bp); 532 if (error) 533 return error; 534 535 xfs_attr3_leaf_remove(bp, args); 536 537 forkoff = xfs_attr_shortform_allfit(bp, dp); 538 if (forkoff) 539 error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); 540 /* bp is gone due to xfs_da_shrink_inode */ 541 542 return error; 543 544 case XFS_DAS_FOUND_NBLK: 545 /* 546 * Find space for remote blocks and fall into the allocation 547 * state. 548 */ 549 if (args->rmtblkno > 0) { 550 error = xfs_attr_rmtval_find_space(dac); 551 if (error) 552 return error; 553 } 554 555 fallthrough; 556 case XFS_DAS_ALLOC_NODE: 557 /* 558 * If there was an out-of-line value, allocate the blocks we 559 * identified for its storage and copy the value. This is done 560 * after we create the attribute so that we don't overflow the 561 * maximum size of a transaction and/or hit a deadlock. 562 */ 563 dac->dela_state = XFS_DAS_ALLOC_NODE; 564 if (args->rmtblkno > 0) { 565 if (dac->blkcnt > 0) { 566 error = xfs_attr_rmtval_set_blk(dac); 567 if (error) 568 return error; 569 trace_xfs_attr_set_iter_return( 570 dac->dela_state, args->dp); 571 return -EAGAIN; 572 } 573 574 error = xfs_attr_rmtval_set_value(args); 575 if (error) 576 return error; 577 } 578 579 /* 580 * If this was not a rename, clear the incomplete flag and we're 581 * done. 582 */ 583 if (!(args->op_flags & XFS_DA_OP_RENAME)) { 584 if (args->rmtblkno > 0) 585 error = xfs_attr3_leaf_clearflag(args); 586 goto out; 587 } 588 589 /* 590 * If this is an atomic rename operation, we must "flip" the 591 * incomplete flags on the "new" and "old" attribute/value pairs 592 * so that one disappears and one appears atomically. Then we 593 * must remove the "old" attribute/value pair. 594 * 595 * In a separate transaction, set the incomplete flag on the 596 * "old" attr and clear the incomplete flag on the "new" attr. 597 */ 598 if (!xfs_has_larp(mp)) { 599 error = xfs_attr3_leaf_flipflags(args); 600 if (error) 601 goto out; 602 /* 603 * Commit the flag value change and start the next trans 604 * in series 605 */ 606 dac->dela_state = XFS_DAS_FLIP_NFLAG; 607 trace_xfs_attr_set_iter_return(dac->dela_state, 608 args->dp); 609 return -EAGAIN; 610 } 611 612 /* fallthrough */ 613 case XFS_DAS_FLIP_NFLAG: 614 /* 615 * Dismantle the "old" attribute/value pair by removing a 616 * "remote" value (if it exists). 617 */ 618 xfs_attr_restore_rmt_blk(args); 619 620 error = xfs_attr_rmtval_invalidate(args); 621 if (error) 622 return error; 623 624 fallthrough; 625 case XFS_DAS_RM_NBLK: 626 /* Set state in case xfs_attr_rmtval_remove returns -EAGAIN */ 627 dac->dela_state = XFS_DAS_RM_NBLK; 628 if (args->rmtblkno) { 629 error = xfs_attr_rmtval_remove(dac); 630 if (error == -EAGAIN) 631 trace_xfs_attr_set_iter_return( 632 dac->dela_state, args->dp); 633 634 if (error) 635 return error; 636 637 dac->dela_state = XFS_DAS_CLR_FLAG; 638 trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); 639 return -EAGAIN; 640 } 641 642 fallthrough; 643 case XFS_DAS_CLR_FLAG: 644 /* 645 * The last state for node format. Look up the old attr and 646 * remove it. 647 */ 648 error = xfs_attr_node_addname_clear_incomplete(dac); 649 break; 650 default: 651 ASSERT(0); 652 break; 653 } 654 out: 655 return error; 656 } 657 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org