vserver 1.9.3
[linux-2.6.git] / net / sunrpc / cache.c
index e84acd0..d508a51 100644 (file)
@@ -38,7 +38,7 @@ void cache_init(struct cache_head *h)
        time_t now = get_seconds();
        h->next = NULL;
        h->flags = 0;
-       atomic_set(&h->refcnt, 0);
+       atomic_set(&h->refcnt, 1);
        h->expiry_time = now + CACHE_NEW_EXPIRY;
        h->last_refresh = now;
 }
@@ -400,9 +400,10 @@ void cache_flush(void)
 
 void cache_purge(struct cache_detail *detail)
 {
-       detail->flush_time = get_seconds()+1;
+       detail->flush_time = LONG_MAX;
        detail->nextcheck = get_seconds();
        cache_flush();
+       detail->flush_time = 1;
 }
 
 
@@ -582,9 +583,6 @@ cache_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos)
        struct cache_detail *cd = PDE(filp->f_dentry->d_inode)->data;
        int err;
 
-       if (ppos != &filp->f_pos)
-               return -ESPIPE;
-
        if (count == 0)
                return 0;
 
@@ -662,9 +660,6 @@ cache_write(struct file *filp, const char __user *buf, size_t count,
        int err;
        struct cache_detail *cd = PDE(filp->f_dentry->d_inode)->data;
 
-       if (ppos != &filp->f_pos)
-               return -ESPIPE;
-
        if (count == 0)
                return 0;
        if (count >= sizeof(write_buf))
@@ -751,6 +746,7 @@ cache_open(struct inode *inode, struct file *filp)
 {
        struct cache_reader *rp = NULL;
 
+       nonseekable_open(inode, filp);
        if (filp->f_mode & FMODE_READ) {
                struct cache_detail *cd = PDE(inode)->data;
 
@@ -1212,6 +1208,7 @@ static ssize_t write_flush(struct file * file, const char __user * buf,
 }
 
 static struct file_operations cache_flush_operations = {
+       .open           = nonseekable_open,
        .read           = read_flush,
        .write          = write_flush,
 };