blob: 7e26caab2a262befd2c74af594d076e0ebb40121 [file] [log] [blame]
NeilBrowna55370a2005-06-23 22:03:52 -07001/*
NeilBrowna55370a2005-06-23 22:03:52 -07002* Copyright (c) 2004 The Regents of the University of Michigan.
3* All rights reserved.
4*
5* Andy Adamson <andros@citi.umich.edu>
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions
9* are met:
10*
11* 1. Redistributions of source code must retain the above copyright
12* notice, this list of conditions and the following disclaimer.
13* 2. Redistributions in binary form must reproduce the above copyright
14* notice, this list of conditions and the following disclaimer in the
15* documentation and/or other materials provided with the distribution.
16* 3. Neither the name of the University nor the names of its
17* contributors may be used to endorse or promote products derived
18* from this software without specific prior written permission.
19*
20* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
21* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
27* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31*
32*/
33
NeilBrown190e4fb2005-06-23 22:04:25 -070034#include <linux/file.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090035#include <linux/slab.h>
NeilBrown190e4fb2005-06-23 22:04:25 -070036#include <linux/namei.h>
NeilBrowna55370a2005-06-23 22:03:52 -070037#include <linux/crypto.h>
Alexey Dobriyane8edc6e2007-05-21 01:22:52 +040038#include <linux/sched.h>
Boaz Harrosh9a74af22009-12-03 20:30:56 +020039
40#include "nfsd.h"
41#include "state.h"
J. Bruce Fields0a3adad2009-11-04 18:12:35 -050042#include "vfs.h"
NeilBrowna55370a2005-06-23 22:03:52 -070043
44#define NFSDDBG_FACILITY NFSDDBG_PROC
45
NeilBrown190e4fb2005-06-23 22:04:25 -070046/* Globals */
Christoph Hellwige970a572010-03-22 17:32:14 +010047static struct file *rec_file;
NeilBrown190e4fb2005-06-23 22:04:25 -070048
David Howellsd84f4f92008-11-14 10:39:23 +110049static int
50nfs4_save_creds(const struct cred **original_creds)
NeilBrown190e4fb2005-06-23 22:04:25 -070051{
David Howellsd84f4f92008-11-14 10:39:23 +110052 struct cred *new;
53
54 new = prepare_creds();
55 if (!new)
56 return -ENOMEM;
57
58 new->fsuid = 0;
59 new->fsgid = 0;
60 *original_creds = override_creds(new);
61 put_cred(new);
62 return 0;
NeilBrown190e4fb2005-06-23 22:04:25 -070063}
64
65static void
David Howellsd84f4f92008-11-14 10:39:23 +110066nfs4_reset_creds(const struct cred *original)
NeilBrown190e4fb2005-06-23 22:04:25 -070067{
David Howellsd84f4f92008-11-14 10:39:23 +110068 revert_creds(original);
NeilBrown190e4fb2005-06-23 22:04:25 -070069}
70
NeilBrowna55370a2005-06-23 22:03:52 -070071static void
72md5_to_hex(char *out, char *md5)
73{
74 int i;
75
76 for (i=0; i<16; i++) {
77 unsigned char c = md5[i];
78
79 *out++ = '0' + ((c&0xf0)>>4) + (c>=0xa0)*('a'-'9'-1);
80 *out++ = '0' + (c&0x0f) + ((c&0x0f)>=0x0a)*('a'-'9'-1);
81 }
82 *out = '\0';
83}
84
Al Virob37ad282006-10-19 23:28:59 -070085__be32
NeilBrowna55370a2005-06-23 22:03:52 -070086nfs4_make_rec_clidname(char *dname, struct xdr_netobj *clname)
87{
88 struct xdr_netobj cksum;
Herbert Xu35058682006-08-24 19:10:20 +100089 struct hash_desc desc;
Jens Axboe60c74f82007-10-22 19:43:30 +020090 struct scatterlist sg;
Al Virob37ad282006-10-19 23:28:59 -070091 __be32 status = nfserr_resource;
NeilBrowna55370a2005-06-23 22:03:52 -070092
93 dprintk("NFSD: nfs4_make_rec_clidname for %.*s\n",
94 clname->len, clname->data);
Herbert Xu35058682006-08-24 19:10:20 +100095 desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP;
96 desc.tfm = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC);
97 if (IS_ERR(desc.tfm))
98 goto out_no_tfm;
99 cksum.len = crypto_hash_digestsize(desc.tfm);
NeilBrowna55370a2005-06-23 22:03:52 -0700100 cksum.data = kmalloc(cksum.len, GFP_KERNEL);
101 if (cksum.data == NULL)
102 goto out;
NeilBrowna55370a2005-06-23 22:03:52 -0700103
Jens Axboe60c74f82007-10-22 19:43:30 +0200104 sg_init_one(&sg, clname->data, clname->len);
NeilBrowna55370a2005-06-23 22:03:52 -0700105
Jens Axboe60c74f82007-10-22 19:43:30 +0200106 if (crypto_hash_digest(&desc, &sg, sg.length, cksum.data))
Herbert Xu35058682006-08-24 19:10:20 +1000107 goto out;
NeilBrowna55370a2005-06-23 22:03:52 -0700108
109 md5_to_hex(dname, cksum.data);
110
NeilBrowna55370a2005-06-23 22:03:52 -0700111 status = nfs_ok;
112out:
Krishna Kumar2bd9e7b2008-10-20 11:47:09 +0530113 kfree(cksum.data);
Herbert Xu35058682006-08-24 19:10:20 +1000114 crypto_free_hash(desc.tfm);
115out_no_tfm:
NeilBrowna55370a2005-06-23 22:03:52 -0700116 return status;
117}
NeilBrown190e4fb2005-06-23 22:04:25 -0700118
NeilBrownc7b9a452005-06-23 22:04:30 -0700119int
120nfsd4_create_clid_dir(struct nfs4_client *clp)
121{
David Howellsd84f4f92008-11-14 10:39:23 +1100122 const struct cred *original_cred;
NeilBrownc7b9a452005-06-23 22:04:30 -0700123 char *dname = clp->cl_recdir;
Christoph Hellwige970a572010-03-22 17:32:14 +0100124 struct dentry *dir, *dentry;
NeilBrownc7b9a452005-06-23 22:04:30 -0700125 int status;
126
127 dprintk("NFSD: nfsd4_create_clid_dir for \"%s\"\n", dname);
128
Christoph Hellwige970a572010-03-22 17:32:14 +0100129 if (!rec_file || clp->cl_firststate)
NeilBrownc7b9a452005-06-23 22:04:30 -0700130 return 0;
131
David Howellsd84f4f92008-11-14 10:39:23 +1100132 status = nfs4_save_creds(&original_cred);
133 if (status < 0)
134 return status;
NeilBrownc7b9a452005-06-23 22:04:30 -0700135
Christoph Hellwige970a572010-03-22 17:32:14 +0100136 dir = rec_file->f_path.dentry;
NeilBrownc7b9a452005-06-23 22:04:30 -0700137 /* lock the parent */
Christoph Hellwige970a572010-03-22 17:32:14 +0100138 mutex_lock(&dir->d_inode->i_mutex);
NeilBrownc7b9a452005-06-23 22:04:30 -0700139
Christoph Hellwige970a572010-03-22 17:32:14 +0100140 dentry = lookup_one_len(dname, dir, HEXDIR_LEN-1);
NeilBrownc7b9a452005-06-23 22:04:30 -0700141 if (IS_ERR(dentry)) {
142 status = PTR_ERR(dentry);
143 goto out_unlock;
144 }
145 status = -EEXIST;
146 if (dentry->d_inode) {
147 dprintk("NFSD: nfsd4_create_clid_dir: DIRECTORY EXISTS\n");
148 goto out_put;
149 }
Christoph Hellwige970a572010-03-22 17:32:14 +0100150 status = mnt_want_write(rec_file->f_path.mnt);
Dave Hansen463c3192008-02-15 14:37:57 -0800151 if (status)
152 goto out_put;
Christoph Hellwige970a572010-03-22 17:32:14 +0100153 status = vfs_mkdir(dir->d_inode, dentry, S_IRWXU);
154 mnt_drop_write(rec_file->f_path.mnt);
NeilBrownc7b9a452005-06-23 22:04:30 -0700155out_put:
156 dput(dentry);
157out_unlock:
Christoph Hellwige970a572010-03-22 17:32:14 +0100158 mutex_unlock(&dir->d_inode->i_mutex);
NeilBrownc7b9a452005-06-23 22:04:30 -0700159 if (status == 0) {
160 clp->cl_firststate = 1;
Christoph Hellwig8018ab02010-03-22 17:32:25 +0100161 vfs_fsync(rec_file, 0);
NeilBrownc7b9a452005-06-23 22:04:30 -0700162 }
David Howellsd84f4f92008-11-14 10:39:23 +1100163 nfs4_reset_creds(original_cred);
NeilBrownc7b9a452005-06-23 22:04:30 -0700164 dprintk("NFSD: nfsd4_create_clid_dir returns %d\n", status);
165 return status;
166}
167
NeilBrown190e4fb2005-06-23 22:04:25 -0700168typedef int (recdir_func)(struct dentry *, struct dentry *);
169
J. Bruce Fields05f4f672009-03-13 16:02:59 -0400170struct name_list {
171 char name[HEXDIR_LEN];
NeilBrown190e4fb2005-06-23 22:04:25 -0700172 struct list_head list;
173};
174
NeilBrown190e4fb2005-06-23 22:04:25 -0700175static int
J. Bruce Fields05f4f672009-03-13 16:02:59 -0400176nfsd4_build_namelist(void *arg, const char *name, int namlen,
David Howellsafefdbb2006-10-03 01:13:46 -0700177 loff_t offset, u64 ino, unsigned int d_type)
NeilBrown190e4fb2005-06-23 22:04:25 -0700178{
J. Bruce Fields05f4f672009-03-13 16:02:59 -0400179 struct list_head *names = arg;
180 struct name_list *entry;
NeilBrown190e4fb2005-06-23 22:04:25 -0700181
J. Bruce Fields05f4f672009-03-13 16:02:59 -0400182 if (namlen != HEXDIR_LEN - 1)
Al Virob37ad282006-10-19 23:28:59 -0700183 return 0;
J. Bruce Fields05f4f672009-03-13 16:02:59 -0400184 entry = kmalloc(sizeof(struct name_list), GFP_KERNEL);
185 if (entry == NULL)
NeilBrown190e4fb2005-06-23 22:04:25 -0700186 return -ENOMEM;
J. Bruce Fields05f4f672009-03-13 16:02:59 -0400187 memcpy(entry->name, name, HEXDIR_LEN - 1);
188 entry->name[HEXDIR_LEN - 1] = '\0';
189 list_add(&entry->list, names);
NeilBrown190e4fb2005-06-23 22:04:25 -0700190 return 0;
191}
192
193static int
194nfsd4_list_rec_dir(struct dentry *dir, recdir_func *f)
195{
David Howellsd84f4f92008-11-14 10:39:23 +1100196 const struct cred *original_cred;
NeilBrown190e4fb2005-06-23 22:04:25 -0700197 struct file *filp;
J. Bruce Fields05f4f672009-03-13 16:02:59 -0400198 LIST_HEAD(names);
199 struct name_list *entry;
200 struct dentry *dentry;
NeilBrown190e4fb2005-06-23 22:04:25 -0700201 int status;
202
Christoph Hellwige970a572010-03-22 17:32:14 +0100203 if (!rec_file)
NeilBrown190e4fb2005-06-23 22:04:25 -0700204 return 0;
205
David Howellsd84f4f92008-11-14 10:39:23 +1100206 status = nfs4_save_creds(&original_cred);
207 if (status < 0)
208 return status;
NeilBrown190e4fb2005-06-23 22:04:25 -0700209
Christoph Hellwige970a572010-03-22 17:32:14 +0100210 filp = dentry_open(dget(dir), mntget(rec_file->f_path.mnt), O_RDONLY,
David Howells745ca242008-11-14 10:39:22 +1100211 current_cred());
NeilBrown190e4fb2005-06-23 22:04:25 -0700212 status = PTR_ERR(filp);
213 if (IS_ERR(filp))
214 goto out;
J. Bruce Fields05f4f672009-03-13 16:02:59 -0400215 status = vfs_readdir(filp, nfsd4_build_namelist, &names);
NeilBrown190e4fb2005-06-23 22:04:25 -0700216 fput(filp);
J. Bruce Fields8daed1e2009-05-11 16:10:19 -0400217 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
J. Bruce Fields05f4f672009-03-13 16:02:59 -0400218 while (!list_empty(&names)) {
219 entry = list_entry(names.next, struct name_list, list);
220
221 dentry = lookup_one_len(entry->name, dir, HEXDIR_LEN-1);
222 if (IS_ERR(dentry)) {
223 status = PTR_ERR(dentry);
David Woodhouse2f9092e2009-04-20 23:18:37 +0100224 break;
J. Bruce Fields05f4f672009-03-13 16:02:59 -0400225 }
226 status = f(dir, dentry);
227 dput(dentry);
NeilBrown190e4fb2005-06-23 22:04:25 -0700228 if (status)
David Woodhouse2f9092e2009-04-20 23:18:37 +0100229 break;
J. Bruce Fields05f4f672009-03-13 16:02:59 -0400230 list_del(&entry->list);
231 kfree(entry);
NeilBrown190e4fb2005-06-23 22:04:25 -0700232 }
David Woodhouse2f9092e2009-04-20 23:18:37 +0100233 mutex_unlock(&dir->d_inode->i_mutex);
NeilBrown190e4fb2005-06-23 22:04:25 -0700234out:
J. Bruce Fields05f4f672009-03-13 16:02:59 -0400235 while (!list_empty(&names)) {
236 entry = list_entry(names.next, struct name_list, list);
237 list_del(&entry->list);
238 kfree(entry);
NeilBrown190e4fb2005-06-23 22:04:25 -0700239 }
David Howellsd84f4f92008-11-14 10:39:23 +1100240 nfs4_reset_creds(original_cred);
NeilBrown190e4fb2005-06-23 22:04:25 -0700241 return status;
242}
243
244static int
NeilBrownc7b9a452005-06-23 22:04:30 -0700245nfsd4_unlink_clid_dir(char *name, int namlen)
246{
Christoph Hellwige970a572010-03-22 17:32:14 +0100247 struct dentry *dir, *dentry;
NeilBrownc7b9a452005-06-23 22:04:30 -0700248 int status;
249
250 dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name);
251
Christoph Hellwige970a572010-03-22 17:32:14 +0100252 dir = rec_file->f_path.dentry;
253 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
254 dentry = lookup_one_len(name, dir, namlen);
NeilBrownc7b9a452005-06-23 22:04:30 -0700255 if (IS_ERR(dentry)) {
256 status = PTR_ERR(dentry);
David Woodhouse2f9092e2009-04-20 23:18:37 +0100257 goto out_unlock;
NeilBrownc7b9a452005-06-23 22:04:30 -0700258 }
259 status = -ENOENT;
260 if (!dentry->d_inode)
261 goto out;
Christoph Hellwige970a572010-03-22 17:32:14 +0100262 status = vfs_rmdir(dir->d_inode, dentry);
NeilBrownc7b9a452005-06-23 22:04:30 -0700263out:
264 dput(dentry);
David Woodhouse2f9092e2009-04-20 23:18:37 +0100265out_unlock:
Christoph Hellwige970a572010-03-22 17:32:14 +0100266 mutex_unlock(&dir->d_inode->i_mutex);
NeilBrownc7b9a452005-06-23 22:04:30 -0700267 return status;
268}
269
270void
271nfsd4_remove_clid_dir(struct nfs4_client *clp)
272{
David Howellsd84f4f92008-11-14 10:39:23 +1100273 const struct cred *original_cred;
NeilBrownc7b9a452005-06-23 22:04:30 -0700274 int status;
275
Christoph Hellwige970a572010-03-22 17:32:14 +0100276 if (!rec_file || !clp->cl_firststate)
NeilBrownc7b9a452005-06-23 22:04:30 -0700277 return;
278
Christoph Hellwige970a572010-03-22 17:32:14 +0100279 status = mnt_want_write(rec_file->f_path.mnt);
Dave Hansen06227532008-02-15 14:37:34 -0800280 if (status)
281 goto out;
NeilBrown67be4312005-07-07 17:59:13 -0700282 clp->cl_firststate = 0;
David Howellsd84f4f92008-11-14 10:39:23 +1100283
284 status = nfs4_save_creds(&original_cred);
285 if (status < 0)
286 goto out;
287
NeilBrownc7b9a452005-06-23 22:04:30 -0700288 status = nfsd4_unlink_clid_dir(clp->cl_recdir, HEXDIR_LEN-1);
David Howellsd84f4f92008-11-14 10:39:23 +1100289 nfs4_reset_creds(original_cred);
NeilBrownc7b9a452005-06-23 22:04:30 -0700290 if (status == 0)
Christoph Hellwig8018ab02010-03-22 17:32:25 +0100291 vfs_fsync(rec_file, 0);
Christoph Hellwige970a572010-03-22 17:32:14 +0100292 mnt_drop_write(rec_file->f_path.mnt);
Dave Hansen06227532008-02-15 14:37:34 -0800293out:
NeilBrownc7b9a452005-06-23 22:04:30 -0700294 if (status)
295 printk("NFSD: Failed to remove expired client state directory"
296 " %.*s\n", HEXDIR_LEN, clp->cl_recdir);
297 return;
298}
299
300static int
301purge_old(struct dentry *parent, struct dentry *child)
302{
303 int status;
304
Andy Adamsona1bcecd2009-04-03 08:28:05 +0300305 /* note: we currently use this path only for minorversion 0 */
306 if (nfs4_has_reclaimed_state(child->d_name.name, false))
Al Virob37ad282006-10-19 23:28:59 -0700307 return 0;
NeilBrownc7b9a452005-06-23 22:04:30 -0700308
David Woodhouse2f9092e2009-04-20 23:18:37 +0100309 status = vfs_rmdir(parent->d_inode, child);
NeilBrownc7b9a452005-06-23 22:04:30 -0700310 if (status)
311 printk("failed to remove client recovery directory %s\n",
312 child->d_name.name);
313 /* Keep trying, success or failure: */
Al Virob37ad282006-10-19 23:28:59 -0700314 return 0;
NeilBrownc7b9a452005-06-23 22:04:30 -0700315}
316
317void
318nfsd4_recdir_purge_old(void) {
319 int status;
320
Christoph Hellwige970a572010-03-22 17:32:14 +0100321 if (!rec_file)
NeilBrownc7b9a452005-06-23 22:04:30 -0700322 return;
Christoph Hellwige970a572010-03-22 17:32:14 +0100323 status = mnt_want_write(rec_file->f_path.mnt);
Dave Hansen06227532008-02-15 14:37:34 -0800324 if (status)
325 goto out;
Christoph Hellwige970a572010-03-22 17:32:14 +0100326 status = nfsd4_list_rec_dir(rec_file->f_path.dentry, purge_old);
NeilBrownc7b9a452005-06-23 22:04:30 -0700327 if (status == 0)
Christoph Hellwig8018ab02010-03-22 17:32:25 +0100328 vfs_fsync(rec_file, 0);
Christoph Hellwige970a572010-03-22 17:32:14 +0100329 mnt_drop_write(rec_file->f_path.mnt);
Dave Hansen06227532008-02-15 14:37:34 -0800330out:
NeilBrownc7b9a452005-06-23 22:04:30 -0700331 if (status)
332 printk("nfsd4: failed to purge old clients from recovery"
Christoph Hellwige970a572010-03-22 17:32:14 +0100333 " directory %s\n", rec_file->f_path.dentry->d_name.name);
NeilBrownc7b9a452005-06-23 22:04:30 -0700334}
335
336static int
NeilBrown190e4fb2005-06-23 22:04:25 -0700337load_recdir(struct dentry *parent, struct dentry *child)
338{
339 if (child->d_name.len != HEXDIR_LEN - 1) {
340 printk("nfsd4: illegal name %s in recovery directory\n",
341 child->d_name.name);
342 /* Keep trying; maybe the others are OK: */
Al Virob37ad282006-10-19 23:28:59 -0700343 return 0;
NeilBrown190e4fb2005-06-23 22:04:25 -0700344 }
345 nfs4_client_to_reclaim(child->d_name.name);
Al Virob37ad282006-10-19 23:28:59 -0700346 return 0;
NeilBrown190e4fb2005-06-23 22:04:25 -0700347}
348
349int
350nfsd4_recdir_load(void) {
351 int status;
352
Christoph Hellwige970a572010-03-22 17:32:14 +0100353 if (!rec_file)
354 return 0;
355
356 status = nfsd4_list_rec_dir(rec_file->f_path.dentry, load_recdir);
NeilBrown190e4fb2005-06-23 22:04:25 -0700357 if (status)
358 printk("nfsd4: failed loading clients from recovery"
Christoph Hellwige970a572010-03-22 17:32:14 +0100359 " directory %s\n", rec_file->f_path.dentry->d_name.name);
NeilBrown190e4fb2005-06-23 22:04:25 -0700360 return status;
361}
362
363/*
364 * Hold reference to the recovery directory.
365 */
366
367void
368nfsd4_init_recdir(char *rec_dirname)
369{
David Howellsd84f4f92008-11-14 10:39:23 +1100370 const struct cred *original_cred;
371 int status;
NeilBrown190e4fb2005-06-23 22:04:25 -0700372
373 printk("NFSD: Using %s as the NFSv4 state recovery directory\n",
374 rec_dirname);
375
Christoph Hellwige970a572010-03-22 17:32:14 +0100376 BUG_ON(rec_file);
NeilBrown190e4fb2005-06-23 22:04:25 -0700377
David Howellsd84f4f92008-11-14 10:39:23 +1100378 status = nfs4_save_creds(&original_cred);
379 if (status < 0) {
380 printk("NFSD: Unable to change credentials to find recovery"
381 " directory: error %d\n",
382 status);
383 return;
384 }
NeilBrown190e4fb2005-06-23 22:04:25 -0700385
Christoph Hellwige970a572010-03-22 17:32:14 +0100386 rec_file = filp_open(rec_dirname, O_RDONLY | O_DIRECTORY, 0);
387 if (IS_ERR(rec_file)) {
J. Bruce Fieldsc2642ab2006-01-18 17:43:29 -0800388 printk("NFSD: unable to find recovery directory %s\n",
NeilBrown190e4fb2005-06-23 22:04:25 -0700389 rec_dirname);
Christoph Hellwige970a572010-03-22 17:32:14 +0100390 rec_file = NULL;
391 }
NeilBrown190e4fb2005-06-23 22:04:25 -0700392
David Howellsd84f4f92008-11-14 10:39:23 +1100393 nfs4_reset_creds(original_cred);
NeilBrown190e4fb2005-06-23 22:04:25 -0700394}
395
396void
397nfsd4_shutdown_recdir(void)
398{
Christoph Hellwige970a572010-03-22 17:32:14 +0100399 if (!rec_file)
NeilBrown190e4fb2005-06-23 22:04:25 -0700400 return;
Christoph Hellwige970a572010-03-22 17:32:14 +0100401 fput(rec_file);
402 rec_file = NULL;
NeilBrown190e4fb2005-06-23 22:04:25 -0700403}