nfs-ganesha 1.4
|
00001 /* 00002 * vim:expandtab:shiftwidth=8:tabstop=8: 00003 * 00004 * Copyright CEA/DAM/DIF (2008) 00005 * contributeur : Philippe DENIEL philippe.deniel@cea.fr 00006 * Thomas LEIBOVICI thomas.leibovici@cea.fr 00007 * 00008 * 00009 * This program is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 3 of the License, or (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with this library; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00022 * 02110-1301 USA 00023 * 00024 * --------------------------------------- 00025 */ 00026 00040 #ifdef HAVE_CONFIG_H 00041 #include "config.h" 00042 #endif 00043 00044 #ifdef _SOLARIS 00045 #include "solaris_port.h" 00046 #endif /* _SOLARIS */ 00047 00048 #include <unistd.h> 00049 #include <sys/types.h> 00050 #include <sys/param.h> 00051 #include <time.h> 00052 #include <pthread.h> 00053 #include <string.h> 00054 #include <assert.h> 00055 00056 #include "log.h" 00057 #include "HashData.h" 00058 #include "HashTable.h" 00059 #include "fsal.h" 00060 #include "cache_inode.h" 00061 #include "cache_inode_lru.h" 00062 #include "cache_inode_weakref.h" 00063 #include "nfs4_acls.h" 00064 #include "sal_functions.h" 00065 00081 void 00082 cache_inode_kill_entry(cache_entry_t *entry) 00083 { 00084 cache_inode_fsal_data_t fsaldata; 00085 hash_buffer_t key; 00086 hash_buffer_t val; 00087 int rc = 0; 00088 00089 memset(&fsaldata, 0, sizeof(fsaldata)); 00090 00091 LogInfo(COMPONENT_CACHE_INODE, 00092 "Using cache_inode_kill_entry for entry %p", entry); 00093 00094 cache_inode_unpinnable(entry); 00095 state_wipe_file(entry); 00096 00097 fsaldata.fh_desc = entry->fh_desc; 00098 FSAL_ExpandHandle(NULL, 00099 FSAL_DIGEST_SIZEOF, 00100 &fsaldata.fh_desc); 00101 00102 /* Use the handle to build the key */ 00103 key.pdata = fsaldata.fh_desc.start; 00104 key.len = fsaldata.fh_desc.len; 00105 00106 val.pdata = entry; 00107 val.len = sizeof(cache_entry_t); 00108 00109 if ((rc = HashTable_DelSafe(fh_to_cache_entry_ht, 00110 &key, 00111 &val)) != HASHTABLE_SUCCESS) { 00112 if (rc != HASHTABLE_ERROR_NO_SUCH_KEY) { 00113 LogCrit(COMPONENT_CACHE_INODE, 00114 "cache_inode_kill_entry: entry could not be deleted, " 00115 " status = %d", 00116 rc); 00117 } 00118 } 00119 00120 cache_inode_weakref_delete(&entry->weakref); 00121 00122 /* Idempotently return the sentry reference. (This function 00123 will only decrement the refcount once, no matter how many 00124 times it's called. */ 00125 cache_inode_lru_kill(entry); 00126 } /* cache_inode_kill_entry */