diff --git a/src/driver/index.js b/src/driver/index.js index 51b9968..2d51e16 100644 --- a/src/driver/index.js +++ b/src/driver/index.js @@ -1054,6 +1054,15 @@ class CsiBaseDriver { normalized_staging_path = staging_target_path; } + // sanity check to ensure the staged path is actually mounted + result = await mount.pathIsMounted(normalized_staging_path); + if (!result) { + throw new GrpcError( + grpc.status.FAILED_PRECONDITION, + `staging path is not mounted: ${normalized_staging_path}` + ); + } + result = await mount.pathIsMounted(target_path); // if not mounted, mount if (!result) { diff --git a/src/utils/mount.js b/src/utils/mount.js index 187c1d4..25bbd7b 100644 --- a/src/utils/mount.js +++ b/src/utils/mount.js @@ -10,7 +10,7 @@ FINDMNT_COMMON_OPTIONS = [ "--nofsroot", // prevents unwanted behavior with cifs volumes ]; -DEFAUT_TIMEOUT = 30000; +DEFAUT_TIMEOUT = process.env.MOUNT_DEFAULT_TIMEOUT || 30000; class Mount { constructor(options = {}) {