[SCM] Samba Shared Repository - branch v3-2-stable updated - release-3-2-0pre2-442-g4ec2bcc

Karolin Seeger kseeger at samba.org
Wed Apr 9 05:57:14 GMT 2008


The branch, v3-2-stable has been updated
       via  4ec2bcc15be8d02ad3d65ec30d6b47b71bb1ffb4 (commit)
      from  d0ed4e1886cf727a2ae9c336235da47bf5a13cdd (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-stable


- Log -----------------------------------------------------------------
commit 4ec2bcc15be8d02ad3d65ec30d6b47b71bb1ffb4
Author: Alexander Bokovoy <ab at samba.org>
Date:   Tue Apr 8 15:19:01 2008 +0400

    Destroy DMAPI session when main smbd daemon exits.
    
    DMAPI session is precious resource maintained at kernel level. We open one of them and use across multiple smbd daemons
    but once last of them exits, DMAPI session needs to be destroyed. There are some HSM implementations which fail to
    shutdown when opened DMAPI sessions left. Ensure we shutdown our session when it is really not needed anymore.
    This is what recommended by DMAPI specification anyway.
    (cherry picked from commit a0cefd44009d414fa00ec6e08c70d21b74acdbcb)

-----------------------------------------------------------------------

Summary of changes:
 source/smbd/dmapi.c  |   24 ++++++++++++++++++++++++
 source/smbd/server.c |    9 +++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/smbd/dmapi.c b/source/smbd/dmapi.c
index fab0d5f..fd252e9 100644
--- a/source/smbd/dmapi.c
+++ b/source/smbd/dmapi.c
@@ -213,6 +213,30 @@ bool dmapi_new_session(void)
 }
 
 /* 
+    only call this when exiting from master smbd process. DMAPI sessions
+    are long-lived kernel resources we ought to share across smbd processes.
+    However, we must free them when all smbd processes are finished to
+    allow other subsystems clean up properly. Not freeing DMAPI session
+    blocks certain HSM implementations from proper shutdown.
+*/
+bool dmapi_destroy_session(void)
+{
+	if (samba_dmapi_session != DM_NO_SESSION) {
+		become_root();
+		if (!dm_destroy_session(samba_dmapi_session)) {
+			session_num--;
+			samba_dmapi_session = DM_NO_SESSION;
+		} else {
+			DEBUG(0,("Couldn't destroy DMAPI session: %s\n",
+				 strerror(errno)));
+		}
+		unbecome_root();
+	}
+	return samba_dmapi_session == DM_NO_SESSION;
+}
+
+
+/* 
    This is default implementation of dmapi_file_flags() that is 
    called from VFS is_offline() call to know whether file is offline.
    For GPFS-specific version see modules/vfs_tsmsm.c. It might be
diff --git a/source/smbd/server.c b/source/smbd/server.c
index 179d480..7a6e171 100644
--- a/source/smbd/server.c
+++ b/source/smbd/server.c
@@ -918,6 +918,15 @@ static void exit_server_common(enum server_exit_reason how,
 	}
 #endif
 
+#ifdef USE_DMAPI
+	/* Destroy Samba DMAPI session only if we are master smbd process */
+	if (am_parent) {
+		if (!dmapi_destroy_session()) {
+			DEBUG(0,("Unable to close Samba DMAPI session\n"));
+		}
+	}
+#endif
+
 	locking_end();
 	printing_end();
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list