mirror of
https://github.com/ceph/ceph
synced 2025-02-23 11:07:35 +00:00
ceph-dokan: Made max path length configurable
Added ceph-dokan CLI optarg for configuring the value of the maximum path length. By default, it will be set to 256 and it will have a maximum value of 32767. Signed-off-by: Stefan Chivu <schivu@cloudbasesolutions.com>
This commit is contained in:
parent
5fc5f0c423
commit
b1504a028c
@ -789,7 +789,8 @@ static NTSTATUS WinCephGetVolumeInformation(
|
||||
g_cfg->win_vol_name.copy(VolumeNameBuffer, VolumeNameSize);
|
||||
*VolumeSerialNumber = g_cfg->win_vol_serial;
|
||||
|
||||
*MaximumComponentLength = 256;
|
||||
*MaximumComponentLength = g_cfg->max_path_len;
|
||||
|
||||
*FileSystemFlags = FILE_CASE_SENSITIVE_SEARCH |
|
||||
FILE_CASE_PRESERVED_NAMES |
|
||||
FILE_SUPPORTS_REMOTE_STORAGE |
|
||||
@ -949,6 +950,15 @@ int do_map() {
|
||||
}
|
||||
}
|
||||
|
||||
if (g_cfg->max_path_len > 260) {
|
||||
dout(0) << "maximum path length set to " << g_cfg->max_path_len
|
||||
<< ". Some Windows utilities may not be able to handle "
|
||||
<< "paths that exceed MAX_PATH (260) characters. "
|
||||
<< "CreateDirectoryW, used by Powershell, has also been "
|
||||
<< "observed to fail when paths exceed 16384 characters."
|
||||
<< dendl;
|
||||
}
|
||||
|
||||
atexit(unmount_atexit);
|
||||
dout(0) << "Mounted cephfs directory: " << g_cfg->root_path.c_str()
|
||||
<<". Mountpoint: " << to_string(g_cfg->mountpoint) << dendl;
|
||||
|
@ -33,6 +33,7 @@ struct Config {
|
||||
|
||||
std::wstring win_vol_name = L"";
|
||||
unsigned long win_vol_serial = 0;
|
||||
unsigned long max_path_len = 256;
|
||||
};
|
||||
|
||||
extern Config *g_cfg;
|
||||
|
@ -40,6 +40,7 @@ Map options:
|
||||
--removable use a removable drive
|
||||
--win-vol-name arg The Windows volume name. Default: Ceph - <fs_name>.
|
||||
--win-vol-serial arg The Windows volume serial number. Default: <fs_id>.
|
||||
--max-path-len The value of the maximum path length. Default: 256.
|
||||
|
||||
Unmap options:
|
||||
-l [ --mountpoint ] arg mountpoint (path or drive letter) (e.g -l x).
|
||||
@ -85,6 +86,7 @@ int parse_args(
|
||||
std::string mountpoint;
|
||||
std::string win_vol_name;
|
||||
std::string win_vol_serial;
|
||||
std::string max_path_len;
|
||||
|
||||
int thread_count;
|
||||
|
||||
@ -115,6 +117,23 @@ int parse_args(
|
||||
} else if (ceph_argparse_witharg(args, i, &win_vol_serial,
|
||||
"--win-vol-serial", (char *)NULL)) {
|
||||
cfg->win_vol_serial = std::stoul(win_vol_serial);
|
||||
} else if (ceph_argparse_witharg(args, i, &max_path_len,
|
||||
"--max-path-len", (char*)NULL)) {
|
||||
unsigned long max_path_length = std::stoul(max_path_len);
|
||||
|
||||
if (max_path_length > 32767) {
|
||||
*err_msg << "ceph-dokan: maximum path length should not "
|
||||
<< "exceed " << 32767;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (max_path_length < 256) {
|
||||
*err_msg << "ceph-dokan: maximum path length should not "
|
||||
<< "have a value lower than 256";
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cfg->max_path_len = max_path_length;
|
||||
} else if (ceph_argparse_flag(args, i, "--current-session-only", (char *)NULL)) {
|
||||
cfg->current_session_only = true;
|
||||
} else if (ceph_argparse_witharg(args, i, &thread_count,
|
||||
|
Loading…
Reference in New Issue
Block a user