Skip to content

Linux: g/c leftover fence in zfs_znode_alloc #11115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 29, 2020

Conversation

mjguzik
Copy link
Contributor

@mjguzik mjguzik commented Oct 26, 2020

The port removed provisions for zfs_znode_move but the cleanup missed
this bit. To quote the original:
[snip]
list_insert_tail(&zfsvfs->z_all_znodes, zp);
membar_producer();
/*
* Everything else must be valid before assigning z_zfsvfs makes the
* znode eligible for zfs_znode_move().
*/
zp->z_zfsvfs = zfsvfs;
[/snip]

In the current code it is immediately followed by unlock which issues
the same fence, thus plays no role in correctness.

Note it happens to be harmless on amd64 as it expands to a compiler barrier on that platform.

Signed-off-by: Mateusz Guzik [email protected]

Motivation and Context

Description

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

The port removed provisions for zfs_znode_move but the cleanup missed
this bit. To quote the original:
[snip]
    list_insert_tail(&zfsvfs->z_all_znodes, zp);
    membar_producer();
    /*
     * Everything else must be valid before assigning z_zfsvfs makes the
     * znode eligible for zfs_znode_move().
     */
    zp->z_zfsvfs = zfsvfs;
[/snip]

In the current code it is immediately followed by unlock which issues
the same fence, thus plays no role in correctness.

Signed-off-by: Mateusz Guzik <[email protected]>
@codecov
Copy link

codecov bot commented Oct 27, 2020

Codecov Report

Merging #11115 into master will increase coverage by 0.21%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11115      +/-   ##
==========================================
+ Coverage   79.81%   80.02%   +0.21%     
==========================================
  Files         398      398              
  Lines      125754   125753       -1     
==========================================
+ Hits       100367   100636     +269     
+ Misses      25387    25117     -270     
Flag Coverage Δ
#kernel 80.50% <ø> (+0.02%) ⬆️
#user 66.60% <ø> (+0.41%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
module/os/linux/zfs/zfs_znode.c 86.74% <ø> (+0.55%) ⬆️
module/zfs/dsl_synctask.c 92.30% <0.00%> (-2.57%) ⬇️
module/os/linux/zfs/zvol_os.c 87.36% <0.00%> (-0.89%) ⬇️
module/zfs/zvol.c 84.39% <0.00%> (-0.68%) ⬇️
module/zfs/zfs_quota.c 86.36% <0.00%> (-0.46%) ⬇️
module/zfs/vdev_raidz.c 93.48% <0.00%> (-0.44%) ⬇️
module/zfs/vdev_initialize.c 97.46% <0.00%> (-0.32%) ⬇️
module/zfs/dmu_objset.c 91.66% <0.00%> (-0.32%) ⬇️
module/zfs/dsl_dataset.c 92.20% <0.00%> (-0.29%) ⬇️
module/zfs/dsl_destroy.c 93.35% <0.00%> (-0.18%) ⬇️
... and 44 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5c810ac...7f23a5b. Read the comment docs.

@ghost ghost added the Status: Code Review Needed Ready for review and testing label Oct 27, 2020
@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Oct 29, 2020
@behlendorf behlendorf merged commit 973ba68 into openzfs:master Oct 29, 2020
ghost pushed a commit to zfsonfreebsd/ZoF that referenced this pull request Oct 30, 2020
The port removed provisions for zfs_znode_move but the cleanup missed
this bit. To quote the original:

[snip]
    list_insert_tail(&zfsvfs->z_all_znodes, zp);
    membar_producer();
    /*
     * Everything else must be valid before assigning z_zfsvfs makes the
     * znode eligible for zfs_znode_move().
     */
    zp->z_zfsvfs = zfsvfs;
[/snip]

In the current code it is immediately followed by unlock which issues
the same fence, thus plays no role in correctness.

Reviewed-by: Matt Macy <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Mateusz Guzik <[email protected]>
Closes openzfs#11115
behlendorf pushed a commit that referenced this pull request Oct 30, 2020
The port removed provisions for zfs_znode_move but the cleanup missed
this bit. To quote the original:

[snip]
    list_insert_tail(&zfsvfs->z_all_znodes, zp);
    membar_producer();
    /*
     * Everything else must be valid before assigning z_zfsvfs makes the
     * znode eligible for zfs_znode_move().
     */
    zp->z_zfsvfs = zfsvfs;
[/snip]

In the current code it is immediately followed by unlock which issues
the same fence, thus plays no role in correctness.

Reviewed-by: Matt Macy <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Mateusz Guzik <[email protected]>
Closes #11115
@mjguzik mjguzik deleted the linux_znode_move branch October 30, 2020 23:45
jsai20 pushed a commit to jsai20/zfs that referenced this pull request Mar 30, 2021
The port removed provisions for zfs_znode_move but the cleanup missed
this bit. To quote the original:

[snip]
    list_insert_tail(&zfsvfs->z_all_znodes, zp);
    membar_producer();
    /*
     * Everything else must be valid before assigning z_zfsvfs makes the
     * znode eligible for zfs_znode_move().
     */
    zp->z_zfsvfs = zfsvfs;
[/snip]

In the current code it is immediately followed by unlock which issues
the same fence, thus plays no role in correctness.

Reviewed-by: Matt Macy <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Mateusz Guzik <[email protected]>
Closes openzfs#11115
sempervictus pushed a commit to sempervictus/zfs that referenced this pull request May 31, 2021
The port removed provisions for zfs_znode_move but the cleanup missed
this bit. To quote the original:

[snip]
    list_insert_tail(&zfsvfs->z_all_znodes, zp);
    membar_producer();
    /*
     * Everything else must be valid before assigning z_zfsvfs makes the
     * znode eligible for zfs_znode_move().
     */
    zp->z_zfsvfs = zfsvfs;
[/snip]

In the current code it is immediately followed by unlock which issues
the same fence, thus plays no role in correctness.

Reviewed-by: Matt Macy <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Mateusz Guzik <[email protected]>
Closes openzfs#11115
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants