diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-08-03 16:31:32 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-09-08 03:39:06 +0200 |
commit | 9a81f8ee1713317262f3fc773dae38cb51816149 (patch) | |
tree | 83cac3f7003173d6244ba71973bdef7e95fe00f4 /source3 | |
parent | bc296053cba15869d3417f6089bd2e7e96d42c09 (diff) | |
download | samba-9a81f8ee1713317262f3fc773dae38cb51816149.tar.gz |
s3:locking: add mark_share_mode_disconnected()
Pair-Programmed-With: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/locking/locking.c | 38 | ||||
-rw-r--r-- | source3/locking/proto.h | 2 |
2 files changed, 40 insertions, 0 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c index d3ab7f31408..a7fc50c5a98 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -811,6 +811,44 @@ bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp) return True; } +bool mark_share_mode_disconnected(struct share_mode_lock *lck, + struct files_struct *fsp) +{ + struct share_mode_entry entry, *e; + + if (lck->data->num_share_modes != 1) { + return false; + } + + if (fsp->op == NULL) { + return false; + } + if (!fsp->op->global->durable) { + return false; + } + + /* Don't care about the pid owner being correct here - just a search. */ + fill_share_mode_entry(&entry, fsp, (uid_t)-1, 0, NO_OPLOCK); + + e = find_share_mode_entry(lck->data, &entry); + if (e == NULL) { + return false; + } + + DEBUG(10, ("Marking share mode entry disconnected for durable handle\n")); + + server_id_set_disconnected(&e->pid); + + /* + * On reopen the caller needs to check that + * the client comes with the correct handle. + */ + e->share_file_id = fsp->op->global->open_persistent_id; + + lck->data->modified = true; + return true; +} + void del_deferred_open_entry(struct share_mode_lock *lck, uint64_t mid, struct server_id pid) { diff --git a/source3/locking/proto.h b/source3/locking/proto.h index 74cf32379f4..41c5a856967 100644 --- a/source3/locking/proto.h +++ b/source3/locking/proto.h @@ -175,6 +175,8 @@ void add_deferred_open(struct share_mode_lock *lck, uint64_t mid, struct timeval request_time, struct server_id pid, struct file_id id); bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp); +bool mark_share_mode_disconnected(struct share_mode_lock *lck, + struct files_struct *fsp); void del_deferred_open_entry(struct share_mode_lock *lck, uint64_t mid, struct server_id pid); bool remove_share_oplock(struct share_mode_lock *lck, files_struct *fsp); |