X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=net%2Fsunrpc%2Fcache.c;h=73f053d0cc7a4f7eee6d65954f5383cb6d6fa18e;hb=510deb0d7035d4fd465627deb3a119ca854f9e00;hp=ebe344f34d1ae741c9696db10785d971f49450a4;hpb=d88da66f9397f06f3a7b4e5148bd5e71cb9d7952;p=powerpc.git diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index ebe344f34d..73f053d0cc 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -1127,6 +1127,7 @@ struct handle { }; static void *c_start(struct seq_file *m, loff_t *pos) + __acquires(cd->hash_lock) { loff_t n = *pos; unsigned hash, entry; @@ -1183,6 +1184,7 @@ static void *c_next(struct seq_file *m, void *p, loff_t *pos) } static void c_stop(struct seq_file *m, void *p) + __releases(cd->hash_lock) { struct cache_detail *cd = ((struct handle*)m->private)->cd; read_unlock(&cd->hash_lock); @@ -1218,23 +1220,15 @@ static const struct seq_operations cache_content_op = { static int content_open(struct inode *inode, struct file *file) { - int res; struct handle *han; struct cache_detail *cd = PDE(inode)->data; - han = kmalloc(sizeof(*han), GFP_KERNEL); + han = __seq_open_private(file, &cache_content_op, sizeof(*han)); if (han == NULL) return -ENOMEM; han->cd = cd; - - res = seq_open(file, &cache_content_op); - if (res) - kfree(han); - else - ((struct seq_file *)file->private_data)->private = han; - - return res; + return 0; } static const struct file_operations content_file_operations = {