26 Sep, 2020

1 commit

  • Fix the comments to help people understand the code.

    Signed-off-by: Kaixu Xia
    [darrick: fix the indenting problems too]
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong
    Reviewed-by: Christoph Hellwig

    Kaixu Xia
     

16 Sep, 2020

5 commits


05 Aug, 2020

1 commit

  • Delete repeated words in fs/xfs/.
    {we, that, the, a, to, fork}
    Change "it it" to "it is" in one location.

    Signed-off-by: Randy Dunlap
    To: linux-fsdevel@vger.kernel.org
    Cc: Darrick J. Wong
    Cc: linux-xfs@vger.kernel.org
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Randy Dunlap
     

29 Jul, 2020

20 commits


07 Jul, 2020

4 commits

  • xfs_ail_delete_one() is called directly from dquot and inode IO
    completion, as well as from the generic xfs_trans_ail_delete()
    function. Inodes are about to have their own failure handling, and
    dquots will in future, too. Pull the clearing of the LI_FAILED flag
    up into the callers so we can customise the code appropriately.

    Signed-off-by: Dave Chinner
    Reviewed-by: Brian Foster
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Dave Chinner
     
  • They are not used anymore, so remove them from the log item and the
    buffer iodone attachment interfaces.

    Signed-off-by: Dave Chinner
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Darrick J. Wong
    Reviewed-by: Brian Foster
    Signed-off-by: Darrick J. Wong

    Dave Chinner
     
  • Similar to inodes, we can call the dquot IO completion functions
    directly from the buffer completion code, removing another user of
    log item callbacks for IO completion processing.

    Signed-off-by: Dave Chinner
    Reviewed-by: Brian Foster
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Dave Chinner
     
  • dquot buffers always have write IO callbacks, so by marking them
    directly we can avoid needing to attach ->b_iodone functions to
    them. This avoids an indirect call, and makes future modifications
    much simpler.

    This is largely a rearrangement of the code at this point - no IO
    completion functionality changes at this point, just how the
    code is run is modified.

    Signed-off-by: Dave Chinner
    Reviewed-by: Brian Foster
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Dave Chinner
     

27 May, 2020

3 commits

  • Move timers and warnings out of xfs_quotainfo and into xfs_def_quota
    so that we can utilize them on a per-type basis, rather than enforcing
    them based on the values found in the first enabled quota type.

    Signed-off-by: Eric Sandeen
    [zlang: new way to get defquota in xfs_qm_init_timelimits]
    [zlang: remove redundant defq assign]
    Signed-off-by: Zorro Lang

    Signed-off-by: Eric Sandeen
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Eric Sandeen
     
  • xfs_get_defquota() currently takes an xfs_dquot, and from that obtains
    the type of default quota we should get (user/group/project).

    But early in init, we don't have access to a fully set up quota, so
    that's not possible. The next patch needs go set up default quota
    timers early, so switch xfs_get_defquota to take an explicit type
    and add a helper function to obtain that type from an xfs_dquot
    for the existing callers.

    Signed-off-by: Eric Sandeen
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Eric Sandeen
     
  • Pass xfs_dquot rather than xfs_disk_dquot to xfs_qm_adjust_dqtimers;
    this makes it symmetric with xfs_qm_adjust_dqlimits and will help
    the next patch.

    Signed-off-by: Eric Sandeen
    Reviewed-by: Allison Collins
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Eric Sandeen
     

20 May, 2020

