diff -Naur aoe6-72/linux/drivers/block/aoe/aoeblk.c one/aoe6-72/linux/drivers/block/aoe/aoeblk.c --- aoe6-72/linux/drivers/block/aoe/aoeblk.c 2009-07-22 00:32:29.000000000 +0530 +++ one/aoe6-72/linux/drivers/block/aoe/aoeblk.c 2009-09-09 09:46:01.000000000 +0530 @@ -15,6 +15,8 @@ #include "disk_attr.h" static struct kmem_cache *buf_pool_cache; +extern struct work_struct dropcachews; +extern struct workqueue_struct *dropcachewq; /* GPFS needs a larger value than the default. */ static int aoe_maxsectors = 0; @@ -247,9 +249,14 @@ { struct aoedev *d; struct request *rq; +/* static int count=0; */ d = q->queuedata; if ((d->flags & DEVFL_UP) == 0) { + /* if(count==0){ */ + queue_work(dropcachewq,&dropcachews); + /* count++; + } */ printk(KERN_INFO "aoe: device %ld.%d is not up\n", d->aoemajor, d->aoeminor); while ((rq=elv_next_request(q))) { diff -Naur aoe6-72/linux/drivers/block/aoe/aoe.h one/aoe6-72/linux/drivers/block/aoe/aoe.h --- aoe6-72/linux/drivers/block/aoe/aoe.h 2009-07-22 00:32:29.000000000 +0530 +++ one/aoe6-72/linux/drivers/block/aoe/aoe.h 2009-09-09 09:39:27.000000000 +0530 @@ -252,6 +252,8 @@ /* for compatibility with older 2.6 kernels lacking kcalloc */ extern void *aoe_kcalloc(size_t, size_t, int); +extern void drop_slab(void); +extern void drop_pagecache(void); #define AOEDBG_ACTIVE 0 void __init aoedbg_init(void); diff -Naur aoe6-72/linux/drivers/block/aoe/aoemain.c one/aoe6-72/linux/drivers/block/aoe/aoemain.c --- aoe6-72/linux/drivers/block/aoe/aoemain.c 2009-07-22 00:32:29.000000000 +0530 +++ one/aoe6-72/linux/drivers/block/aoe/aoemain.c 2009-09-09 09:38:37.000000000 +0530 @@ -77,6 +77,7 @@ } } +struct workqueue_struct *dropcachewq=NULL; static void aoe_exit(void) { @@ -89,6 +90,15 @@ aoedev_exit(); aoeblk_exit(); /* free cache after de-allocating bufs */ aoedbg_exit(); + destroy_workqueue(dropcachewq); +} +/* structure work_struct and function declaration for flushing the cache */ +struct work_struct dropcachews; +void flushcache(void* d) +{ + printk(KERN_ALERT "FLUSHING THE BUFFER CACHE\n"); + drop_pagecache(); + drop_slab(); } static int __init @@ -96,6 +106,8 @@ { int ret; + dropcachewq=create_workqueue("cacheflush"); + INIT_WORK(&dropcachews, flushcache); aoedbg_init(); ret = aoedev_init(); if (ret)