diff options
author | Jeremy Allison <jra@samba.org> | 2000-04-28 01:01:07 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2000-04-28 01:01:07 +0000 |
commit | f8e5696bd6d839dee9c98640519efe2f2512df99 (patch) | |
tree | ef2a5b8e239b0c3f827140e10c4c28cc91b1d046 /source3/locking | |
parent | be828fcec88a43306ddfb53473fda52df1d9965b (diff) | |
download | samba-f8e5696bd6d839dee9c98640519efe2f2512df99.tar.gz samba-f8e5696bd6d839dee9c98640519efe2f2512df99.tar.bz2 samba-f8e5696bd6d839dee9c98640519efe2f2512df99.zip |
Added optimization where we are single opener (don't free POSIX locks).
Jeremy.
(This used to be commit a2deb91128d59ad04f4ec858ffe4e30f2afb0edd)
Diffstat (limited to 'source3/locking')
-rw-r--r-- | source3/locking/locking.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c index d69ab18006..62304076af 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -772,6 +772,26 @@ void locking_close_file(files_struct *fsp) struct unlock_list *ul = NULL; int eclass; uint32 ecode; + struct pending_closes *pc; + + /* + * Optimization for the common case where we are the only + * opener of a file. If all fd entries are our own, we don't + * need to explicitly release all the locks via the POSIX functions, + * we can just release all the brl locks, as in the no POSIX locking case. + */ + + if ((pc = find_pending_close_entry(fsp->dev, fsp->inode)) != NULL) { + + if (pc->fd_array_size == 1 && pc->fd_array[0] == fsp->fd ) { + /* + * Just release all the brl locks, no need to release individually. + */ + + brl_close(fsp->dev, fsp->inode, pid, fsp->conn->cnum, fsp->fnum); + return; + } + } if ((ul_ctx = talloc_init()) == NULL) { DEBUG(0,("locking_close_file: unable to init talloc context.\n")); @@ -802,7 +822,7 @@ void locking_close_file(files_struct *fsp) } else { /* - * Just release all the tdb locks, no need to release individually. + * Just release all the brl locks, no need to release individually. */ brl_close(fsp->dev, fsp->inode, pid, fsp->conn->cnum, fsp->fnum); |