From: Jeremy Allison Date: Sat, 27 Sep 2008 01:37:33 +0000 (-0700) Subject: Second part of the fix for bug #5790 - samba returns STATUS_OBJECT_NAME_NOT_FOUND... X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a7fd59a26bfc4a98b6936dc3ac8e67e1a7cb3733;p=thirdparty%2Fsamba.git Second part of the fix for bug #5790 - samba returns STATUS_OBJECT_NAME_NOT_FOUND on set file disposition call. This was my fault. I use a singleton cache (positive and negative) to speed up pathname based qfileinfo/setfileinfo lookups for alternate fsp's open on the same path. I only invalidated the negative cache on adding a new file fsp, as I incorrectly imagined the new fsp was put at the *end* of the open files list. DLIST_ADD puts it at the start, meaning any subsequent open wasn't seen once the cache was set. Doh ! Jeremy. --- diff --git a/source/smbd/files.c b/source/smbd/files.c index 13e6dd9b288..b7ac58d5232 100644 --- a/source/smbd/files.c +++ b/source/smbd/files.c @@ -122,10 +122,12 @@ NTSTATUS file_new(connection_struct *conn, files_struct **result) chain_fsp = fsp; - /* A new fsp invalidates a negative fsp_fi_cache. */ - if (fsp_fi_cache.fsp == NULL) { - ZERO_STRUCT(fsp_fi_cache); - } + /* A new fsp invalidates the positive and + negative fsp_fi_cache as the new fsp is pushed + at the start of the list and we search from + a cache hit to the *end* of the list. */ + + ZERO_STRUCT(fsp_fi_cache); *result = fsp; return NT_STATUS_OK;