summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-02-21 20:01:25 +0100
committerStefan Metzmacher <metze@samba.org>2008-02-25 07:56:18 +0100
commitf56ff422a525fc6fdf04de8e2ce5c5fa4c097629 (patch)
treeba315d3f9e0ecb16c9ce7ed14e0041625e0578be
parent1cd2008aa49d38792f273bb28922d33b5b9b0066 (diff)
downloadsamba-f56ff422a525fc6fdf04de8e2ce5c5fa4c097629.tar.gz
samba-f56ff422a525fc6fdf04de8e2ce5c5fa4c097629.tar.bz2
samba-f56ff422a525fc6fdf04de8e2ce5c5fa4c097629.zip
pvfs: handle SHARING_VIOLATION and OPLOCK_NOT_GRANTED in pvfs_can_delete/rename()
If the caller asks for the odb_lock return it also if we return NT_STATUS_SHARING_VIOLATION or NT_STATUS_OPLOCK_NOT_GRANTED so that the caller can add the pending notification. metze (This used to be commit daab9cb11eb540fae7ec3c024a586f5fd02cfc71)
-rw-r--r--source4/ntvfs/posix/pvfs_open.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c
index 3ccd239523..0d97b3d629 100644
--- a/source4/ntvfs/posix/pvfs_open.c
+++ b/source4/ntvfs/posix/pvfs_open.c
@@ -1447,7 +1447,19 @@ NTSTATUS pvfs_can_delete(struct pvfs_state *pvfs,
status = pvfs_access_check_simple(pvfs, req, name, SEC_STD_DELETE);
}
- if (!NT_STATUS_IS_OK(status)) {
+ /*
+ * if it's a sharing violation or we got no oplock
+ * only keep the lock if the caller requested access
+ * to the lock
+ */
+ if (NT_STATUS_EQUAL(status, NT_STATUS_SHARING_VIOLATION) ||
+ NT_STATUS_EQUAL(status, NT_STATUS_OPLOCK_NOT_GRANTED)) {
+ if (lckp) {
+ *lckp = lck;
+ } else {
+ talloc_free(lck);
+ }
+ } else if (!NT_STATUS_IS_OK(status)) {
talloc_free(lck);
*lckp = lck;
} else if (lckp != NULL) {
@@ -1487,7 +1499,19 @@ NTSTATUS pvfs_can_rename(struct pvfs_state *pvfs,
0,
SEC_STD_DELETE);
- if (!NT_STATUS_IS_OK(status)) {
+ /*
+ * if it's a sharing violation or we got no oplock
+ * only keep the lock if the caller requested access
+ * to the lock
+ */
+ if (NT_STATUS_EQUAL(status, NT_STATUS_SHARING_VIOLATION) ||
+ NT_STATUS_EQUAL(status, NT_STATUS_OPLOCK_NOT_GRANTED)) {
+ if (lckp) {
+ *lckp = lck;
+ } else {
+ talloc_free(lck);
+ }
+ } else if (!NT_STATUS_IS_OK(status)) {
talloc_free(lck);
*lckp = lck;
} else if (lckp != NULL) {