Skip to content
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

Bugfix: ignore not connected error in NodeUnpublishVolume #3445

Merged
merged 3 commits into from
Sep 11, 2023

Conversation

wangshli
Copy link
Contributor

@wangshli wangshli commented Sep 8, 2023

Ⅰ. Describe what this PR does

ignore not connected error at the beginning of NodeUnpublishVolume

Ⅱ. Does this pull request fix one issue?

fixes #3444

Ⅲ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn>
@fluid-e2e-bot
Copy link

fluid-e2e-bot bot commented Sep 8, 2023

Hi @wangshli. Thanks for your PR.

I'm waiting for a fluid-cloudnative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@codecov
Copy link

codecov bot commented Sep 8, 2023

Codecov Report

Merging #3445 (beaa625) into master (321dc08) will increase coverage by 0.00%.
Report is 2 commits behind head on master.
The diff coverage is 100.00%.

❗ Current head beaa625 differs from pull request most recent head b73fce8. Consider uploading reports for the commit b73fce8 to get more accurate results

@@           Coverage Diff           @@
##           master    #3445   +/-   ##
=======================================
  Coverage   64.28%   64.28%           
=======================================
  Files         442      442           
  Lines       26414    26420    +6     
=======================================
+ Hits        16980    16984    +4     
- Misses       7429     7430    +1     
- Partials     2005     2006    +1     
Files Changed Coverage Δ
pkg/ddc/jindocache/transform.go 66.07% <100.00%> (+0.13%) ⬆️
pkg/ddc/jindofsx/transform.go 64.86% <100.00%> (+0.14%) ⬆️

... and 1 file with indirect coverage changes

@@ -193,7 +193,8 @@ func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu
glog.V(3).Infof("NodeUnpublishVolume: targetPath %s has been cleaned up, so it doesn't need to be unmounted", targetPath)
Copy link
Collaborator

@cheyang cheyang Sep 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you reduce nesting levels to decrease code complexity? The nesting levels can be reduced by utilizing the short-circuit mechanism of the if statement. For example, check os.IsNotExist(err) first and then check errors.Is(err, syscall.ENOTCONN). Such as:

if os.IsNotExist(err) {
	....
} else if err != nil {
	if !errors.Is(err, syscall.ENOTCONN) {
		...
	}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, done.

Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn>
} else if err != nil {
// if error is "transport endpoint is not connected", ingore and do umount
if !errors.Is(err, syscall.ENOTCONN) {
return nil, errors.Wrapf(err, "NodeUnpublishVolume: stat targetPath %s error %v", targetPath, err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also provide the log info for syscall.ENOTCONN.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error will be logged in the code below:

notMount, err := mounter.IsLikelyNotMountPoint(targetPath)
if err != nil {
glog.V(3).Infoln(err)

}
if err != nil {
return nil, errors.Wrapf(err, "NodeUnpublishVolume: stat targetPath %s error %v", targetPath, err)
} else if err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about:

Suggested change
} else if err != nil {
}
if err != nil && !errors.Is(err, syscall.ENOTCONN) {
return ...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, done.

Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn>
@sonarcloud
Copy link

sonarcloud bot commented Sep 11, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@cheyang cheyang self-requested a review September 11, 2023 09:01
Copy link
Collaborator

@cheyang cheyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@fluid-e2e-bot
Copy link

fluid-e2e-bot bot commented Sep 11, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cheyang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fluid-e2e-bot fluid-e2e-bot bot merged commit 3e8ba24 into fluid-cloudnative:master Sep 11, 2023
9 checks passed
TrafalgarZZZ pushed a commit to TrafalgarZZZ/fluid that referenced this pull request Sep 13, 2023
…dnative#3445)

* ignore not connected error in NodeUnpublishVolume

Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn>

* fix check nil error

Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn>

* simplify error judgment

Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn>

---------

Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn>
fluid-e2e-bot bot pushed a commit that referenced this pull request Sep 13, 2023
…and NodeUnpublishVolume (#3448) (#3453)

* Bugfix: ignore not connected error in NodeUnpublishVolume (#3445)

* ignore not connected error in NodeUnpublishVolume

Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn>

* fix check nil error

Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn>

* simplify error judgment

Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn>

---------

Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn>

* bugfix: fix csi plugin concurrency issue on FuseRecovery and NodeUnpublishVolume (#3448)

* Add comments for NodeUnpublishVolume

Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>

* Refactor NodeUnpublishVolume code

Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>

* FuseRecovery uses volume locks to avoid race conditions

Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>

* Refactor node server with codes.Internal error code

Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>

* Rename CSI Config to RunningContext

Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>

* Fix github actions checks

Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>

* Fix lock release

Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>

* Refactor recover logic

Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>

---------

Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>

---------

Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn>
Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>
Co-authored-by: wangshulin <89928606+wangshli@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] NodeUnpublishVolume error due to stat error
3 participants