Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294378
b: refs/heads/master
c: 820f944
h: refs/heads/master
v: v3
  • Loading branch information
Stanislav Kinsbursky authored and Trond Myklebust committed Jan 31, 2012
1 parent 513b809 commit a52480c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 30507f58ce11e7664512059c708347d7a7d75271
refs/heads/master: 820f9442e711a81749e70c40f149fc54c4ce0ca8
3 changes: 3 additions & 0 deletions trunk/fs/nfs/cache_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ int nfs_cache_register(struct cache_detail *cd)
mnt = rpc_get_mount();
if (IS_ERR(mnt))
return PTR_ERR(mnt);
sunrpc_init_cache_detail(cd);
ret = vfs_path_lookup(mnt->mnt_root, mnt, "/cache", 0, &path);
if (ret)
goto err;
Expand All @@ -128,13 +129,15 @@ int nfs_cache_register(struct cache_detail *cd)
if (!ret)
return ret;
err:
sunrpc_destroy_cache_detail(cd);
rpc_put_mount();
return ret;
}

void nfs_cache_unregister(struct cache_detail *cd)
{
sunrpc_cache_unregister_pipefs(cd);
sunrpc_destroy_cache_detail(cd);
rpc_put_mount();
}

2 changes: 2 additions & 0 deletions trunk/include/linux/sunrpc/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ extern int cache_register_net(struct cache_detail *cd, struct net *net);
extern void cache_unregister(struct cache_detail *cd);
extern void cache_unregister_net(struct cache_detail *cd, struct net *net);

extern void sunrpc_init_cache_detail(struct cache_detail *cd);
extern void sunrpc_destroy_cache_detail(struct cache_detail *cd);
extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *,
umode_t, struct cache_detail *);
extern void sunrpc_cache_unregister_pipefs(struct cache_detail *);
Expand Down
12 changes: 5 additions & 7 deletions trunk/net/sunrpc/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ static int current_index;
static void do_cache_clean(struct work_struct *work);
static struct delayed_work cache_cleaner;

static void sunrpc_init_cache_detail(struct cache_detail *cd)
void sunrpc_init_cache_detail(struct cache_detail *cd)
{
rwlock_init(&cd->hash_lock);
INIT_LIST_HEAD(&cd->queue);
Expand All @@ -360,8 +360,9 @@ static void sunrpc_init_cache_detail(struct cache_detail *cd)
/* start the cleaning process */
schedule_delayed_work(&cache_cleaner, 0);
}
EXPORT_SYMBOL_GPL(sunrpc_init_cache_detail);

static void sunrpc_destroy_cache_detail(struct cache_detail *cd)
void sunrpc_destroy_cache_detail(struct cache_detail *cd)
{
cache_purge(cd);
spin_lock(&cache_list_lock);
Expand All @@ -384,6 +385,7 @@ static void sunrpc_destroy_cache_detail(struct cache_detail *cd)
out:
printk(KERN_ERR "nfsd: failed to unregister %s cache\n", cd->name);
}
EXPORT_SYMBOL_GPL(sunrpc_destroy_cache_detail);

/* clean cache tries to find something to clean
* and cleans it.
Expand Down Expand Up @@ -1787,17 +1789,14 @@ int sunrpc_cache_register_pipefs(struct dentry *parent,
struct dentry *dir;
int ret = 0;

sunrpc_init_cache_detail(cd);
q.name = name;
q.len = strlen(name);
q.hash = full_name_hash(q.name, q.len);
dir = rpc_create_cache_dir(parent, &q, umode, cd);
if (!IS_ERR(dir))
cd->u.pipefs.dir = dir;
else {
sunrpc_destroy_cache_detail(cd);
else
ret = PTR_ERR(dir);
}
return ret;
}
EXPORT_SYMBOL_GPL(sunrpc_cache_register_pipefs);
Expand All @@ -1806,7 +1805,6 @@ void sunrpc_cache_unregister_pipefs(struct cache_detail *cd)
{
rpc_remove_cache_dir(cd->u.pipefs.dir);
cd->u.pipefs.dir = NULL;
sunrpc_destroy_cache_detail(cd);
}
EXPORT_SYMBOL_GPL(sunrpc_cache_unregister_pipefs);

0 comments on commit a52480c

Please sign in to comment.