Content-Type: multipart/mixed; boundary="===============6113681865740994151==" MIME-Version: 1.0 From: Darrick J. Wong To: kbuild-all@lists.01.org Subject: Re: [linux-next:master 6373/10489] fs/xfs/xfs_log_cil.c:897:1-10: second lock on line 900 (fwd) Date: Thu, 17 Jun 2021 11:50:44 -0700 Message-ID: <20210617185044.GD158186@locust> In-Reply-To: List-Id: --===============6113681865740994151== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Thu, Jun 17, 2021 at 08:28:24PM +0200, Julia Lawall wrote: > Please check line 900. > = > julia > = > ---------- Forwarded message ---------- > Date: Thu, 17 Jun 2021 20:02:22 +0800 > From: kernel test robot > To: kbuild(a)lists.01.org > Cc: lkp(a)intel.com, Julia Lawall > Subject: [linux-next:master 6373/10489] fs/xfs/xfs_log_cil.c:897:1-10: se= cond > lock on line 900 > = > CC: kbuild-all(a)lists.01.org > CC: Linux Memory Management List > TO: Dave Chinner > CC: Chandan Babu R > CC: "Darrick J. Wong" > CC: Allison Henderson > = > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.g= it master > head: c7d4c1fd91ab4a6d2620497921a9c6bf54650ab8 > commit: cb1acb3f324636856cb65bd4857c981a15b7f4d4 [6373/10489] xfs: journa= l IO cache flush reductions > :::::: branch date: 23 hours ago > :::::: commit date: 13 days ago > config: nds32-randconfig-c003-20210617 (attached as .config) > compiler: nds32le-linux-gcc (GCC) 9.3.0 > = > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot > Reported-by: Julia Lawall > = > = > cocci warnings: (new ones prefixed by >>) > >> fs/xfs/xfs_log_cil.c:897:1-10: second lock on line 900 > = > vim +897 fs/xfs/xfs_log_cil.c > = > 89ae379d564c5d Christoph Hellwig 2019-06-28 625 > 71e330b593905e Dave Chinner 2010-05-21 626 /* > c7cc296ddd1f6d Christoph Hellwig 2020-03-20 627 * Push the Committed I= tem List to the log. > c7cc296ddd1f6d Christoph Hellwig 2020-03-20 628 * > c7cc296ddd1f6d Christoph Hellwig 2020-03-20 629 * If the current seque= nce is the same as xc_push_seq we need to do a flush. If > c7cc296ddd1f6d Christoph Hellwig 2020-03-20 630 * xc_push_seq is less = than the current sequence, then it has already been > a44f13edf0ebb4 Dave Chinner 2010-08-24 631 * flushed and we don't= need to do anything - the caller will wait for it to > a44f13edf0ebb4 Dave Chinner 2010-08-24 632 * complete if necessar= y. > a44f13edf0ebb4 Dave Chinner 2010-08-24 633 * > c7cc296ddd1f6d Christoph Hellwig 2020-03-20 634 * xc_push_seq is check= ed unlocked against the sequence number for a match. > c7cc296ddd1f6d Christoph Hellwig 2020-03-20 635 * Hence we can allow l= og forces to run racily and not issue pushes for the > c7cc296ddd1f6d Christoph Hellwig 2020-03-20 636 * same sequence twice.= If we get a race between multiple pushes for the same > c7cc296ddd1f6d Christoph Hellwig 2020-03-20 637 * sequence they will b= lock on the first one and then abort, hence avoiding > c7cc296ddd1f6d Christoph Hellwig 2020-03-20 638 * needless pushes. > c7cc296ddd1f6d Christoph Hellwig 2020-03-20 639 */ > c7cc296ddd1f6d Christoph Hellwig 2020-03-20 640 static void > c7cc296ddd1f6d Christoph Hellwig 2020-03-20 641 xlog_cil_push_work( > c7cc296ddd1f6d Christoph Hellwig 2020-03-20 642 struct work_struct *wo= rk) > 71e330b593905e Dave Chinner 2010-05-21 643 { > c7cc296ddd1f6d Christoph Hellwig 2020-03-20 644 struct xfs_cil *cil = =3D > c7cc296ddd1f6d Christoph Hellwig 2020-03-20 645 container_of(work, st= ruct xfs_cil, xc_push_work); > c7cc296ddd1f6d Christoph Hellwig 2020-03-20 646 struct xlog *log =3D = cil->xc_log; > 71e330b593905e Dave Chinner 2010-05-21 647 struct xfs_log_vec *lv; > 71e330b593905e Dave Chinner 2010-05-21 648 struct xfs_cil_ctx *ct= x; > 71e330b593905e Dave Chinner 2010-05-21 649 struct xfs_cil_ctx *ne= w_ctx; > 71e330b593905e Dave Chinner 2010-05-21 650 struct xlog_in_core *c= ommit_iclog; > 71e330b593905e Dave Chinner 2010-05-21 651 struct xlog_ticket *ti= c; > 71e330b593905e Dave Chinner 2010-05-21 652 int num_iovecs; > 71e330b593905e Dave Chinner 2010-05-21 653 int error =3D 0; > 71e330b593905e Dave Chinner 2010-05-21 654 struct xfs_trans_heade= r thdr; > 71e330b593905e Dave Chinner 2010-05-21 655 struct xfs_log_iovec l= hdr; > 71e330b593905e Dave Chinner 2010-05-21 656 struct xfs_log_vec lvh= dr =3D { NULL }; > 71e330b593905e Dave Chinner 2010-05-21 657 xfs_lsn_t commit_lsn; > 4c2d542f2e7865 Dave Chinner 2012-04-23 658 xfs_lsn_t push_seq; > 0279bbbbc03f2c Dave Chinner 2021-06-03 659 struct bio bio; > 0279bbbbc03f2c Dave Chinner 2021-06-03 660 DECLARE_COMPLETION_ONS= TACK(bdev_flush); > 71e330b593905e Dave Chinner 2010-05-21 661 > 707e0ddaf67e89 Tetsuo Handa 2019-08-26 662 new_ctx =3D kmem_zallo= c(sizeof(*new_ctx), KM_NOFS); > 71e330b593905e Dave Chinner 2010-05-21 663 new_ctx->ticket =3D xl= og_cil_ticket_alloc(log); > 71e330b593905e Dave Chinner 2010-05-21 664 > 71e330b593905e Dave Chinner 2010-05-21 665 down_write(&cil->xc_ct= x_lock); > 71e330b593905e Dave Chinner 2010-05-21 666 ctx =3D cil->xc_ctx; > 71e330b593905e Dave Chinner 2010-05-21 667 > 4bb928cdb900d0 Dave Chinner 2013-08-12 668 spin_lock(&cil->xc_pus= h_lock); > 4c2d542f2e7865 Dave Chinner 2012-04-23 669 push_seq =3D cil->xc_p= ush_seq; > 4c2d542f2e7865 Dave Chinner 2012-04-23 670 ASSERT(push_seq <=3D c= tx->sequence); > 71e330b593905e Dave Chinner 2010-05-21 671 > 0e7ab7efe77451 Dave Chinner 2020-03-24 672 /* > 0e7ab7efe77451 Dave Chinner 2020-03-24 673 * Wake up any backgro= und push waiters now this context is being pushed. > 0e7ab7efe77451 Dave Chinner 2020-03-24 674 */ > c7f87f3984cfa1 Dave Chinner 2020-06-16 675 if (ctx->space_used >= =3D XLOG_CIL_BLOCKING_SPACE_LIMIT(log)) > c7f87f3984cfa1 Dave Chinner 2020-06-16 676 wake_up_all(&cil->xc_= push_wait); > 0e7ab7efe77451 Dave Chinner 2020-03-24 677 > 4c2d542f2e7865 Dave Chinner 2012-04-23 678 /* > 4c2d542f2e7865 Dave Chinner 2012-04-23 679 * Check if we've anyt= hing to push. If there is nothing, then we don't > 4c2d542f2e7865 Dave Chinner 2012-04-23 680 * move on to a new se= quence number and so we have to be able to push > 4c2d542f2e7865 Dave Chinner 2012-04-23 681 * this sequence again= later. > 4c2d542f2e7865 Dave Chinner 2012-04-23 682 */ > 4c2d542f2e7865 Dave Chinner 2012-04-23 683 if (list_empty(&cil->x= c_cil)) { > 4c2d542f2e7865 Dave Chinner 2012-04-23 684 cil->xc_push_seq =3D = 0; > 4bb928cdb900d0 Dave Chinner 2013-08-12 685 spin_unlock(&cil->xc_= push_lock); > a44f13edf0ebb4 Dave Chinner 2010-08-24 686 goto out_skip; > 4c2d542f2e7865 Dave Chinner 2012-04-23 687 } > 4c2d542f2e7865 Dave Chinner 2012-04-23 688 > a44f13edf0ebb4 Dave Chinner 2010-08-24 689 > cf085a1b5d2214 Joe Perches 2019-11-07 690 /* check for a previou= sly pushed sequence */ > 8af3dcd3c89aef Dave Chinner 2014-09-23 691 if (push_seq < cil->xc= _ctx->sequence) { > 8af3dcd3c89aef Dave Chinner 2014-09-23 692 spin_unlock(&cil->xc_= push_lock); > df806158b0f6eb Dave Chinner 2010-05-17 693 goto out_skip; > 8af3dcd3c89aef Dave Chinner 2014-09-23 694 } > 8af3dcd3c89aef Dave Chinner 2014-09-23 695 > 8af3dcd3c89aef Dave Chinner 2014-09-23 696 /* > 8af3dcd3c89aef Dave Chinner 2014-09-23 697 * We are now going to= push this context, so add it to the committing > 8af3dcd3c89aef Dave Chinner 2014-09-23 698 * list before we do a= nything else. This ensures that anyone waiting on > 8af3dcd3c89aef Dave Chinner 2014-09-23 699 * this push can easil= y detect the difference between a "push in > 8af3dcd3c89aef Dave Chinner 2014-09-23 700 * progress" and "CIL = is empty, nothing to do". > 8af3dcd3c89aef Dave Chinner 2014-09-23 701 * > 8af3dcd3c89aef Dave Chinner 2014-09-23 702 * IOWs, a wait loop c= an now check for: > 8af3dcd3c89aef Dave Chinner 2014-09-23 703 * the current sequenc= e not being found on the committing list; > 8af3dcd3c89aef Dave Chinner 2014-09-23 704 * an empty CIL; and > 8af3dcd3c89aef Dave Chinner 2014-09-23 705 * an unchanged sequen= ce number > 8af3dcd3c89aef Dave Chinner 2014-09-23 706 * to detect a push th= at had nothing to do and therefore does not need > 8af3dcd3c89aef Dave Chinner 2014-09-23 707 * waiting on. If the = CIL is not empty, we get put on the committing > 8af3dcd3c89aef Dave Chinner 2014-09-23 708 * list before emptyin= g the CIL and bumping the sequence number. Hence > 8af3dcd3c89aef Dave Chinner 2014-09-23 709 * an empty CIL and an= unchanged sequence number means we jumped out > 8af3dcd3c89aef Dave Chinner 2014-09-23 710 * above after doing n= othing. > 8af3dcd3c89aef Dave Chinner 2014-09-23 711 * > 8af3dcd3c89aef Dave Chinner 2014-09-23 712 * Hence the waiter wi= ll either find the commit sequence on the > 8af3dcd3c89aef Dave Chinner 2014-09-23 713 * committing list or = the sequence number will be unchanged and the CIL > 8af3dcd3c89aef Dave Chinner 2014-09-23 714 * still dirty. In tha= t latter case, the push has not yet started, and > 8af3dcd3c89aef Dave Chinner 2014-09-23 715 * so the waiter will = have to continue trying to check the CIL > 8af3dcd3c89aef Dave Chinner 2014-09-23 716 * committing list unt= il it is found. In extreme cases of delay, the > 8af3dcd3c89aef Dave Chinner 2014-09-23 717 * sequence may fully = commit between the attempts the wait makes to wait > 8af3dcd3c89aef Dave Chinner 2014-09-23 718 * on the commit seque= nce. > 8af3dcd3c89aef Dave Chinner 2014-09-23 719 */ > 8af3dcd3c89aef Dave Chinner 2014-09-23 720 list_add(&ctx->committ= ing, &cil->xc_committing); > 8af3dcd3c89aef Dave Chinner 2014-09-23 721 spin_unlock(&cil->xc_p= ush_lock); > df806158b0f6eb Dave Chinner 2010-05-17 722 > 71e330b593905e Dave Chinner 2010-05-21 723 /* > 0279bbbbc03f2c Dave Chinner 2021-06-03 724 * The CIL is stable a= t this point - nothing new will be added to it > 0279bbbbc03f2c Dave Chinner 2021-06-03 725 * because we hold the= flush lock exclusively. Hence we can now issue > 0279bbbbc03f2c Dave Chinner 2021-06-03 726 * a cache flush to en= sure all the completed metadata in the journal we > 0279bbbbc03f2c Dave Chinner 2021-06-03 727 * are about to overwr= ite is on stable storage. > 0279bbbbc03f2c Dave Chinner 2021-06-03 728 */ > 0279bbbbc03f2c Dave Chinner 2021-06-03 729 xfs_flush_bdev_async(&= bio, log->l_mp->m_ddev_targp->bt_bdev, > 0279bbbbc03f2c Dave Chinner 2021-06-03 730 &bdev_flush); > 0279bbbbc03f2c Dave Chinner 2021-06-03 731 > 0279bbbbc03f2c Dave Chinner 2021-06-03 732 /* > 0279bbbbc03f2c Dave Chinner 2021-06-03 733 * Pull all the log ve= ctors off the items in the CIL, and remove the > 0279bbbbc03f2c Dave Chinner 2021-06-03 734 * items from the CIL.= We don't need the CIL lock here because it's only > 0279bbbbc03f2c Dave Chinner 2021-06-03 735 * needed on the trans= action commit side which is currently locked out > 0279bbbbc03f2c Dave Chinner 2021-06-03 736 * by the flush lock. > 71e330b593905e Dave Chinner 2010-05-21 737 */ > 71e330b593905e Dave Chinner 2010-05-21 738 lv =3D NULL; > 71e330b593905e Dave Chinner 2010-05-21 739 num_iovecs =3D 0; > 71e330b593905e Dave Chinner 2010-05-21 740 while (!list_empty(&ci= l->xc_cil)) { > 71e330b593905e Dave Chinner 2010-05-21 741 struct xfs_log_item *= item; > 71e330b593905e Dave Chinner 2010-05-21 742 > 71e330b593905e Dave Chinner 2010-05-21 743 item =3D list_first_e= ntry(&cil->xc_cil, > 71e330b593905e Dave Chinner 2010-05-21 744 struct xfs_log_ite= m, li_cil); > 71e330b593905e Dave Chinner 2010-05-21 745 list_del_init(&item->= li_cil); > 71e330b593905e Dave Chinner 2010-05-21 746 if (!ctx->lv_chain) > 71e330b593905e Dave Chinner 2010-05-21 747 ctx->lv_chain =3D it= em->li_lv; > 71e330b593905e Dave Chinner 2010-05-21 748 else > 71e330b593905e Dave Chinner 2010-05-21 749 lv->lv_next =3D item= ->li_lv; > 71e330b593905e Dave Chinner 2010-05-21 750 lv =3D item->li_lv; > 71e330b593905e Dave Chinner 2010-05-21 751 item->li_lv =3D NULL; > 71e330b593905e Dave Chinner 2010-05-21 752 num_iovecs +=3D lv->l= v_niovecs; > 71e330b593905e Dave Chinner 2010-05-21 753 } > 71e330b593905e Dave Chinner 2010-05-21 754 > 71e330b593905e Dave Chinner 2010-05-21 755 /* > 71e330b593905e Dave Chinner 2010-05-21 756 * initialise the new = context and attach it to the CIL. Then attach > c7f87f3984cfa1 Dave Chinner 2020-06-16 757 * the current context= to the CIL committing list so it can be found > 71e330b593905e Dave Chinner 2010-05-21 758 * during log forces t= o extract the commit lsn of the sequence that > 71e330b593905e Dave Chinner 2010-05-21 759 * needs to be forced. > 71e330b593905e Dave Chinner 2010-05-21 760 */ > 71e330b593905e Dave Chinner 2010-05-21 761 INIT_LIST_HEAD(&new_ct= x->committing); > 71e330b593905e Dave Chinner 2010-05-21 762 INIT_LIST_HEAD(&new_ct= x->busy_extents); > 71e330b593905e Dave Chinner 2010-05-21 763 new_ctx->sequence =3D = ctx->sequence + 1; > 71e330b593905e Dave Chinner 2010-05-21 764 new_ctx->cil =3D cil; > 71e330b593905e Dave Chinner 2010-05-21 765 cil->xc_ctx =3D new_ct= x; > 71e330b593905e Dave Chinner 2010-05-21 766 > 71e330b593905e Dave Chinner 2010-05-21 767 /* > 71e330b593905e Dave Chinner 2010-05-21 768 * The switch is now d= one, so we can drop the context lock and move out > 71e330b593905e Dave Chinner 2010-05-21 769 * of a shared context= . We can't just go straight to the commit record, > 71e330b593905e Dave Chinner 2010-05-21 770 * though - we need to= synchronise with previous and future commits so > 71e330b593905e Dave Chinner 2010-05-21 771 * that the commit rec= ords are correctly ordered in the log to ensure > 71e330b593905e Dave Chinner 2010-05-21 772 * that we process ite= ms during log IO completion in the correct order. > 71e330b593905e Dave Chinner 2010-05-21 773 * > 71e330b593905e Dave Chinner 2010-05-21 774 * For example, if we = get an EFI in one checkpoint and the EFD in the > 71e330b593905e Dave Chinner 2010-05-21 775 * next (e.g. due to l= og forces), we do not want the checkpoint with > 71e330b593905e Dave Chinner 2010-05-21 776 * the EFD to be commi= tted before the checkpoint with the EFI. Hence > 71e330b593905e Dave Chinner 2010-05-21 777 * we must strictly or= der the commit records of the checkpoints so > 71e330b593905e Dave Chinner 2010-05-21 778 * that: a) the checkp= oint callbacks are attached to the iclogs in the > 71e330b593905e Dave Chinner 2010-05-21 779 * correct order; and = b) the checkpoints are replayed in correct order > 71e330b593905e Dave Chinner 2010-05-21 780 * in log recovery. > 71e330b593905e Dave Chinner 2010-05-21 781 * > 71e330b593905e Dave Chinner 2010-05-21 782 * Hence we need to ad= d this context to the committing context list so > 71e330b593905e Dave Chinner 2010-05-21 783 * that higher sequenc= es will wait for us to write out a commit record > 71e330b593905e Dave Chinner 2010-05-21 784 * before they do. > f876e44603ad09 Dave Chinner 2014-02-27 785 * > f876e44603ad09 Dave Chinner 2014-02-27 786 * xfs_log_force_lsn r= equires us to mirror the new sequence into the cil > f876e44603ad09 Dave Chinner 2014-02-27 787 * structure atomicall= y with the addition of this sequence to the > f876e44603ad09 Dave Chinner 2014-02-27 788 * committing list. Th= is also ensures that we can do unlocked checks > f876e44603ad09 Dave Chinner 2014-02-27 789 * against the current= sequence in log forces without risking > f876e44603ad09 Dave Chinner 2014-02-27 790 * deferencing a freed= context pointer. > 71e330b593905e Dave Chinner 2010-05-21 791 */ > 4bb928cdb900d0 Dave Chinner 2013-08-12 792 spin_lock(&cil->xc_pus= h_lock); > f876e44603ad09 Dave Chinner 2014-02-27 793 cil->xc_current_sequen= ce =3D new_ctx->sequence; > 4bb928cdb900d0 Dave Chinner 2013-08-12 794 spin_unlock(&cil->xc_p= ush_lock); > 71e330b593905e Dave Chinner 2010-05-21 795 up_write(&cil->xc_ctx_= lock); > 71e330b593905e Dave Chinner 2010-05-21 796 > 71e330b593905e Dave Chinner 2010-05-21 797 /* > 71e330b593905e Dave Chinner 2010-05-21 798 * Build a checkpoint = transaction header and write it to the log to > 71e330b593905e Dave Chinner 2010-05-21 799 * begin the transacti= on. We need to account for the space used by the > 71e330b593905e Dave Chinner 2010-05-21 800 * transaction header = here as it is not accounted for in xlog_write(). > 71e330b593905e Dave Chinner 2010-05-21 801 * > 71e330b593905e Dave Chinner 2010-05-21 802 * The LSN we need to = pass to the log items on transaction commit is > 71e330b593905e Dave Chinner 2010-05-21 803 * the LSN reported by= the first log vector write. If we use the commit > 71e330b593905e Dave Chinner 2010-05-21 804 * record lsn then we = can move the tail beyond the grant write head. > 71e330b593905e Dave Chinner 2010-05-21 805 */ > 71e330b593905e Dave Chinner 2010-05-21 806 tic =3D ctx->ticket; > 71e330b593905e Dave Chinner 2010-05-21 807 thdr.th_magic =3D XFS_= TRANS_HEADER_MAGIC; > 71e330b593905e Dave Chinner 2010-05-21 808 thdr.th_type =3D XFS_T= RANS_CHECKPOINT; > 71e330b593905e Dave Chinner 2010-05-21 809 thdr.th_tid =3D tic->t= _tid; > 71e330b593905e Dave Chinner 2010-05-21 810 thdr.th_num_items =3D = num_iovecs; > 4e0d5f926b80b0 Christoph Hellwig 2010-06-23 811 lhdr.i_addr =3D &thdr; > 71e330b593905e Dave Chinner 2010-05-21 812 lhdr.i_len =3D sizeof(= xfs_trans_header_t); > 71e330b593905e Dave Chinner 2010-05-21 813 lhdr.i_type =3D XLOG_R= EG_TYPE_TRANSHDR; > 71e330b593905e Dave Chinner 2010-05-21 814 tic->t_curr_res -=3D l= hdr.i_len + sizeof(xlog_op_header_t); > 71e330b593905e Dave Chinner 2010-05-21 815 > 71e330b593905e Dave Chinner 2010-05-21 816 lvhdr.lv_niovecs =3D 1; > 71e330b593905e Dave Chinner 2010-05-21 817 lvhdr.lv_iovecp =3D &l= hdr; > 71e330b593905e Dave Chinner 2010-05-21 818 lvhdr.lv_next =3D ctx-= >lv_chain; > 71e330b593905e Dave Chinner 2010-05-21 819 > 0279bbbbc03f2c Dave Chinner 2021-06-03 820 /* > 0279bbbbc03f2c Dave Chinner 2021-06-03 821 * Before we format an= d submit the first iclog, we have to ensure that > 0279bbbbc03f2c Dave Chinner 2021-06-03 822 * the metadata writeb= ack ordering cache flush is complete. > 0279bbbbc03f2c Dave Chinner 2021-06-03 823 */ > 0279bbbbc03f2c Dave Chinner 2021-06-03 824 wait_for_completion(&b= dev_flush); > 0279bbbbc03f2c Dave Chinner 2021-06-03 825 > 69d51e0e16864f Dave Chinner 2021-06-04 826 error =3D xlog_write(l= og, &lvhdr, tic, &ctx->start_lsn, NULL, > 69d51e0e16864f Dave Chinner 2021-06-04 827 XLOG_START_TRANS); > 71e330b593905e Dave Chinner 2010-05-21 828 if (error) > 7db37c5e6575b2 Dave Chinner 2011-01-27 829 goto out_abort_free_t= icket; > 71e330b593905e Dave Chinner 2010-05-21 830 > 71e330b593905e Dave Chinner 2010-05-21 831 /* > 71e330b593905e Dave Chinner 2010-05-21 832 * now that we've writ= ten the checkpoint into the log, strictly > 71e330b593905e Dave Chinner 2010-05-21 833 * order the commit re= cords so replay will get them in the right order. > 71e330b593905e Dave Chinner 2010-05-21 834 */ > 71e330b593905e Dave Chinner 2010-05-21 835 restart: > 4bb928cdb900d0 Dave Chinner 2013-08-12 836 spin_lock(&cil->xc_pus= h_lock); > 71e330b593905e Dave Chinner 2010-05-21 837 list_for_each_entry(ne= w_ctx, &cil->xc_committing, committing) { > ac983517ec5941 Dave Chinner 2014-05-07 838 /* > ac983517ec5941 Dave Chinner 2014-05-07 839 * Avoid getting stuc= k in this loop because we were woken by the > ac983517ec5941 Dave Chinner 2014-05-07 840 * shutdown, but then= went back to sleep once already in the > ac983517ec5941 Dave Chinner 2014-05-07 841 * shutdown state. > ac983517ec5941 Dave Chinner 2014-05-07 842 */ > ac983517ec5941 Dave Chinner 2014-05-07 843 if (XLOG_FORCED_SHUTD= OWN(log)) { > ac983517ec5941 Dave Chinner 2014-05-07 844 spin_unlock(&cil->xc= _push_lock); > ac983517ec5941 Dave Chinner 2014-05-07 845 goto out_abort_free_= ticket; > ac983517ec5941 Dave Chinner 2014-05-07 846 } > ac983517ec5941 Dave Chinner 2014-05-07 847 > 71e330b593905e Dave Chinner 2010-05-21 848 /* > 71e330b593905e Dave Chinner 2010-05-21 849 * Higher sequences w= ill wait for this one so skip them. > ac983517ec5941 Dave Chinner 2014-05-07 850 * Don't wait for our= own sequence, either. > 71e330b593905e Dave Chinner 2010-05-21 851 */ > 71e330b593905e Dave Chinner 2010-05-21 852 if (new_ctx->sequence= >=3D ctx->sequence) > 71e330b593905e Dave Chinner 2010-05-21 853 continue; > 71e330b593905e Dave Chinner 2010-05-21 854 if (!new_ctx->commit_= lsn) { > 71e330b593905e Dave Chinner 2010-05-21 855 /* > 71e330b593905e Dave Chinner 2010-05-21 856 * It is still being= pushed! Wait for the push to > 71e330b593905e Dave Chinner 2010-05-21 857 * complete, then st= art again from the beginning. > 71e330b593905e Dave Chinner 2010-05-21 858 */ > 4bb928cdb900d0 Dave Chinner 2013-08-12 859 xlog_wait(&cil->xc_c= ommit_wait, &cil->xc_push_lock); > 71e330b593905e Dave Chinner 2010-05-21 860 goto restart; > 71e330b593905e Dave Chinner 2010-05-21 861 } > 71e330b593905e Dave Chinner 2010-05-21 862 } > 4bb928cdb900d0 Dave Chinner 2013-08-12 863 spin_unlock(&cil->xc_p= ush_lock); > 71e330b593905e Dave Chinner 2010-05-21 864 > f10e925def9a6d Dave Chinner 2020-03-25 865 error =3D xlog_commit_= record(log, tic, &commit_iclog, &commit_lsn); > dd401770b0ff68 Dave Chinner 2020-03-25 866 if (error) > dd401770b0ff68 Dave Chinner 2020-03-25 867 goto out_abort_free_t= icket; > dd401770b0ff68 Dave Chinner 2020-03-25 868 > 8b41e3f98e6ca1 Christoph Hellwig 2020-03-25 869 xfs_log_ticket_ungrant= (log, tic); > 71e330b593905e Dave Chinner 2010-05-21 870 > 89ae379d564c5d Christoph Hellwig 2019-06-28 871 spin_lock(&commit_iclo= g->ic_callback_lock); > 1858bb0bec612d Christoph Hellwig 2019-10-14 872 if (commit_iclog->ic_s= tate =3D=3D XLOG_STATE_IOERROR) { > 89ae379d564c5d Christoph Hellwig 2019-06-28 873 spin_unlock(&commit_i= clog->ic_callback_lock); > 71e330b593905e Dave Chinner 2010-05-21 874 goto out_abort; > 89ae379d564c5d Christoph Hellwig 2019-06-28 875 } > 89ae379d564c5d Christoph Hellwig 2019-06-28 876 ASSERT_ALWAYS(commit_i= clog->ic_state =3D=3D XLOG_STATE_ACTIVE || > 89ae379d564c5d Christoph Hellwig 2019-06-28 877 commit_iclog->i= c_state =3D=3D XLOG_STATE_WANT_SYNC); > 89ae379d564c5d Christoph Hellwig 2019-06-28 878 list_add_tail(&ctx->ic= log_entry, &commit_iclog->ic_callbacks); > 89ae379d564c5d Christoph Hellwig 2019-06-28 879 spin_unlock(&commit_ic= log->ic_callback_lock); > 71e330b593905e Dave Chinner 2010-05-21 880 > 71e330b593905e Dave Chinner 2010-05-21 881 /* > 71e330b593905e Dave Chinner 2010-05-21 882 * now the checkpoint = commit is complete and we've attached the > 71e330b593905e Dave Chinner 2010-05-21 883 * callbacks to the ic= log we can assign the commit LSN to the context > 71e330b593905e Dave Chinner 2010-05-21 884 * and wake up anyone = who is waiting for the commit to complete. > 71e330b593905e Dave Chinner 2010-05-21 885 */ > 4bb928cdb900d0 Dave Chinner 2013-08-12 886 spin_lock(&cil->xc_pus= h_lock); > 71e330b593905e Dave Chinner 2010-05-21 887 ctx->commit_lsn =3D co= mmit_lsn; > eb40a87500ac2f Dave Chinner 2010-12-21 888 wake_up_all(&cil->xc_c= ommit_wait); > 4bb928cdb900d0 Dave Chinner 2013-08-12 889 spin_unlock(&cil->xc_p= ush_lock); > 71e330b593905e Dave Chinner 2010-05-21 890 > 5fd9256ce156ef Dave Chinner 2021-06-03 891 /* > 5fd9256ce156ef Dave Chinner 2021-06-03 892 * If the checkpoint s= pans multiple iclogs, wait for all previous > cb1acb3f324636 Dave Chinner 2021-06-04 893 * iclogs to complete = before we submit the commit_iclog. In this case, > cb1acb3f324636 Dave Chinner 2021-06-04 894 * the commit_iclog wr= ite needs to issue a pre-flush so that the > cb1acb3f324636 Dave Chinner 2021-06-04 895 * ordering is correct= ly preserved down to stable storage. > 5fd9256ce156ef Dave Chinner 2021-06-03 896 */ > 5fd9256ce156ef Dave Chinner 2021-06-03 @897 spin_lock(&log->l_iclo= glock); > cb1acb3f324636 Dave Chinner 2021-06-04 898 if (ctx->start_lsn != =3D commit_lsn) { > 5fd9256ce156ef Dave Chinner 2021-06-03 899 xlog_wait_on_iclog(co= mmit_iclog->ic_prev); > cb1acb3f324636 Dave Chinner 2021-06-04 @900 spin_lock(&log->l_icl= oglock); xlog_wait_on_commit drops l_icloglock, either directly or via xlog_wait. It looks odd (perhaps there should be a comment?) but at least in theory the functions are annotated so I guess that means the static checking doesn't know that commit_iclog->ic_log =3D=3D log? --D > cb1acb3f324636 Dave Chinner 2021-06-04 901 commit_iclog->ic_flag= s |=3D XLOG_ICL_NEED_FLUSH; > 5fd9256ce156ef Dave Chinner 2021-06-03 902 } > 5fd9256ce156ef Dave Chinner 2021-06-03 903 > cb1acb3f324636 Dave Chinner 2021-06-04 904 /* > cb1acb3f324636 Dave Chinner 2021-06-04 905 * The commit iclog mu= st be written to stable storage to guarantee > cb1acb3f324636 Dave Chinner 2021-06-04 906 * journal IO vs metad= ata writeback IO is correctly ordered on stable > cb1acb3f324636 Dave Chinner 2021-06-04 907 * storage. > cb1acb3f324636 Dave Chinner 2021-06-04 908 */ > cb1acb3f324636 Dave Chinner 2021-06-04 909 commit_iclog->ic_flags= |=3D XLOG_ICL_NEED_FUA; > cb1acb3f324636 Dave Chinner 2021-06-04 910 xlog_state_release_icl= og(log, commit_iclog); > cb1acb3f324636 Dave Chinner 2021-06-04 911 spin_unlock(&log->l_ic= loglock); > c7cc296ddd1f6d Christoph Hellwig 2020-03-20 912 return; > 71e330b593905e Dave Chinner 2010-05-21 913 > 71e330b593905e Dave Chinner 2010-05-21 914 out_skip: > 71e330b593905e Dave Chinner 2010-05-21 915 up_write(&cil->xc_ctx_= lock); > 71e330b593905e Dave Chinner 2010-05-21 916 xfs_log_ticket_put(new= _ctx->ticket); > 71e330b593905e Dave Chinner 2010-05-21 917 kmem_free(new_ctx); > c7cc296ddd1f6d Christoph Hellwig 2020-03-20 918 return; > 71e330b593905e Dave Chinner 2010-05-21 919 > 7db37c5e6575b2 Dave Chinner 2011-01-27 920 out_abort_free_ticket: > 8b41e3f98e6ca1 Christoph Hellwig 2020-03-25 921 xfs_log_ticket_ungrant= (log, tic); > 71e330b593905e Dave Chinner 2010-05-21 922 out_abort: > 12e6a0f449d585 Christoph Hellwig 2020-03-20 923 ASSERT(XLOG_FORCED_SHU= TDOWN(log)); > 12e6a0f449d585 Christoph Hellwig 2020-03-20 924 xlog_cil_committed(ctx= ); > 4c2d542f2e7865 Dave Chinner 2012-04-23 925 } > 4c2d542f2e7865 Dave Chinner 2012-04-23 926 > = > :::::: The code at line 897 was first introduced by commit > :::::: 5fd9256ce156ef7780f05c9ff0a5b9e2ed9f6679 xfs: separate CIL commit = record IO > = > :::::: TO: Dave Chinner > :::::: CC: Dave Chinner > = > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org > _______________________________________________ > kbuild-all mailing list -- kbuild-all(a)lists.01.org > To unsubscribe send an email to kbuild-all-leave(a)lists.01.org --===============6113681865740994151==--