s3:locking: cleanup leases_db from share_mode_cleanup_disconnected()
authorStefan Metzmacher <metze@samba.org>
Thu, 27 Nov 2014 18:32:46 +0000 (19:32 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 4 Dec 2014 04:45:09 +0000 (05:45 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/locking/share_mode_lock.c

index 2ae7c3373b39c965825eefda6e031800cb7b563d..138950fc068b20f2972848b0a8e611cd95352dee 100644 (file)
@@ -47,6 +47,7 @@
 #include "util_tdb.h"
 #include "../librpc/gen_ndr/ndr_open_files.h"
 #include "source3/lib/dbwrap/dbwrap_watch.h"
+#include "locking/leases_db.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_LOCKING
@@ -638,6 +639,16 @@ bool share_mode_cleanup_disconnected(struct file_id fid,
                }
        }
 
+       for (n=0; n < data->num_leases; n++) {
+               struct share_mode_lease *l = &data->leases[n];
+               NTSTATUS status;
+
+               status = leases_db_del(&l->client_guid, &l->lease_key, &fid);
+
+               DEBUG(10, ("%s: leases_db_del returned %s\n", __func__,
+                          nt_errstr(status)));
+       }
+
        ok = brl_cleanup_disconnected(fid, open_persistent_id);
        if (!ok) {
                DEBUG(10, ("share_mode_cleanup_disconnected: "
@@ -672,6 +683,7 @@ bool share_mode_cleanup_disconnected(struct file_id fid,
                   (unsigned long long)open_persistent_id));
 
        data->num_share_modes = 0;
+       data->num_leases = 0;
        data->modified = true;
 
        ret = true;