Bug #8376

cached v_path should be kept fresh

Added by Patrick Mooney 2 months ago. Updated 2 months ago.

Status:ClosedStart date:2017-06-12
Priority:NormalDue date:
Assignee:Patrick Mooney% Done:

100%

Category:kernel
Target version:-
Difficulty:Medium Tags:needs-triage

Description

The logic for generating and maintaining the cached v_path value on vnodes could stand to be improved. If vnodes were purely ephemeral, then freshly calculating v_path at the time of lookup() would result in correct values (at a performance cost). When they persist, either as referenced by other structures (such as open files, process cwd, dnlc entries, etc), the opportunity for the v_path to become stale arises. This is exacerbated by the current behavior that, when v_path is found to be invalid (during a vnodetopath operation) will strive to recalculate it, but not preserve the result. The overall situation leads to both performance and correctness (due to lack of results) problems relating to v_path.

This has been addressed in SmartOS through a series of changes. Firstly, to do proper invalidation of v_path when it's found to be stale:
- OS-3891 stale v_path slows vfs lookups

OS-3891 revealed that some logic made assumptions about v_path never transitioning from non-NULL to NULL. It was addressed here:
- OS-4317 v_path accesses can race

While the pathological stale v_path behavior had been addressed, there are still cases where the absence of valid v_path information was causing problems. The largest patch in this series addressed it by performing v_path checking and updates during vnode lookups/updates, when it is most convenient:
- OS-5167 cached v_path should be kept fresh

Two smaller updates are included too, to prevent erroneous behavior introduced by the prior changes:
- OS-5846 procfs should follow VFS rules
- OS-6134 vn_reinit balks on zeroed vnodes


Related issues

Related to illumos gate - Bug #6015: vnode: v_path reading should be protected by v_lock In Progress 2015-06-19
Related to illumos gate - Bug #8438: panic in vnode_valid_pn Closed 2017-06-28

History

#1 Updated by Marcel Telka 2 months ago

  • Related to Bug #6015: vnode: v_path reading should be protected by v_lock added

#2 Updated by Electric Monk 2 months ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

git commit e2fc3408efa6cdfc5e33c73c3567efc8c7592707

commit  e2fc3408efa6cdfc5e33c73c3567efc8c7592707
Author: Patrick Mooney <pmooney@pfmooney.com>
Date:   2017-06-21T18:33:14.000Z

    8376 cached v_path should be kept fresh
    Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Approved by: Gordon Ross <gwr@nexenta.com>

#3 Updated by Marcel Telka about 2 months ago

  • Related to Bug #8438: panic in vnode_valid_pn added

Also available in: Atom