2 Unix SMB/CIFS implementation.
4 Copyright (C) Andrew Tridgell 1992-2000
5 Copyright (C) Jeremy Allison 1992-2006
6 Copyright (C) Volker Lendecke 2005
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 12 aug 96: Erik.Devriendt@te6.siemens.be
24 added support for shared memory implementation of share mode locking
26 May 1997. Jeremy Allison (jallison@whistle.com). Modified share mode
27 locking to deal with multiple share modes per open file.
29 September 1997. Jeremy Allison (jallison@whistle.com). Added oplock
32 rewritten completely to use new tdb code. Tridge, Dec '99
34 Added POSIX locking support. Jeremy Allison (jeremy@valinux.com), Apr. 2000.
35 Added Unix Extensions POSIX locking support. Jeremy Allison Mar 2006.
39 #include "system/filesys.h"
40 #include "lib/util/server_id.h"
41 #include "locking/proto.h"
42 #include "smbd/globals.h"
43 #include "dbwrap/dbwrap.h"
44 #include "dbwrap/dbwrap_open.h"
45 #include "../libcli/security/security.h"
49 #include "../librpc/gen_ndr/ndr_open_files.h"
50 #include "source3/lib/dbwrap/dbwrap_watch.h"
51 #include "locking/leases_db.h"
52 #include "../lib/util/memcache.h"
53 #include "lib/util/tevent_ntstatus.h"
56 #define DBGC_CLASS DBGC_LOCKING
58 #define NO_LOCKING_COUNT (-1)
60 /* the locking database handle */
61 static struct db_context *lock_db;
63 static bool locking_init_internal(bool read_only)
65 struct db_context *backend;
73 db_path = lock_path(talloc_tos(), "locking.tdb");
74 if (db_path == NULL) {
78 backend = db_open(NULL, db_path,
79 SMB_OPEN_DATABASE_TDB_HASH_SIZE,
80 TDB_DEFAULT|TDB_VOLATILE|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
81 read_only?O_RDONLY:O_RDWR|O_CREAT, 0644,
82 DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
85 DEBUG(0,("ERROR: Failed to initialise locking database\n"));
89 lock_db = db_open_watched(NULL, &backend, global_messaging_context());
90 if (lock_db == NULL) {
91 DBG_ERR("db_open_watched failed\n");
96 if (!posix_locking_init(read_only)) {
104 bool locking_init(void)
106 return locking_init_internal(false);
109 bool locking_init_readonly(void)
111 return locking_init_internal(true);
114 /*******************************************************************
115 Deinitialize the share_mode management.
116 ******************************************************************/
118 bool locking_end(void)
121 TALLOC_FREE(lock_db);
125 /*******************************************************************
126 Form a static locking key for a dev/inode pair.
127 ******************************************************************/
129 static TDB_DATA locking_key(const struct file_id *id)
131 return make_tdb_data((const uint8_t *)id, sizeof(*id));
134 /*******************************************************************
135 Share mode cache utility functions that store/delete/retrieve
136 entries from memcache.
138 For now share the statcache (global cache) memory space. If
139 a lock record gets orphaned (which shouldn't happen as we're
140 using the same locking_key data as lookup) it will eventually
141 fall out of the cache via the normal LRU trim mechanism. If
142 necessary we can always make this a separate (smaller) cache.
143 ******************************************************************/
145 static DATA_BLOB memcache_key(const struct file_id *id)
147 return data_blob_const((const void *)id, sizeof(*id));
150 static void share_mode_memcache_store(struct share_mode_data *d)
152 const DATA_BLOB key = memcache_key(&d->id);
154 DBG_DEBUG("stored entry for file %s seq %"PRIx64" key %s\n",
157 file_id_string(talloc_tos(), &d->id));
159 /* Ensure everything stored in the cache is pristine. */
164 * Ensure the memory going into the cache
165 * doesn't have a destructor so it can be
166 * cleanly evicted by the memcache LRU
169 talloc_set_destructor(d, NULL);
171 /* Cache will own d after this call. */
172 memcache_add_talloc(NULL,
173 SHARE_MODE_LOCK_CACHE,
179 * NB. We use ndr_pull_hyper on a stack-created
180 * struct ndr_pull with no talloc allowed, as we
181 * need this to be really fast as an ndr-peek into
182 * the first 8 bytes of the blob.
185 static enum ndr_err_code get_blob_sequence_number(DATA_BLOB *blob,
188 struct ndr_pull ndr = {.data = blob->data, .data_size = blob->length};
189 NDR_CHECK(ndr_pull_hyper(&ndr, NDR_SCALARS, pseq));
190 return NDR_ERR_SUCCESS;
193 static int share_mode_data_nofree_destructor(struct share_mode_data *d)
198 static struct share_mode_data *share_mode_memcache_fetch(TALLOC_CTX *mem_ctx,
199 const TDB_DATA id_key,
202 enum ndr_err_code ndr_err;
203 struct share_mode_data *d;
204 uint64_t sequence_number;
209 /* Ensure this is a locking_key record. */
210 if (id_key.dsize != sizeof(id)) {
214 memcpy(&id, id_key.dptr, id_key.dsize);
215 key = memcache_key(&id);
217 ptr = memcache_lookup_talloc(NULL,
218 SHARE_MODE_LOCK_CACHE,
221 DEBUG(10,("failed to find entry for key %s\n",
222 file_id_string(mem_ctx, &id)));
225 /* sequence number key is at start of blob. */
226 ndr_err = get_blob_sequence_number(blob, &sequence_number);
227 if (ndr_err != NDR_ERR_SUCCESS) {
228 /* Bad blob. Remove entry. */
229 DEBUG(10,("bad blob %u key %s\n",
230 (unsigned int)ndr_err,
231 file_id_string(mem_ctx, &id)));
232 memcache_delete(NULL,
233 SHARE_MODE_LOCK_CACHE,
238 d = (struct share_mode_data *)ptr;
239 if (d->sequence_number != sequence_number) {
240 DBG_DEBUG("seq changed (cached %"PRIx64") (new %"PRIx64") "
244 file_id_string(mem_ctx, &id));
245 /* Cache out of date. Remove entry. */
246 memcache_delete(NULL,
247 SHARE_MODE_LOCK_CACHE,
252 /* Move onto mem_ctx. */
253 d = talloc_move(mem_ctx, &ptr);
256 * Now we own d, prevent the cache from freeing it
257 * when we delete the entry.
259 talloc_set_destructor(d, share_mode_data_nofree_destructor);
261 /* Remove from the cache. We own it now. */
262 memcache_delete(NULL,
263 SHARE_MODE_LOCK_CACHE,
266 /* And reset the destructor to none. */
267 talloc_set_destructor(d, NULL);
269 DBG_DEBUG("fetched entry for file %s seq %"PRIx64" key %s\n",
272 file_id_string(mem_ctx, &id));
277 /*******************************************************************
278 Get all share mode entries for a dev/inode pair.
279 ********************************************************************/
281 static struct share_mode_data *parse_share_modes(TALLOC_CTX *mem_ctx,
285 struct share_mode_data *d;
286 enum ndr_err_code ndr_err;
289 blob.data = dbuf.dptr;
290 blob.length = dbuf.dsize;
292 /* See if we already have a cached copy of this key. */
293 d = share_mode_memcache_fetch(mem_ctx, key, &blob);
298 d = talloc(mem_ctx, struct share_mode_data);
300 DEBUG(0, ("talloc failed\n"));
304 ndr_err = ndr_pull_struct_blob_all(
305 &blob, d, d, (ndr_pull_flags_fn_t)ndr_pull_share_mode_data);
306 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
307 DBG_WARNING("ndr_pull_share_mode_data failed: %s\n",
308 ndr_errstr(ndr_err));
312 if (DEBUGLEVEL >= 10) {
313 DEBUG(10, ("parse_share_modes:\n"));
314 NDR_PRINT_DEBUG(share_mode_data, d);
323 /*******************************************************************
324 If modified, store the share_mode_data back into the database.
325 ********************************************************************/
327 static NTSTATUS share_mode_data_store(struct share_mode_data *d)
330 enum ndr_err_code ndr_err;
334 DBG_DEBUG("not modified\n");
338 if (DEBUGLEVEL >= 10) {
340 NDR_PRINT_DEBUG(share_mode_data, d);
343 d->sequence_number += 1;
344 remove_stale_share_mode_entries(d);
346 if (d->num_share_modes == 0) {
348 DBG_DEBUG("Ignoring fresh emtpy record\n");
351 status = dbwrap_record_delete(d->record);
355 ndr_err = ndr_push_struct_blob(
356 &blob, d, d, (ndr_push_flags_fn_t)ndr_push_share_mode_data);
357 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
358 DBG_DEBUG("ndr_push_share_mode_data failed: %s\n",
359 ndr_errstr(ndr_err));
360 return ndr_map_error2ntstatus(ndr_err);
363 status = dbwrap_record_store(
365 (TDB_DATA) { .dptr = blob.data, .dsize = blob.length },
367 TALLOC_FREE(blob.data);
369 if (!NT_STATUS_IS_OK(status)) {
370 DBG_DEBUG("dbwrap_record_store failed: %s\n",
377 /*******************************************************************
378 Allocate a new share_mode_data struct, mark it unmodified.
379 fresh is set to note that currently there is no database entry.
380 ********************************************************************/
382 static struct share_mode_data *fresh_share_mode_lock(
383 TALLOC_CTX *mem_ctx, const char *servicepath,
384 const struct smb_filename *smb_fname,
385 const struct timespec *old_write_time)
387 struct share_mode_data *d;
389 if ((servicepath == NULL) || (smb_fname == NULL) ||
390 (old_write_time == NULL)) {
394 d = talloc_zero(mem_ctx, struct share_mode_data);
398 /* New record - new sequence number. */
399 generate_random_buffer((uint8_t *)&d->sequence_number, 8);
401 d->base_name = talloc_strdup(d, smb_fname->base_name);
402 if (d->base_name == NULL) {
405 if (smb_fname->stream_name != NULL) {
406 d->stream_name = talloc_strdup(d, smb_fname->stream_name);
407 if (d->stream_name == NULL) {
411 d->servicepath = talloc_strdup(d, servicepath);
412 if (d->servicepath == NULL) {
415 d->old_write_time = *old_write_time;
420 DEBUG(0, ("talloc failed\n"));
426 * We can only ever have one share mode locked. Use a static
427 * share_mode_data pointer that is shared by multiple nested
428 * share_mode_lock structures, explicitly refcounted.
430 static struct share_mode_data *static_share_mode_data = NULL;
431 static size_t static_share_mode_data_refcount = 0;
433 /*******************************************************************
434 Either fetch a share mode from the database, or allocate a fresh
435 one if the record doesn't exist.
436 ********************************************************************/
438 static NTSTATUS get_static_share_mode_data(
439 struct db_record *rec,
441 const char *servicepath,
442 const struct smb_filename *smb_fname,
443 const struct timespec *old_write_time)
445 struct share_mode_data *d;
446 TDB_DATA value = dbwrap_record_get_value(rec);
448 SMB_ASSERT(static_share_mode_data == NULL);
450 if (value.dptr == NULL) {
451 d = fresh_share_mode_lock(
452 lock_db, servicepath, smb_fname, old_write_time);
454 return NT_STATUS_NO_MEMORY;
457 TDB_DATA key = locking_key(&id);
458 d = parse_share_modes(lock_db, key, value);
460 return NT_STATUS_INTERNAL_DB_CORRUPTION;
467 static_share_mode_data = d;
472 /*******************************************************************
473 Get a share_mode_lock, Reference counted to allow nested calls.
474 ********************************************************************/
476 static int share_mode_lock_destructor(struct share_mode_lock *lck);
478 struct share_mode_lock *get_share_mode_lock(
481 const char *servicepath,
482 const struct smb_filename *smb_fname,
483 const struct timespec *old_write_time)
485 TDB_DATA key = locking_key(&id);
486 struct db_record *rec = NULL;
487 struct share_mode_lock *lck = NULL;
490 lck = talloc(mem_ctx, struct share_mode_lock);
492 DEBUG(1, ("talloc failed\n"));
496 if (static_share_mode_data != NULL) {
497 if (!file_id_equal(&static_share_mode_data->id, &id)) {
498 DEBUG(1, ("Can not lock two share modes "
499 "simultaneously\n"));
505 SMB_ASSERT(static_share_mode_data_refcount == 0);
507 rec = dbwrap_fetch_locked(lock_db, lock_db, key);
509 DEBUG(3, ("Could not lock share entry\n"));
513 status = get_static_share_mode_data(
514 rec, id, servicepath, smb_fname, old_write_time);
515 if (!NT_STATUS_IS_OK(status)) {
516 DBG_WARNING("get_static_share_mode_data failed: %s\n",
523 * This is unnecessary, in share_mode_lock_destructor we
524 * explicitly TALLOC_FREE lck->data->rec. Leave it here as
525 * it's cleaner in the talloc report.
527 talloc_reparent(lock_db, static_share_mode_data, rec);
530 static_share_mode_data_refcount += 1;
531 lck->data = static_share_mode_data;
533 talloc_set_destructor(lck, share_mode_lock_destructor);
541 static int share_mode_lock_destructor(struct share_mode_lock *lck)
545 SMB_ASSERT(static_share_mode_data_refcount > 0);
546 static_share_mode_data_refcount -= 1;
548 if (static_share_mode_data_refcount > 0) {
552 status = share_mode_data_store(static_share_mode_data);
553 if (!NT_STATUS_IS_OK(status)) {
554 DBG_ERR("share_mode_data_store failed: %s\n",
556 smb_panic("Could not store share mode data\n");
560 * Drop the locking.tdb lock before moving the share_mode_data
563 TALLOC_FREE(static_share_mode_data->record);
565 if (static_share_mode_data->num_share_modes != 0) {
567 * This is worth keeping. Without share modes,
568 * share_mode_data_store above has left nothing in the
571 share_mode_memcache_store(static_share_mode_data);
572 static_share_mode_data = NULL;
575 * The next opener of this file will find an empty
576 * locking.tdb record. Don't store the share_mode_data
577 * in the memcache, fresh_share_mode_lock() will
578 * generate a fresh seqnum anyway, obsoleting the
581 TALLOC_FREE(static_share_mode_data);
587 struct fetch_share_mode_unlocked_state {
589 struct share_mode_lock *lck;
592 static void fetch_share_mode_unlocked_parser(
593 TDB_DATA key, TDB_DATA data, void *private_data)
595 struct fetch_share_mode_unlocked_state *state = private_data;
597 if (data.dsize == 0) {
598 /* Likely a ctdb tombstone record, ignore it */
602 state->lck = talloc(state->mem_ctx, struct share_mode_lock);
603 if (state->lck == NULL) {
604 DEBUG(0, ("talloc failed\n"));
608 state->lck->data = parse_share_modes(state->lck, key, data);
611 /*******************************************************************
612 Get a share_mode_lock without locking the database or reference
613 counting. Used by smbstatus to display existing share modes.
614 ********************************************************************/
616 struct share_mode_lock *fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx,
619 struct fetch_share_mode_unlocked_state state = { .mem_ctx = mem_ctx };
620 TDB_DATA key = locking_key(&id);
623 status = dbwrap_parse_record(
624 lock_db, key, fetch_share_mode_unlocked_parser, &state);
625 if (!NT_STATUS_IS_OK(status)) {
631 static void fetch_share_mode_done(struct tevent_req *subreq);
633 struct fetch_share_mode_state {
636 struct fetch_share_mode_unlocked_state parser_state;
637 enum dbwrap_req_state req_state;
641 * @brief Get a share_mode_lock without locking or refcounting
643 * This can be used in a clustered Samba environment where the async dbwrap
644 * request is sent over a socket to the local ctdbd. If the send queue is full
645 * and the caller was issuing multiple async dbwrap requests in a loop, the
646 * caller knows it's probably time to stop sending requests for now and try
649 * @param[in] mem_ctx The talloc memory context to use.
651 * @param[in] ev The event context to work on.
653 * @param[in] id The file id for the locking.tdb key
655 * @param[out] queued This boolean out parameter tells the caller whether the
656 * async request is blocked in a full send queue:
658 * false := request is dispatched
660 * true := send queue is full, request waiting to be
663 * @return The new async request, NULL on error.
665 struct tevent_req *fetch_share_mode_send(TALLOC_CTX *mem_ctx,
666 struct tevent_context *ev,
670 struct tevent_req *req = NULL;
671 struct fetch_share_mode_state *state = NULL;
672 struct tevent_req *subreq = NULL;
676 req = tevent_req_create(mem_ctx, &state,
677 struct fetch_share_mode_state);
683 state->key = locking_key(&state->id);
684 state->parser_state.mem_ctx = state;
686 subreq = dbwrap_parse_record_send(state,
690 fetch_share_mode_unlocked_parser,
691 &state->parser_state,
693 if (tevent_req_nomem(subreq, req)) {
694 return tevent_req_post(req, ev);
696 tevent_req_set_callback(subreq, fetch_share_mode_done, req);
698 if (state->req_state < DBWRAP_REQ_DISPATCHED) {
704 static void fetch_share_mode_done(struct tevent_req *subreq)
706 struct tevent_req *req = tevent_req_callback_data(
707 subreq, struct tevent_req);
710 status = dbwrap_parse_record_recv(subreq);
712 if (tevent_req_nterror(req, status)) {
716 tevent_req_done(req);
720 NTSTATUS fetch_share_mode_recv(struct tevent_req *req,
722 struct share_mode_lock **_lck)
724 struct fetch_share_mode_state *state = tevent_req_data(
725 req, struct fetch_share_mode_state);
726 struct share_mode_lock *lck = NULL;
730 if (tevent_req_is_nterror(req, &status)) {
731 tevent_req_received(req);
735 if (state->parser_state.lck->data == NULL) {
736 tevent_req_received(req);
737 return NT_STATUS_NOT_FOUND;
740 lck = talloc_move(mem_ctx, &state->parser_state.lck);
742 if (DEBUGLEVEL >= 10) {
743 DBG_DEBUG("share_mode_data:\n");
744 NDR_PRINT_DEBUG(share_mode_data, lck->data);
748 tevent_req_received(req);
752 struct share_mode_forall_state {
753 int (*fn)(struct file_id fid, const struct share_mode_data *data,
758 static int share_mode_traverse_fn(struct db_record *rec, void *_state)
760 struct share_mode_forall_state *state =
761 (struct share_mode_forall_state *)_state;
765 enum ndr_err_code ndr_err;
766 struct share_mode_data *d;
770 key = dbwrap_record_get_key(rec);
771 value = dbwrap_record_get_value(rec);
773 /* Ensure this is a locking_key record. */
774 if (key.dsize != sizeof(fid)) {
777 memcpy(&fid, key.dptr, sizeof(fid));
779 d = talloc(talloc_tos(), struct share_mode_data);
784 blob.data = value.dptr;
785 blob.length = value.dsize;
787 ndr_err = ndr_pull_struct_blob_all(
788 &blob, d, d, (ndr_pull_flags_fn_t)ndr_pull_share_mode_data);
789 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
790 DEBUG(1, ("ndr_pull_share_mode_lock failed\n"));
794 if (DEBUGLEVEL > 10) {
795 DEBUG(11, ("parse_share_modes:\n"));
796 NDR_PRINT_DEBUG(share_mode_data, d);
799 ret = state->fn(fid, d, state->private_data);
805 int share_mode_forall(int (*fn)(struct file_id fid,
806 const struct share_mode_data *data,
810 struct share_mode_forall_state state = {
812 .private_data = private_data
817 if (lock_db == NULL) {
821 status = dbwrap_traverse_read(lock_db, share_mode_traverse_fn,
823 if (!NT_STATUS_IS_OK(status)) {
830 struct share_entry_forall_state {
831 int (*fn)(struct file_id fid,
832 const struct share_mode_data *data,
833 const struct share_mode_entry *entry,
838 static int share_entry_traverse_fn(struct file_id fid,
839 const struct share_mode_data *data,
842 struct share_entry_forall_state *state = private_data;
845 for (i=0; i<data->num_share_modes; i++) {
850 &data->share_modes[i],
851 state->private_data);
860 /*******************************************************************
861 Call the specified function on each entry under management by the
863 ********************************************************************/
865 int share_entry_forall(int (*fn)(struct file_id fid,
866 const struct share_mode_data *data,
867 const struct share_mode_entry *entry,
871 struct share_entry_forall_state state = {
872 .fn = fn, .private_data = private_data };
874 return share_mode_forall(share_entry_traverse_fn, &state);
877 static bool cleanup_disconnected_lease(struct share_mode_lock *lck,
878 struct share_mode_entry *e,
881 struct share_mode_data *d = lck->data;
884 status = leases_db_del(&e->client_guid, &e->lease_key, &d->id);
886 if (!NT_STATUS_IS_OK(status)) {
887 DBG_DEBUG("leases_db_del failed: %s\n",
894 bool share_mode_cleanup_disconnected(struct file_id fid,
895 uint64_t open_persistent_id)
898 TALLOC_CTX *frame = talloc_stackframe();
900 struct share_mode_data *data;
901 struct share_mode_lock *lck;
904 lck = get_existing_share_mode_lock(frame, fid);
906 DEBUG(5, ("share_mode_cleanup_disconnected: "
907 "Could not fetch share mode entry for %s\n",
908 file_id_string(frame, &fid)));
913 for (n=0; n < data->num_share_modes; n++) {
914 struct share_mode_entry *entry = &data->share_modes[n];
916 if (!server_id_is_disconnected(&entry->pid)) {
917 struct server_id_buf tmp;
918 DEBUG(5, ("share_mode_cleanup_disconnected: "
919 "file (file-id='%s', servicepath='%s', "
920 "base_name='%s%s%s') "
921 "is used by server %s ==> do not cleanup\n",
922 file_id_string(frame, &fid),
925 (data->stream_name == NULL)
926 ? "" : "', stream_name='",
927 (data->stream_name == NULL)
928 ? "" : data->stream_name,
929 server_id_str_buf(entry->pid, &tmp)));
932 if (open_persistent_id != entry->share_file_id) {
933 DBG_INFO("entry for file "
934 "(file-id='%s', servicepath='%s', "
935 "base_name='%s%s%s') "
936 "has share_file_id %"PRIu64" but expected "
937 "%"PRIu64"==> do not cleanup\n",
938 file_id_string(frame, &fid),
941 (data->stream_name == NULL)
942 ? "" : "', stream_name='",
943 (data->stream_name == NULL)
944 ? "" : data->stream_name,
945 entry->share_file_id,
951 ok = share_mode_forall_leases(lck, cleanup_disconnected_lease, NULL);
953 DBG_DEBUG("failed to clean up leases associated "
954 "with file (file-id='%s', servicepath='%s', "
955 "base_name='%s%s%s') and open_persistent_id %"PRIu64" "
956 "==> do not cleanup\n",
957 file_id_string(frame, &fid),
960 (data->stream_name == NULL)
961 ? "" : "', stream_name='",
962 (data->stream_name == NULL)
963 ? "" : data->stream_name,
967 ok = brl_cleanup_disconnected(fid, open_persistent_id);
969 DBG_DEBUG("failed to clean up byte range locks associated "
970 "with file (file-id='%s', servicepath='%s', "
971 "base_name='%s%s%s') and open_persistent_id %"PRIu64" "
972 "==> do not cleanup\n",
973 file_id_string(frame, &fid),
976 (data->stream_name == NULL)
977 ? "" : "', stream_name='",
978 (data->stream_name == NULL)
979 ? "" : data->stream_name,
984 DBG_DEBUG("cleaning up %u entries for file "
985 "(file-id='%s', servicepath='%s', "
986 "base_name='%s%s%s') "
987 "from open_persistent_id %"PRIu64"\n",
988 data->num_share_modes,
989 file_id_string(frame, &fid),
992 (data->stream_name == NULL)
993 ? "" : "', stream_name='",
994 (data->stream_name == NULL)
995 ? "" : data->stream_name,
998 data->num_share_modes = 0;
999 data->modified = true;