[Pvfs2-cvs] commit by nlmills in pvfs2/src/io/trove/trove-dbpf:
dbpf-open-cache.c
CVS commit program
cvs at parl.clemson.edu
Tue May 17 15:32:51 EDT 2011
Update of /projects/cvsroot/pvfs2/src/io/trove/trove-dbpf
In directory parlweb1:/tmp/cvs-serv18109/src/io/trove/trove-dbpf
Modified Files:
Tag: cu-security-branch
dbpf-open-cache.c
Log Message:
merge with Orange-Branch
Index: dbpf-open-cache.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove-dbpf/dbpf-open-cache.c,v
diff -p -u -r1.22.18.2 -r1.22.18.3
--- dbpf-open-cache.c 19 Jun 2010 00:02:13 -0000 1.22.18.2
+++ dbpf-open-cache.c 17 May 2011 19:32:51 -0000 1.22.18.3
@@ -42,6 +42,7 @@ struct open_cache_entry
TROVE_coll_id coll_id;
TROVE_handle handle;
int fd;
+ int remove_flag;
enum open_cache_open_type type;
struct qlist_head queue_link;
@@ -111,6 +112,9 @@ void dbpf_open_cache_initialize(void)
gossip_err("Warning: dbpf_open_cache disabled.\n");
}
+ /* initialize prealloc array */
+ memset(&prealloc[0],0,sizeof(struct open_cache_entry)*OPEN_CACHE_SIZE);
+
for (i = 0; i < OPEN_CACHE_SIZE; i++)
{
prealloc[i].fd = -1;
@@ -184,10 +188,25 @@ int dbpf_open_cache_get(
tmp_entry = dbpf_open_cache_find_entry(
&used_list, "used list", coll_id, handle);
+ if (tmp_entry && tmp_entry->remove_flag)
+ {
+ gossip_err("DBPF_OPEN_CACHE_GET: pulled EXISTING entry from the used-list with the "
+ "remove flag set.\n");
+ gossip_err("\t\thandle:%llu\n",llu(tmp_entry->handle));
+ gossip_err("\t\tref-ct:%d \tfd:%d\n",tmp_entry->ref_ct,tmp_entry->fd);
+ }
+
if(!tmp_entry)
{
tmp_entry = dbpf_open_cache_find_entry(
&unused_list, "unused list", coll_id, handle);
+ if (tmp_entry && tmp_entry->remove_flag)
+ {
+ gossip_err("DBPF_OPEN_CACHE_GET: pulled EXISTING entry from the UNused-list with the "
+ "remove flag set.\n");
+ gossip_err("\t\thandle:%llu\n",llu(tmp_entry->handle));
+ gossip_err("\t\tref-ct:%d \tfd:%d\n",tmp_entry->ref_ct,tmp_entry->fd);
+ }
}
out_ref->fd = -1;
@@ -237,6 +256,13 @@ int dbpf_open_cache_get(
found = 1;
gossip_debug(GOSSIP_DBPF_OPEN_CACHE_DEBUG,
"dbpf_open_cache_get: resetting entry from free list.\n");
+ if (tmp_entry->remove_flag)
+ {
+ gossip_err("DBPF_OPEN_CACHE_GET: pulled FIRST entry from the free-list with the "
+ "remove flag turned on.\n");
+ gossip_err("\t\t\tSetting remove-flag to zero.\n");
+ tmp_entry->remove_flag=0;
+ }
}
/* anything in unused list (still open, but ref_ct == 0)? */
@@ -250,6 +276,13 @@ int dbpf_open_cache_get(
gossip_debug(GOSSIP_DBPF_OPEN_CACHE_DEBUG,
"dbpf_open_cache_get: resetting entry from unused list.\n");
+ if (tmp_entry->remove_flag)
+ {
+ gossip_err("DBPF_OPEN_CACHE_GET: pulled FIRST entry from the UNused-list with the "
+ "remove flag turned on.\n");
+ gossip_err("\t\t\tSetting remove-flag to zero.\n");
+ tmp_entry->remove_flag=0;
+ }
if (tmp_entry->fd > -1)
{
close_fd(tmp_entry->fd, tmp_entry->type);
@@ -371,6 +404,7 @@ int dbpf_open_cache_remove(
int ret = -1;
int tmp_error = 0;
struct qlist_head* scratch;
+ char open_type[32] = {0};
gossip_debug(GOSSIP_DBPF_OPEN_CACHE_DEBUG,
"dbpf_open_cache_remove: called\n");
@@ -390,7 +424,46 @@ int dbpf_open_cache_remove(
if ((tmp_entry->handle == handle) &&
(tmp_entry->coll_id == coll_id))
{
- assert(0);
+ gossip_err("DBPF_OPEN_CACHE_REMOVE: BINGO! Entry found in the USED_list when trying to "
+ "remove from the UNused_list.\n");
+ gossip_err("\t\tused_list entry:\n");
+ gossip_err("\t\t\t handle:%llu\n",llu(tmp_entry->handle));
+ gossip_err("\t\t\t ref-ct:%d \tfd:%d\n",tmp_entry->ref_ct,tmp_entry->fd);
+ gossip_err("\t\t\tremove-flag:%d\n",tmp_entry->remove_flag);
+ switch(tmp_entry->type)
+ {
+ case DBPF_FD_BUFFERED_READ:
+ {
+ strcpy(&open_type[0],"DBPF_FD_BUFFERED_READ");
+ break;
+ }
+ case DBPF_FD_BUFFERED_WRITE:
+ {
+ strcpy(&open_type[0],"DBPF_FD_BUFFERED_WRITE");
+ break;
+ }
+ case DBPF_FD_DIRECT_READ:
+ {
+ strcpy(&open_type[0],"DBPF_FD_DIRECT_READ");
+ break;
+ }
+ case DBPF_FD_DIRECT_WRITE:
+ {
+ strcpy(&open_type[0],"DBPF_FD_DIRECT_WRITE");
+ break;
+ }
+ default:
+ {
+ strcpy(&open_type[0],"UNKNOWN FD TYPE");
+ break;
+ }
+ }/*end switch*/
+ gossip_err("\t\t\t type:%s\n",open_type);
+
+ tmp_entry->remove_flag=1;
+
+ return (0);
+ //assert(0);
}
}
@@ -412,6 +485,12 @@ int dbpf_open_cache_remove(
{
gossip_debug(GOSSIP_DBPF_OPEN_CACHE_DEBUG,
"dbpf_open_cache_remove: unused entry.\n");
+ if (tmp_entry->remove_flag)
+ {
+ gossip_err("DBPF_OPEN_CACHE_REMOVE: handle:%llu found in the UNused list with"
+ " remove-flag turned on\n",llu(tmp_entry->handle));
+ }
+ tmp_entry->remove_flag = 0;
if (tmp_entry->fd > -1)
{
close_fd(tmp_entry->fd, tmp_entry->type);
More information about the Pvfs2-cvs
mailing list