-
Notifications
You must be signed in to change notification settings - Fork 955
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
check path existence and lock in NodeUnpublishVolume #3284
Conversation
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 Once the patch is verified, the new status will be reflected by the 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 Report
@@ Coverage Diff @@
## master #3284 +/- ##
==========================================
- Coverage 65.49% 65.45% -0.04%
==========================================
Files 398 399 +1
Lines 23184 23198 +14
==========================================
Hits 15184 15184
- Misses 6215 6229 +14
Partials 1785 1785
|
pkg/csi/plugins/nodeserver.go
Outdated
|
||
// The lock is to avoid race condition | ||
ns.mutex.Lock() | ||
defer ns.mutex.Unlock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please consider two things:
- The lock scope is too wide, we'd better to restrict it to mount path level.
- Is the lock only for NodeUnpublishVolume?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have modified: use mount path level lock and also lock for NodePublishVolume
/test fluid-e2e |
pkg/csi/plugins/nodeserver.go
Outdated
_, err := os.Stat(targetPath) | ||
// No need to unmount non-existing targetPath | ||
if os.IsNotExist(err) { | ||
glog.V(4).Infof("NodeUnpublishVolume: targetPath %s does not exist", targetPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest changing logging info to NodeUnpublishVolume: targetPath %s has been cleaned up, so it doesn't need to be unmounted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I wonder the reason of setting log level to 4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just follow other success log such as "glog.V(4).Infof("Succeed in binding %s to %s", mountPath, targetPath)"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I wonder the reason of setting log level to 4.
The defauld log level is 5. And I thought for csi plugin, the second unmount should not be error so set the log level to 4 to indicate that the second NodeUnplishVolume incurs no error and success. But for devloper, it is should indicate that the kubelet invokes second call and the second call itself is an error. So we use log level 3 here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CleanupMountPoint used by gcp throws a warning when targetpath not exist, do we also use warning?
@@ -167,6 +172,23 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis | |||
func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) { | |||
targetPath := req.GetTargetPath() | |||
|
|||
// check path existence | |||
_, err := os.Stat(targetPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also need to check target is valid or not(0 length).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
@wangshli Thx for the contribution!
/test fluid-e2e |
/retest |
@wangshli: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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. |
Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn>
Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn>
Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn>
Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn>
Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn>
/ok-to-test |
Kudos, SonarCloud Quality Gate passed! |
/test fluid-e2e |
1 similar comment
/test fluid-e2e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[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 |
…ve#3284) * check path existence and lock in NodeUnpublishVolume Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn> * use path level lock and lock for NodePublishVolume Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn> * small fix Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn> * return codes.aborted when the lock is not acquired Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn> * check target path validity Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn> * adjust order of check path and acquire lock Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn> --------- Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn>
* check path existence and lock in NodeUnpublishVolume * use path level lock and lock for NodePublishVolume * small fix * return codes.aborted when the lock is not acquired * check target path validity * adjust order of check path and acquire lock --------- Signed-off-by: wangshulin <wangshulin@smail.nju.edu.cn> Co-authored-by: wangshulin <89928606+wangshli@users.noreply.github.com>
Ⅰ. Describe what this PR does
check path existence and lock in NodeUnpublishVolume
Ⅱ. Does this pull request fix one issue?
fixes #3269
Ⅲ. 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