summaryrefslogtreecommitdiff
path: root/src/ceph_fuse.cc
diff options
context:
space:
mode:
authorSam Lang <sam.lang@inktank.com>2012-12-05 23:21:12 -0600
committerSage Weil <sage@inktank.com>2012-12-27 16:55:27 -0800
commit856f32ab26432659cfd39e9090dd87b5ef4070b1 (patch)
treea16f5c62f7a21d0505bb55d8ff2637e4f0f62909 /src/ceph_fuse.cc
parentaf37cc3a8758ae032519e3da5da973e23a2d1b11 (diff)
downloadceph-856f32ab26432659cfd39e9090dd87b5ef4070b1.tar.gz
ceph-fuse: Split main into init/main/finalize
With the invalidate callback enabled for fuse, the Client::unmount call requires the fuse channel and session objects remain for performing the invalidate callbacks. This patch splits the ceph_fuse_ll_main call into init, main, and finalize functions, so finalization of the channel and session objects can be done after the unmount completes. The patch includes cleanup for the code in fuse_ll.cc to make it more in the style of C++ and make use of the pimpl idiom to hide the fuse structures within the CephFuse::Handle pimpl class. Signed-off-by: Sam Lang <sam.lang@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'src/ceph_fuse.cc')
-rw-r--r--src/ceph_fuse.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/ceph_fuse.cc b/src/ceph_fuse.cc
index 09aadb4c761..f0b080bb6e1 100644
--- a/src/ceph_fuse.cc
+++ b/src/ceph_fuse.cc
@@ -130,6 +130,8 @@ int main(int argc, const char **argv, const char *envp[]) {
if (restart_log)
g_ceph_context->_log->start();
+ CephFuse cfuse(client, fd[1]);
+
cout << "ceph-fuse[" << getpid() << "]: starting ceph client" << std::endl;
int r = messenger->start();
if (r < 0) {
@@ -151,14 +153,19 @@ int main(int argc, const char **argv, const char *envp[]) {
cerr << "ceph-fuse[" << getpid() << "]: ceph mount failed with " << cpp_strerror(-r) << std::endl;
goto out_shutdown;
}
-
+
+ r = cfuse.init(newargc, newargv);
+ if (r < 0) {
+ cerr << "ceph-fuse[" << getpid() << "]: fuse failed to initialize" << std::endl;
+ goto out_shutdown;
+ }
cerr << "ceph-fuse[" << getpid() << "]: starting fuse" << std::endl;
- r = ceph_fuse_ll_main(client, newargc, newargv, fd[1]);
+ r = cfuse.loop();
cerr << "ceph-fuse[" << getpid() << "]: fuse finished with error " << r << std::endl;
-
+
client->unmount();
//cout << "unmounted" << std::endl;
-
+
out_shutdown:
client->shutdown();
out_init_failed: