summaryrefslogtreecommitdiffstats
path: root/src/dokan (follow)
Commit message (Collapse)AuthorAgeFilesLines
* cmake: targets against legacy-option-headers when appropriateKefu Chai2024-05-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | legacy-option-headers provides the headers included by `src/common/options/legacy_config_opts.h`. these headers are generated from corresponding .yaml.in file. because these headers file are generated at build time, we need to construct the file-level dependencies between the targets using them and these headers, otherwise the compiler could fail to compile the tree if any of the headers are not generated yet, when compiling .cc file which (indirectly) includes it. in order to address this, in this change, we 1. search for all .cc files which have `#include "common/config.h"` in it 2. and find out the targets building the .cc file, then 3. add `legacy-option-headers` to its linkage using CMake this should partially address the above race condition we've been running into on slow build hosts. because we have not audited the .h files including `common/config.h`, this change should be considered a partial fix. Signed-off-by: Kefu Chai <tchaikov@gmail.com>
* Merge pull request #53456 from petrutlucian94/dokan_case_insensitiveVenky Shankar2023-11-283-7/+50
|\ | | | | | | | | dokan: simple case insensitive emulation Reviewed-by: Venky Shankar <vshankar@redhat.com>
| * dokan: simple case insensitive emulationLucian Petrut2023-09-143-7/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While CephFS is case sensitive, Windows software commonly assume that the filesystem is case insensitive. In order to unblock certain use cases, a short term solution is to simply normalize paths when creating or accessing files or directories. This change adds two ceph-dokan parameters: * --case-insensitive: if set, paths are normalized * --force-lowercase: normalized paths are converted to lowercase instead of uppercase This trivial implementation has some limitations: * the original case is not preserved * we could later on use xattr to store the original name * can't access existing files that have a different case * handled at ceph-dokan level The advantage is that it's simple, shouldn't impact performance and doesn't require libcephfs or mds changes. In the future, we may conider a more robust implementation at the mds and/or libcephfs level. Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
* | common: Windows Unicode CLI supportLucian Petrut2023-11-222-1/+4
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Windows CLI arguments use either ANSI (main()) or UTF-16 (wmain()). Meanwhile, Ceph libraries expect UTF-8 and raise exceptions when trying to use Unicode CLI arguments or log Unicode output: rbd.exe create test_unicode_șțăâ --size=32M terminate called after throwing an instance of 'std::runtime_error' what(): invalid utf8 We'll use a Windows application manifest, setting the "activeCodePage" property [1][2]. This enables the Windows UCRT UTF-8 mode so that functions that receive char* arguments will expect UTF-8 instead of ANSI, including main(). One exception is CreateProcess, which will need the UTF-16 form (CreateProcessW). Despite the locale being set to utf-8, we'll have to explicitly set the console output to utf-8 using SetConsoleOutputCP(CP_UTF8). In order to use the UTF-8 locale, we'll have to switch the mingw-llvm runtime from msvcrt to ucrt. This also fixes ceph-dokan crashes that currently occur when non-ANSI paths are logged. [1] https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests#activecodepage [2] https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
* dokan: handle std::stoul exceptionsLucian Petrut2023-04-281-6/+30
| | | | | | | | | | | We're using std::stoul to parse cli args, however we aren't catching the exceptions. This change will handle the exceptions and log the according error message. For consistency, we'll use the std conversion functions throughout ceph-dokan. Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
* rbd-wnbd: optionally handle wnbd adapter restart eventsLucian Petrut2023-03-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | The WNBD adapter may be reset in certain situations (e.g. driver upgrade, MS WHQL tests, etc). We're going to monitor the WNBD adapter using WMI[1] events, restarting the rbd-wnbd disk mappings whenever necessary. Adapter monitoring can be enabled by passing the --adapter-monitoring-enabled flag to the service. This feature is optional for the following reasons: * it's mainly used during development / driver certification * we had to use a relatively small polling interval, which might imply additional resource usage. WMI quotas also have to be considered. While at it, we're updating two lambdas that are submitted to thread pools, avoiding default reference capturing and explicitly specifying the variables that get copied. [1] https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-start-page Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
* common: add win32/wstring.hLucian Petrut2023-03-224-17/+2
| | | | | | | | | | | | | | Windows APIs heavily use wchar. ceph-dokan and rbd-wnbd have some duplicated helpers that convert wstrings to/from utf8 strings. To avoid duplication and allow reusing those helpers, we're moving them to common/win32/wstring.h. We're using the "win32" subfolder because it's unlikely that this will ever be used on other platforms. Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
* Merge pull request #49280 from stefan-chivu/dokan-file-dir-accessVenky Shankar2023-01-193-10/+38
|\ | | | | | | | | dokan: Made file/dir access mode configurable Reviewed-by: Venky Shankar <vshankar@redhat.com>
| * dokan: Made file/dir access mode configurableStefan Chivu2022-12-053-10/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | By default, when mounting a filesystem using ceph-dokan, the file and directory access modes were hardcoded as 755. Now, both the file and directory access modes are configurable using the --file-mode and --dir-mode optargs, accepting values ranging from 001 to 777. If no value is specified, the default value of 755 will be used. Signed-off-by: Stefan Chivu <schivu@cloudbasesolutions.com>
* | dokan: use the right logging subsystemLucian Petrut2022-12-071-2/+2
|/ | | | | | | By mistake, src/dokan/dbg.cc is using the "rbd" logging subsystem. We'll update it to use the "client" subsystem. Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
* ceph-dokan: Made max path length configurableStefan Chivu2022-11-213-1/+31
| | | | | | | | 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>
* common/win32: Fixed function name typoStefan Chivu2022-11-101-23/+23
| | | | | | | | | | There was a typo in the function name cephfs_errno_to_ntsatus defined in common/win32/errno.cc. It has been replaced with cephfs_errno_to_ntstatus_map to avoid conflicts with the existing cephfs_errno_to_ntstatus function. Signed-off-by: Stefan Chivu <schivu@cloudbasesolutions.com>
* ceph-dokan: Exposed --win-vol-serial CLI option for ceph-dokanStefan Chivu2022-11-071-0/+5
| | | | Signed-off-by: Stefan Chivu <schivu@cloudbasesolutions.com>
* dokan: deprecate thread count parameterLucian Petrut2022-08-302-13/+5
| | | | | | | | | | Dokany v2 no longer allows specifying the worker thread count. For this reason, we're deprecating this ceph-dokan parameter. Dokany v2 does allow requesting single thread mode but that's probably not worth exposing. Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
* dokan: use DokanInit() and DokanShutdown()Lucian Petrut2022-08-301-0/+4
| | | | | | | | Dokany v2 requires DokanInit() to be called before DokanMain(). Also, we need to call DokanShutdown() after unmounting the fs. Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
* dokan: cast variable to the expected type before comparisonKefu Chai2022-08-052-2/+2
| | | | | | | | | | | | | | | | | | | | to fix the FTBFS due to following warning: ``` /home/jenkins-build/build/workspace/ceph-windows-pull-requests/ceph/build.deps/src/dokany/dokan/dokan.h:723:22: error: narrowing conversion of '-1' from 'int' to 'long unsigned int' [-Wnarrowing] 723 | #define DOKAN_ERROR -1 | ^ ``` also, clean up the following warning: ``` /home/jenkins-build/build/workspace/ceph-windows-pull-requests/ceph/src/dokan/dbg.cc:142:62: warning: NULL used in arithmetic [-Wpointer-arith] 142 | o << "\n\tIsDirectory: " << (DokanFileInfo->IsDirectory != NULL); | ``` Signed-off-by: Kefu Chai <tchaikov@gmail.com>
* common/win32,dokan: include bcrypt.h for NTSTATUSKefu Chai2022-07-221-1/+1
| | | | | | | | | | | | | | | | | | | | | to avoid the conflicting declaration of NTSTATUS from bcrypt.h and our own typedef. as after switching to boost 1.79, we would have following compiling failure: In file included from ../src/dokan/options.cc:14: ../src/dokan/ceph_dokan.h:16:15: error: conflicting declaration 'typedef DWORD NTSTATUS' 16 | typedef DWORD NTSTATUS; | ^~~~~~~~ In file included from ../build.deps/mingw/boost/include/boost/asio/impl/connect_pipe.ipp:29, from ../build.deps/mingw/boost/include/boost/asio/connect_pipe.hpp:79, from ../build.deps/mingw/boost/include/boost/asio.hpp:64, from ../src/include/win32/winsock_wrapper.h:20, from <command-line>: /usr/share/mingw-w64/include/bcrypt.h:27:16: note: previous declaration as 'typedef LONG NTSTATUS' 27 | typedef LONG NTSTATUS,*PNTSTATUS; | ^~~~~~~~ Signed-off-by: Kefu Chai <tchaikov@gmail.com>
* common: modify 'main()s' to use new argv_to_vec() signatureRonen Friedman2021-08-191-4/+2
| | | | | | | A followup to PR #42820 that modified argv_to_vec() signature (for style and performance). Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
* dokan: : build without "using namespace std"Kefu Chai2021-08-131-0/+1
| | | | | | | | | * add "using" declarations in .cc files. so we don't rely on "using namespace std" in one or more included headers. Signed-off-by: Kefu Chai <kchai@redhat.com>
* cephfs: ceph-dokan - properly log the mounted rootLucian Petrut2021-04-012-2/+2
| | | | | | | | | This is a simple change that updates the logged mounted directory. We're incorrectly using "ceph_getcwd" instead of the actual root path. Fixes: https://tracker.ceph.com/issues/49662 Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
* cephfs: Update ceph-dokan "--removable" flagLucian Petrut2021-04-011-2/+2
| | | | | | | | | | | "-m" is the short option for "--removable". We tried to keep the syntax as close as possible to the old ceph-dokan project but this flag is already used. We'll drop the short option, keeping the long one ("--removable"). Fixes: https://tracker.ceph.com/issues/49662 Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
* cephfs: provide additional volume details on WindowsLucian Petrut2021-04-013-4/+52
| | | | | | | | | | | | | At the moment, the Windows volume name and serial number are hardcoded. This change makes the volume name configurable, defaulting to "Ceph" or "Ceph - <fs_name>". This makes it easier to identify Ceph mounts. At the same time, we're going to retrieve the Ceph filesystem identifier instead of using the hardcoded value. Fixes: https://tracker.ceph.com/issues/49662 Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
* cephfs: add ceph-dokan unmap commandLucian Petrut2021-04-013-5/+27
| | | | | | | | | | | | | At the moment, Windows CephFS mounts can only be removed by terminating the daemon (e.g. sending CTRL-C) or through the Windows mount manager if the "-o -m" parameters were passed when the mapping was created. This change adds the "ceph-dokan unmap" command, which takes the mountpoint as input. Fixes: https://tracker.ceph.com/issues/49662 Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
* cephfs: Add ceph-dokan, providing Windows supportLucian Petrut2021-03-058-0/+1533
In order to expose ceph filesystems to Windows hosts, we propose including ceph-dokan[1][2] in the Ceph tree, while updating it to work with the latest CephFS and Dokany APIs. Dokany is a well maintained project (fork of the original Dokan project), allowing filesystems to be implemented in userspace, even providing a Fuse compatibility layer. One reason for not using the FUSE compatibility layer is that it's only covering the high level API while Ceph is using the low level FUSE API, which among other things is inode centric. Changes made by this patch compared to the upstream ceph-dokan: * support latest stable Dokany API. The upstream version relies on the legacy unmaintained Dokan API * return proper error codes, converting standard errno.h values to NTSTATUS * minor changes to support latest cephfs API * drop duplicated ceph code, no longer needed if we're to include it in tree. This makes it much easier to maintain. * drop redundant permission checks, leaving it up to libcephfs * use ceph argparse helpers * use ceph logging and daemon initialization * fixed unicode handling * switched to ceph coding style * made ceph.conf param optional, using the default path if available * enabled setting file timestamps * append support * configurable timeouts set once per mount * ensure that the error code is always logged * various cleanups (removed unused entry points, checks that have been moved to dokany, simplified conditional statements, unnecessary conversions in the hot path, etc). [1] https://github.com/ketor/ceph-dokan [2] https://github.com/ceph/ceph-dokan Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>