diff options
author | Stefan Metzmacher <metze@samba.org> | 2008-06-03 11:47:12 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2008-06-03 14:03:51 +0200 |
commit | d1bb49a2ab08f8f4eb27ae44bf04bc381faa85c1 (patch) | |
tree | 4fb2180cbf800be94371e7b26b61fc551a19d123 /source4/ntvfs | |
parent | ad19d5455ead83d5b4127e93d6466aab4cee75c1 (diff) | |
download | samba-d1bb49a2ab08f8f4eb27ae44bf04bc381faa85c1.tar.gz samba-d1bb49a2ab08f8f4eb27ae44bf04bc381faa85c1.tar.bz2 samba-d1bb49a2ab08f8f4eb27ae44bf04bc381faa85c1.zip |
pvfs_setfileinfo: update the write time in the opendb
metze
(This used to be commit 418e2592b48d558ff1d32031d64263ae21cf1eb0)
Diffstat (limited to 'source4/ntvfs')
-rw-r--r-- | source4/ntvfs/posix/pvfs_setfileinfo.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/source4/ntvfs/posix/pvfs_setfileinfo.c b/source4/ntvfs/posix/pvfs_setfileinfo.c index 1dd2c075d9..b0f636f999 100644 --- a/source4/ntvfs/posix/pvfs_setfileinfo.c +++ b/source4/ntvfs/posix/pvfs_setfileinfo.c @@ -454,6 +454,30 @@ NTSTATUS pvfs_setfileinfo(struct ntvfs_module_context *ntvfs, return pvfs_map_errno(pvfs, errno); } } + if (change_mask & FILE_NOTIFY_CHANGE_LAST_WRITE) { + struct odb_lock *lck; + + lck = odb_lock(req, h->pvfs->odb_context, &h->odb_locking_key); + if (lck == NULL) { + DEBUG(0,("Unable to lock opendb for write time update\n")); + return NT_STATUS_INTERNAL_ERROR; + } + + status = odb_set_write_time(lck, newstats.dos.write_time, true); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0,("Unable to update write time: %s\n", + nt_errstr(status))); + talloc_free(lck); + return status; + } + + talloc_free(lck); + + h->write_time.update_forced = true; + h->write_time.update_on_close = false; + talloc_free(h->write_time.update_event); + h->write_time.update_event = NULL; + } /* possibly change the attribute */ if (newstats.dos.attrib != h->name->dos.attrib) { @@ -753,6 +777,29 @@ NTSTATUS pvfs_setpathinfo(struct ntvfs_module_context *ntvfs, return pvfs_map_errno(pvfs, errno); } } + if (change_mask & FILE_NOTIFY_CHANGE_LAST_WRITE) { + if (lck == NULL) { + DATA_BLOB lkey; + status = pvfs_locking_key(name, name, &lkey); + NT_STATUS_NOT_OK_RETURN(status); + + lck = odb_lock(req, pvfs->odb_context, &lkey); + data_blob_free(&lkey); + if (lck == NULL) { + DEBUG(0,("Unable to lock opendb for write time update\n")); + return NT_STATUS_INTERNAL_ERROR; + } + } + + status = odb_set_write_time(lck, newstats.dos.write_time, true); + if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) { + /* it could be that nobody has opened the file */ + } else if (!NT_STATUS_IS_OK(status)) { + DEBUG(0,("Unable to update write time: %s\n", + nt_errstr(status))); + return status; + } + } /* possibly change the attribute */ newstats.dos.attrib |= (name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY); |