@@ -109,6 +109,7 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
109109 if err := validateNodePublishVolumeRequest (req ); err != nil {
110110 return nil , err
111111 }
112+ attachPath := mounterutils .GetAttachPath (req .VolumeId )
112113
113114 // parse options
114115 // ensure fuseType is not empty
@@ -176,11 +177,21 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
176177 }
177178 if ! notMnt {
178179 klog .Infof ("NodePublishVolume: %s already mounted" , targetPath )
179- if needRotateToken (opts , authCfg .Secrets ) {
180- err := ossfsMounter .RotateToken (targetPath , opts .FuseType , authCfg .Secrets )
180+ if ! features .FunctionalMutableFeatureGate .Enabled (features .RundCSIProtocol3 ) && needRotateToken (opts , authCfg .Secrets ) {
181+ // mountPath is the target path for mounter
182+ mountPath := attachPath
183+ if ns .skipAttach {
184+ mountPath = targetPath
185+ }
186+ err := ossfsMounter .RotateToken (mountPath , opts .FuseType , authCfg .Secrets )
181187 if err != nil {
188+ // if is mounter not supported, return unimplentederror to avoid retry
189+ if mounter .IsNotImplementedErr (err ) {
190+ return nil , status .Error (codes .Unimplemented , err .Error ())
191+ }
182192 return nil , status .Error (codes .Internal , err .Error ())
183193 }
194+ klog .Infof ("NodePublishVolume: %s already rotated token" , targetPath )
184195 }
185196 return & csi.NodePublishVolumeResponse {}, nil
186197 }
@@ -200,7 +211,6 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
200211
201212 // When work as csi nodeserver, mount on the attach path under /run/fuse.ossfs and then perform the bind mount.
202213 // check whether the attach path is mounted
203- attachPath := mounterutils .GetAttachPath (req .VolumeId )
204214 notMnt , err = isNotMountPoint (ns .rawMounter , attachPath )
205215 if err != nil {
206216 return nil , err
0 commit comments