1 commit

  • While QAing the new xfs_repair quotacheck code, I uncovered a quota
    corruption bug resulting from a bad interaction between dquot buffer
    initialization and quotacheck. The bug can be reproduced with the
    following sequence:

    # mkfs.xfs -f /dev/sdf
    # mount /dev/sdf /opt -o usrquota
    # su nobody -s /bin/bash -c 'touch /opt/barf'
    # sync
    # xfs_quota -x -c 'report -ahi' /opt
    User quota on /opt (/dev/sdf)
    Inodes
    User ID Used Soft Hard Warn/Grace
    ---------- ---------------------------------
    root 3 0 0 00 [------]
    nobody 1 0 0 00 [------]

    # xfs_io -x -c 'shutdown' /opt
    # umount /opt
    # mount /dev/sdf /opt -o usrquota
    # touch /opt/man2
    # xfs_quota -x -c 'report -ahi' /opt
    User quota on /opt (/dev/sdf)
    Inodes
    User ID Used Soft Hard Warn/Grace
    ---------- ---------------------------------
    root 1 0 0 00 [------]
    nobody 1 0 0 00 [------]

    # umount /opt

    Notice how the initial quotacheck set the root dquot icount to 3
    (rootino, rbmino, rsumino), but after shutdown -> remount -> recovery,
    xfs_quota reports that the root dquot has only 1 icount. We haven't
    deleted anything from the filesystem, which means that quota is now
    under-counting. This behavior is not limited to icount or the root
    dquot, but this is the shortest reproducer.

    I traced the cause of this discrepancy to the way that we handle ondisk
    dquot updates during quotacheck vs. regular fs activity. Normally, when
    we allocate a disk block for a dquot, we log the buffer as a regular
    (dquot) buffer. Subsequent updates to the dquots backed by that block
    are done via separate dquot log item updates, which means that they
    depend on the logged buffer update being written to disk before the
    dquot items. Because individual dquots have their own LSN fields, that
    initial dquot buffer must always be recovered.

    However, the story changes for quotacheck, which can cause dquot block
    allocations but persists the final dquot counter values via a delwri
    list. Because recovery doesn't gate dquot buffer replay on an LSN, this
    means that the initial dquot buffer can be replayed over the (newer)
    contents that were delwritten at the end of quotacheck. In effect, this
    re-initializes the dquot counters after they've been updated. If the
    log does not contain any other dquot items to recover, the obsolete
    dquot contents will not be corrected by log recovery.

    Because quotacheck uses a transaction to log the setting of the CHKD
    flags in the superblock, we skip quotacheck during the second mount
    call, which allows the incorrect icount to remain.

    Fix this by changing the ondisk dquot initialization function to use
    ordered buffers to write out fresh dquot blocks if it detects that we're
    running quotacheck. If the system goes down before quotacheck can
    complete, the CHKD flags will not be set in the superblock and the next
    mount will run quotacheck again, which can fix uninitialized dquot
    buffers. This requires amending the defer code to maintaine ordered
    buffer state across defer rolls for the sake of the dquot allocation
    code.

    For regular operations we preserve the current behavior since the dquot
    items require properly initialized ondisk dquot records.

    Signed-off-by: Darrick J. Wong
    Reviewed-by: Brian Foster
    Reviewed-by: Christoph Hellwig

    Darrick J. Wong
     

07 May, 2020

5 commits

  • Now that the functions and callers of
    xfs_trans_ail_[remove|delete]() have been fixed up appropriately,
    the only difference between the two is the shutdown behavior. There
    are only a few callers of the _remove() variant, so make the
    shutdown conditional on the parameter and combine the two functions.

    Suggested-by: Dave Chinner
    Signed-off-by: Brian Foster
    Reviewed-by: Dave Chinner
    Reviewed-by: Darrick J. Wong
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Allison Collins
    Signed-off-by: Darrick J. Wong

    Brian Foster
     
  • The shutdown parameter of xfs_trans_ail_remove() is no longer used.
    The remaining callers use it for items that legitimately might not
    be in the AIL or from contexts where AIL state has already been
    checked. Remove the unnecessary parameter and fix up the callers.

    Signed-off-by: Brian Foster
    Reviewed-by: Darrick J. Wong
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Allison Collins
    Signed-off-by: Darrick J. Wong

    Brian Foster
     
  • Several callers acquire the lock just prior to the call. Callers
    that require ->ail_lock for other purposes already check IN_AIL
    state and thus don't require the additional shutdown check in the
    helper. Push the lock down into xfs_trans_ail_delete(), open code
    the instances that still acquire it, and remove the unnecessary ailp
    parameter.

    Signed-off-by: Brian Foster
    Reviewed-by: Darrick J. Wong
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Allison Collins
    Signed-off-by: Darrick J. Wong

    Brian Foster
     
  • The dquot flush handler effectively aborts the dquot flush if the
    filesystem is already shut down, but doesn't actually shut down if
    the flush fails. Update xfs_qm_dqflush() to consistently abort the
    dquot flush and shutdown the fs if the flush fails with an
    unexpected error.

    Signed-off-by: Brian Foster
    Reviewed-by: Dave Chinner
    Reviewed-by: Allison Collins
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Brian Foster
     
  • The pre-flush dquot verification in xfs_qm_dqflush() duplicates the
    read verifier by checking the dquot in the on-disk buffer. Instead,
    verify the in-core variant before it is flushed to the buffer.

    Fixes: 7224fa482a6d ("xfs: add full xfs_dqblk verifier")
    Signed-off-by: Brian Foster
    Reviewed-by: Dave Chinner
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Allison Collins
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Brian Foster