Whamcloud - gitweb
1. Fixed cleanup issue where I was *indeed* accesing a zapped pointer.
[fs/lustre-release.git] / lustre / llite / super.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * Lustre Light Super operations
5  *
6  * This code is issued under the GNU General Public License.
7  * See the file COPYING in this distribution
8  *
9  * Copryright (C) 2002 Cluster File Systems, Inc.
10  */
11
12 #define DEBUG_SUBSYSTEM S_LLITE
13
14 #include <linux/module.h>
15 #include <linux/random.h>
16 #include <linux/version.h>
17 #include <linux/lustre_lite.h>
18 #include <linux/lustre_ha.h>
19 #include <linux/obd_lov.h>
20 #include <linux/lustre_dlm.h>
21 #include <linux/init.h>
22 #include <linux/fs.h>
23 #include <linux/lprocfs_status.h>
24
25
26 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
27 kmem_cache_t *ll_file_data_slab;
28 extern struct address_space_operations ll_aops;
29 extern struct address_space_operations ll_dir_aops;
30 struct super_operations ll_super_operations;
31
32 extern int ll_recover(struct recovd_data *, int);
33 extern int ll_commitcbd_setup(struct ll_sb_info *);
34 extern int ll_commitcbd_cleanup(struct ll_sb_info *);
35
36 extern int rd_dev_uuid(char* page, char **start, off_t off,
37                            int count, int *eof, void *data);
38
39 extern int rd_dev_name(char* page, char **start, off_t off,
40                     int count, int *eof, void *data);
41
42
43 extern struct lprocfs_vars status_var_nm_1[];
44
45 static char *ll_read_opt(const char *opt, char *data)
46 {
47         char *value;
48         char *retval;
49         ENTRY;
50
51         CDEBUG(D_SUPER, "option: %s, data %s\n", opt, data);
52         if ( strncmp(opt, data, strlen(opt)) )
53                 RETURN(NULL);
54         if ( (value = strchr(data, '=')) == NULL )
55                 RETURN(NULL);
56
57         value++;
58         OBD_ALLOC(retval, strlen(value) + 1);
59         if ( !retval ) {
60                 CERROR("out of memory!\n");
61                 RETURN(NULL);
62         }
63
64         memcpy(retval, value, strlen(value)+1);
65         CDEBUG(D_SUPER, "Assigned option: %s, value %s\n", opt, retval);
66         RETURN(retval);
67 }
68
69 static int ll_set_opt(const char *opt, char *data, int fl)
70 {
71         ENTRY;
72
73         CDEBUG(D_SUPER, "option: %s, data %s\n", opt, data);
74         if ( strncmp(opt, data, strlen(opt)) )
75                 RETURN(0);
76         else
77                 RETURN(fl);
78 }
79
80 static void ll_options(char *options, char **ost, char **mds, int *flags)
81 {
82         char *this_char;
83         ENTRY;
84
85         if (!options) {
86                 EXIT;
87                 return;
88         }
89
90         for (this_char = strtok (options, ",");
91              this_char != NULL;
92              this_char = strtok (NULL, ",")) {
93                 CDEBUG(D_SUPER, "this_char %s\n", this_char);
94                 if ( (!*ost && (*ost = ll_read_opt("osc", this_char)))||
95                      (!*mds && (*mds = ll_read_opt("mdc", this_char)))||
96                      (!(*flags & LL_SBI_NOLCK) && ((*flags) = (*flags) |
97                       ll_set_opt("nolock", this_char, LL_SBI_NOLCK))) )
98                         continue;
99         }
100         EXIT;
101 }
102
103 #ifndef log2
104 #define log2(n) ffz(~(n))
105 #endif
106
107 static struct super_block * ll_read_super(struct super_block *sb,
108                                           void *data, int silent)
109 {
110         struct inode *root = 0;
111         struct obd_device *obd;
112         struct ll_sb_info *sbi;
113         char *osc = NULL;
114         char *mdc = NULL;
115         int err;
116         struct ll_fid rootfid;
117         struct obd_statfs osfs;
118         struct ptlrpc_request *request = NULL;
119         struct ptlrpc_connection *mdc_conn;
120         struct ll_read_inode2_cookie lic;
121         class_uuid_t uuid;
122
123         
124         /* Lprocfs variables */
125         char mnt_name[100];
126         char uuid_name[100];
127         struct lprocfs_vars d_vars[3];
128         
129
130
131         ENTRY;
132         MOD_INC_USE_COUNT;
133
134         OBD_ALLOC(sbi, sizeof(*sbi));
135         if (!sbi) {
136                 MOD_DEC_USE_COUNT;
137                 RETURN(NULL);
138         }
139
140         INIT_LIST_HEAD(&sbi->ll_conn_chain);
141         INIT_LIST_HEAD(&sbi->ll_orphan_dentry_list);
142         generate_random_uuid(uuid);
143         class_uuid_unparse(uuid, sbi->ll_sb_uuid);
144
145         sb->u.generic_sbp = sbi;
146
147         ll_options(data, &osc, &mdc, &sbi->ll_flags);
148
149         if (!osc) {
150                 CERROR("no osc\n");
151                 GOTO(out_free, sb = NULL);
152         }
153
154         if (!mdc) {
155                 CERROR("no mdc\n");
156                 GOTO(out_free, sb = NULL);
157         }
158
159         obd = class_uuid2obd(mdc);
160         if (!obd) {
161                 CERROR("MDC %s: not setup or attached\n", mdc);
162                 GOTO(out_free, sb = NULL);
163         }
164
165         err = obd_connect(&sbi->ll_mdc_conn, obd, sbi->ll_sb_uuid,
166                           ptlrpc_recovd, ll_recover);
167         if (err) {
168                 CERROR("cannot connect to %s: rc = %d\n", mdc, err);
169                 GOTO(out_free, sb = NULL);
170         }
171
172 #warning Mike: is this the right place to raise the connection level?
173         mdc_conn = sbi2mdc(sbi)->cl_import.imp_connection;
174         mdc_conn->c_level = LUSTRE_CONN_FULL;
175         list_add(&mdc_conn->c_sb_chain, &sbi->ll_conn_chain);
176
177         obd = class_uuid2obd(osc);
178         if (!obd) {
179                 CERROR("OSC %s: not setup or attached\n", osc);
180                 GOTO(out_mdc, sb = NULL);
181         }
182
183         err = obd_connect(&sbi->ll_osc_conn, obd, sbi->ll_sb_uuid,
184                           ptlrpc_recovd, ll_recover);
185         if (err) {
186                 CERROR("cannot connect to %s: rc = %d\n", osc, err);
187                 GOTO(out_mdc, sb = NULL);
188         }
189
190         err = mdc_getstatus(&sbi->ll_mdc_conn, &rootfid);
191         if (err) {
192                 CERROR("cannot mds_connect: rc = %d\n", err);
193                 GOTO(out_mdc, sb = NULL);
194         }
195         CDEBUG(D_SUPER, "rootfid "LPU64"\n", rootfid.id);
196         sbi->ll_rootino = rootfid.id;
197
198         memset(&osfs, 0, sizeof(osfs));
199         err = obd_statfs(&sbi->ll_mdc_conn, &osfs);
200         sb->s_blocksize = osfs.os_bsize;
201         sb->s_blocksize_bits = log2(osfs.os_bsize);
202         sb->s_magic = LL_SUPER_MAGIC;
203         sb->s_maxbytes = (1ULL << (32 + 9)) - osfs.os_bsize;
204
205         sb->s_op = &ll_super_operations;
206
207         /* make root inode */
208         err = mdc_getattr(&sbi->ll_mdc_conn, sbi->ll_rootino, S_IFDIR,
209                           OBD_MD_FLNOTOBD|OBD_MD_FLBLOCKS, 0, &request);
210         if (err) {
211                 CERROR("mdc_getattr failed for root: rc = %d\n", err);
212                 GOTO(out_request, sb = NULL);
213         }
214
215         /* initialize committed transaction callback daemon */
216         spin_lock_init(&sbi->ll_commitcbd_lock);
217         init_waitqueue_head(&sbi->ll_commitcbd_waitq);
218         init_waitqueue_head(&sbi->ll_commitcbd_ctl_waitq);
219         sbi->ll_commitcbd_flags = 0;
220         err = ll_commitcbd_setup(sbi);
221         if (err) {
222                 CERROR("failed to start commit callback daemon: rc = %d\n",err);
223                 GOTO(out_request, sb = NULL);
224         }
225
226         lic.lic_body = lustre_msg_buf(request->rq_repmsg, 0);
227         lic.lic_lmm = NULL;
228         LASSERT(sbi->ll_rootino != 0);
229         root = iget4(sb, sbi->ll_rootino, NULL, &lic);
230
231         if (root) {
232                 sb->s_root = d_alloc_root(root);
233         } else {
234                 CERROR("lustre_lite: bad iget4 for root\n");
235                 GOTO(out_cdb, sb = NULL);
236         }
237
238         ptlrpc_req_finished(request);
239         request = NULL;
240
241         
242         /* Register this mount instance with LProcFS */
243         
244         snprintf(mnt_name, 100, "mount_%s", sbi->ll_sb_uuid);
245         sbi->ll_mnt_root=lprocfs_reg_mnt(mnt_name);
246         if(!sbi->ll_mnt_root)
247                 goto out_dev;
248
249         /* Add the static configuration info */
250         lprocfs_add_vars(sbi->ll_mnt_root, 
251                          (struct lprocfs_vars*)status_var_nm_1,
252                          (void*)sb);
253
254          /* Add the dynamic configuration stuff */
255         
256         /* MDC */
257         obd = class_uuid2obd(mdc);
258         
259         /* Reuse mnt_name */
260         
261         sprintf(mnt_name, "status/%s/common_name", obd->obd_type->typ_name);
262
263         memset(d_vars, 0, sizeof(d_vars));
264         d_vars[0].read_fptr=rd_dev_name;
265         d_vars[0].write_fptr=0;
266         d_vars[0].name=(char*)mnt_name;
267          
268         
269         snprintf(uuid_name, strlen(uuid_name), "status/%s/uuid", 
270                  obd->obd_type->typ_name);
271         d_vars[1].read_fptr=rd_dev_uuid;
272         d_vars[1].write_fptr=0;
273         d_vars[1].name=(char*)uuid_name;
274         
275         err=lprocfs_add_vars(sbi->ll_mnt_root, (struct lprocfs_vars* )d_vars, 
276                              (void*)obd);
277         if (err) {
278                 CDEBUG(D_OTHER, "Unable to add fs proc dynamic variables");
279         }
280
281         
282         /* OSC or LOV*/
283         obd = class_uuid2obd(osc);
284         /* Reuse mnt_name */
285       
286         snprintf(mnt_name, strlen(mnt_name), "status/%s/common_name", 
287                  obd->obd_type->typ_name);
288
289         memset(d_vars, 0, sizeof(d_vars));
290         d_vars[0].read_fptr=rd_dev_name;
291         d_vars[0].write_fptr=0;
292         d_vars[0].name=(char*)mnt_name;
293          
294         
295         snprintf(uuid_name, strlen(uuid_name), "status/%s/uuid", 
296                  obd->obd_type->typ_name);
297         d_vars[1].read_fptr=rd_dev_uuid;
298         d_vars[1].write_fptr=0;
299         d_vars[1].name=(char*)uuid_name;
300         
301         err=lprocfs_add_vars(sbi->ll_mnt_root, (struct lprocfs_vars* )d_vars, 
302                              (void*)obd);        
303         if (err) {
304                 CDEBUG(D_OTHER, "Unable to add fs proc dynamic variables");
305         }
306 out_dev:
307         if (mdc)
308                 OBD_FREE(mdc, strlen(mdc) + 1);
309         if (osc)
310                 OBD_FREE(osc, strlen(osc) + 1);
311
312         RETURN(sb);
313
314 out_cdb:
315         ll_commitcbd_cleanup(sbi);
316 out_request:
317         ptlrpc_req_finished(request);
318         obd_disconnect(&sbi->ll_osc_conn);
319 out_mdc:
320         obd_disconnect(&sbi->ll_mdc_conn);
321 out_free:
322         OBD_FREE(sbi, sizeof(*sbi));
323
324         MOD_DEC_USE_COUNT;
325         goto out_dev;
326 } /* ll_read_super */
327
328 static void ll_put_super(struct super_block *sb)
329 {
330         struct ll_sb_info *sbi = ll_s2sbi(sb);
331         struct list_head *tmp, *next;
332         struct ll_fid rootfid;
333         ENTRY;
334
335         list_del(&sbi->ll_conn_chain);
336         ll_commitcbd_cleanup(sbi);
337         obd_disconnect(&sbi->ll_osc_conn);
338
339         /* NULL request to force sync on the MDS, and get the last_committed
340          * value to flush remaining RPCs from the sending queue on client.
341          *
342          * XXX This should be an mdc_sync() call to sync the whole MDS fs,
343          *     which we can call for other reasons as well.
344          */
345         mdc_getstatus(&sbi->ll_mdc_conn, &rootfid);
346
347         lprocfs_dereg_mnt(sbi->ll_mnt_root);
348         obd_disconnect(&sbi->ll_mdc_conn);
349
350         spin_lock(&dcache_lock);
351         list_for_each_safe(tmp, next, &sbi->ll_orphan_dentry_list) {
352                 struct dentry *dentry = list_entry(tmp, struct dentry, d_hash);
353                 shrink_dcache_parent(dentry);
354         }
355         spin_unlock(&dcache_lock);
356
357         OBD_FREE(sbi, sizeof(*sbi));
358
359         MOD_DEC_USE_COUNT;
360         EXIT;
361 } /* ll_put_super */
362
363 static void ll_clear_inode(struct inode *inode)
364 {
365         struct ll_sb_info *sbi = ll_i2sbi(inode);
366         int rc;
367         ENTRY;
368
369         rc = mdc_cancel_unused(&sbi->ll_mdc_conn, inode, LDLM_FL_NO_CALLBACK);
370         if (rc < 0) {
371                 CERROR("obd_cancel_unused: %d\n", rc);
372                 /* XXX FIXME do something dramatic */
373         }
374
375         if (atomic_read(&inode->i_count) == 0) {
376                 struct ll_inode_info *lli = ll_i2info(inode);
377                 struct lov_stripe_md *lsm = lli->lli_smd;
378                 char *symlink_name = lli->lli_symlink_name;
379
380                 if (lsm) {
381                         OBD_FREE(lsm, ll_ost_easize(inode->i_sb));
382                         lli->lli_smd = NULL;
383                 }
384                 if (symlink_name) {
385                         OBD_FREE(symlink_name, strlen(symlink_name) + 1);
386                         lli->lli_symlink_name = NULL;
387                 }
388         }
389
390         EXIT;
391 }
392
393 static void ll_delete_inode(struct inode *inode)
394 {
395         ENTRY;
396         if (S_ISREG(inode->i_mode)) {
397                 int err;
398                 struct obdo *oa;
399                 struct lov_stripe_md *lsm = ll_i2info(inode)->lli_smd;
400
401                 if (!lsm)
402                         GOTO(out, -EINVAL);
403
404                 if (lsm->lsm_object_id == 0) {
405                         CERROR("This really happens\n");
406                         /* No obdo was ever created */
407                         GOTO(out, 0);
408                 }
409
410                 oa = obdo_alloc();
411                 if (oa == NULL)
412                         GOTO(out, -ENOMEM);
413
414                 oa->o_id = lsm->lsm_object_id;
415                 oa->o_easize = ll_mds_easize(inode->i_sb);
416                 oa->o_mode = inode->i_mode;
417                 oa->o_valid = OBD_MD_FLID | OBD_MD_FLEASIZE | OBD_MD_FLTYPE;
418
419                 err = obd_destroy(ll_i2obdconn(inode), oa, lsm);
420                 obdo_free(oa);
421                 CDEBUG(D_SUPER, "obd destroy of objid "LPX64" error %d\n",
422                        lsm->lsm_object_id, err);
423         }
424 out:
425         clear_inode(inode);
426         EXIT;
427 }
428
429 /* like inode_setattr, but doesn't mark the inode dirty */
430 static int ll_attr2inode(struct inode * inode, struct iattr * attr, int trunc)
431 {
432         unsigned int ia_valid = attr->ia_valid;
433         int error = 0;
434
435         if ((ia_valid & ATTR_SIZE) && trunc) {
436                 error = vmtruncate(inode, attr->ia_size);
437                 if (error)
438                         goto out;
439         } else if (ia_valid & ATTR_SIZE)
440                 inode->i_size = attr->ia_size;
441
442         if (ia_valid & ATTR_UID)
443                 inode->i_uid = attr->ia_uid;
444         if (ia_valid & ATTR_GID)
445                 inode->i_gid = attr->ia_gid;
446         if (ia_valid & ATTR_ATIME)
447                 inode->i_atime = attr->ia_atime;
448         if (ia_valid & ATTR_MTIME)
449                 inode->i_mtime = attr->ia_mtime;
450         if (ia_valid & ATTR_CTIME)
451                 inode->i_ctime = attr->ia_ctime;
452         if (ia_valid & ATTR_MODE) {
453                 inode->i_mode = attr->ia_mode;
454                 if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
455                         inode->i_mode &= ~S_ISGID;
456         }
457 out:
458         return error;
459 }
460
461 int ll_inode_setattr(struct inode *inode, struct iattr *attr, int do_trunc)
462 {
463         struct ptlrpc_request *request = NULL;
464         struct ll_sb_info *sbi = ll_i2sbi(inode);
465         int err;
466
467         ENTRY;
468
469         /* change incore inode */
470         ll_attr2inode(inode, attr, do_trunc);
471
472         err = mdc_setattr(&sbi->ll_mdc_conn, inode, attr, &request);
473         if (err)
474                 CERROR("mdc_setattr fails (%d)\n", err);
475
476         ptlrpc_req_finished(request);
477
478         RETURN(err);
479 }
480
481 int ll_setattr(struct dentry *de, struct iattr *attr)
482 {
483         int rc = inode_change_ok(de->d_inode, attr);
484
485         if (rc)
486                 return rc;
487
488         return ll_inode_setattr(de->d_inode, attr, 1);
489 }
490
491 static int ll_statfs(struct super_block *sb, struct statfs *sfs)
492 {
493         struct ll_sb_info *sbi = ll_s2sbi(sb);
494         struct obd_statfs osfs;
495         int rc;
496         ENTRY;
497
498         memset(sfs, 0, sizeof(*sfs));
499         rc = obd_statfs(&sbi->ll_mdc_conn, &osfs);
500         statfs_unpack(sfs, &osfs);
501         if (rc)
502                 CERROR("mdc_statfs fails: rc = %d\n", rc);
503         else
504                 CDEBUG(D_SUPER, "mdc_statfs shows blocks "LPU64"/"LPU64
505                        " objects "LPU64"/"LPU64"\n",
506                        osfs.os_bavail, osfs.os_blocks,
507                        osfs.os_ffree, osfs.os_files);
508
509         /* temporary until mds_statfs returns statfs info for all OSTs */
510         if (!rc) {
511                 rc = obd_statfs(&sbi->ll_osc_conn, &osfs);
512                 if (rc) {
513                         CERROR("obd_statfs fails: rc = %d\n", rc);
514                         GOTO(out, rc);
515                 }
516                 CDEBUG(D_SUPER, "obd_statfs shows blocks "LPU64"/"LPU64
517                        " objects "LPU64"/"LPU64"\n",
518                        osfs.os_bavail, osfs.os_blocks,
519                        osfs.os_ffree, osfs.os_files);
520
521                 while (osfs.os_blocks > ~0UL) {
522                         sfs->f_bsize <<= 1;
523
524                         osfs.os_blocks >>= 1;
525                         osfs.os_bfree >>= 1;
526                         osfs.os_bavail >>= 1;
527                 }
528                 sfs->f_blocks = osfs.os_blocks;
529                 sfs->f_bfree = osfs.os_bfree;
530                 sfs->f_bavail = osfs.os_bavail;
531                 if (osfs.os_ffree < (__u64)sfs->f_ffree)
532                         sfs->f_ffree = osfs.os_ffree;
533         }
534
535 out:
536         RETURN(rc);
537 }
538
539 void ll_update_inode(struct inode *inode, struct mds_body *body)
540 {
541         if (body->valid & OBD_MD_FLID)
542                 inode->i_ino = body->ino;
543         if (body->valid & OBD_MD_FLATIME)
544                 inode->i_atime = body->atime;
545         if (body->valid & OBD_MD_FLMTIME)
546                 inode->i_mtime = body->mtime;
547         if (body->valid & OBD_MD_FLCTIME)
548                 inode->i_ctime = body->ctime;
549         if (body->valid & OBD_MD_FLMODE)
550                 inode->i_mode = (inode->i_mode & S_IFMT)|(body->mode & ~S_IFMT);
551         if (body->valid & OBD_MD_FLTYPE)
552                 inode->i_mode = (inode->i_mode & ~S_IFMT)|(body->mode & S_IFMT);
553         if (body->valid & OBD_MD_FLUID)
554                 inode->i_uid = body->uid;
555         if (body->valid & OBD_MD_FLGID)
556                 inode->i_gid = body->gid;
557         if (body->valid & OBD_MD_FLFLAGS)
558                 inode->i_flags = body->flags;
559         if (body->valid & OBD_MD_FLNLINK)
560                 inode->i_nlink = body->nlink;
561         if (body->valid & OBD_MD_FLGENER)
562                 inode->i_generation = body->generation;
563         if (body->valid & OBD_MD_FLRDEV)
564                 inode->i_rdev = body->rdev;
565         if (body->valid & OBD_MD_FLSIZE)
566                 inode->i_size = body->size;
567 }
568
569 static void ll_read_inode2(struct inode *inode, void *opaque)
570 {
571         struct ll_read_inode2_cookie *lic = opaque;
572         struct mds_body *body = lic->lic_body;
573         struct ll_inode_info *lli = ll_i2info(inode);
574         ENTRY;
575
576         sema_init(&lli->lli_open_sem, 1);
577
578         /* core attributes first */
579         ll_update_inode(inode, body);
580
581         //if (body->valid & OBD_MD_FLEASIZE)
582         if (lic && lic->lic_lmm) {
583                 struct lov_mds_md *lmm = lic->lic_lmm;
584                 int size;
585
586                 /* XXX This should probably not be an error in the future,
587                  *     when we allow LOV OSTs to be added.
588                  */
589                 if (lmm->lmm_easize != ll_mds_easize(inode->i_sb)) {
590                         CERROR("Striping metadata size error %ld\n",
591                                inode->i_ino);
592                         LBUG();
593                 }
594                 size = ll_ost_easize(inode->i_sb);
595                 OBD_ALLOC(lli->lli_smd, size);
596                 if (!lli->lli_smd) {
597                         CERROR("No memory for %d\n", size);
598                         LBUG();
599                 }
600                 lov_unpackmd(lli->lli_smd, lmm);
601         } else {
602                 lli->lli_smd = NULL;
603         }
604
605         /* Get the authoritative file size */
606         if (lli->lli_smd && (inode->i_mode & S_IFREG)) {
607                 int rc;
608
609                 rc = ll_file_size(inode, lli->lli_smd);
610                 if (rc) {
611                         CERROR("ll_file_size: %d\n", rc);
612                         /* FIXME: need to somehow prevent inode creation */
613                         LBUG();
614                 }
615         }
616
617         /* OIDEBUG(inode); */
618
619         if (S_ISREG(inode->i_mode)) {
620                 inode->i_op = &ll_file_inode_operations;
621                 inode->i_fop = &ll_file_operations;
622                 inode->i_mapping->a_ops = &ll_aops;
623                 EXIT;
624         } else if (S_ISDIR(inode->i_mode)) {
625                 inode->i_op = &ll_dir_inode_operations;
626                 inode->i_fop = &ll_dir_operations;
627                 inode->i_mapping->a_ops = &ll_dir_aops;
628                 EXIT;
629         } else if (S_ISLNK(inode->i_mode)) {
630                 inode->i_op = &ll_fast_symlink_inode_operations;
631                 EXIT;
632         } else {
633                 init_special_inode(inode, inode->i_mode, inode->i_rdev);
634                 EXIT;
635         }
636 }
637
638 static inline void invalidate_request_list(struct list_head *req_list)
639 {
640         struct list_head *tmp, *n;
641         list_for_each_safe(tmp, n, req_list) {
642                 struct ptlrpc_request *req =
643                         list_entry(tmp, struct ptlrpc_request, rq_list);
644                 CERROR("invalidating req xid "LPD64" op %d to %s:%d\n",
645                        (unsigned long long)req->rq_xid, req->rq_reqmsg->opc,
646                        req->rq_connection->c_remote_uuid,
647                        req->rq_import->imp_client->cli_request_portal);
648                 req->rq_flags |= PTL_RPC_FL_ERR;
649                 wake_up(&req->rq_wait_for_rep);
650         }
651 }
652
653 void ll_umount_begin(struct super_block *sb)
654 {
655         struct ll_sb_info *sbi = ll_s2sbi(sb);
656         struct list_head *ctmp;
657
658         ENTRY;
659
660         list_for_each(ctmp, &sbi->ll_conn_chain) {
661                 struct ptlrpc_connection *conn;
662                 conn = list_entry(ctmp, struct ptlrpc_connection, c_sb_chain);
663
664                 spin_lock(&conn->c_lock);
665                 /* XXX should just be dealing with imports, probably through
666                  * XXX iocontrol, need next-gen recovery! */
667                 conn->c_flags |= CONN_INVALID;
668                 invalidate_request_list(&conn->c_sending_head);
669                 invalidate_request_list(&conn->c_delayed_head);
670                 spin_unlock(&conn->c_lock);
671         }
672
673         EXIT;
674 }
675
676 /* exported operations */
677 struct super_operations ll_super_operations =
678 {
679         read_inode2: ll_read_inode2,
680         clear_inode: ll_clear_inode,
681         delete_inode: ll_delete_inode,
682         put_super: ll_put_super,
683         statfs: ll_statfs,
684         umount_begin: ll_umount_begin
685 };
686
687 struct file_system_type lustre_lite_fs_type = {
688         "lustre_lite", 0, ll_read_super, NULL
689 };
690
691 static int __init init_lustre_lite(void)
692 {
693         printk(KERN_INFO "Lustre Lite 0.5.14, info@clusterfs.com\n");
694         ll_file_data_slab = kmem_cache_create("ll_file_data",
695                                               sizeof(struct ll_file_data), 0,
696                                               SLAB_HWCACHE_ALIGN, NULL, NULL);
697         if (ll_file_data_slab == NULL)
698                 return -ENOMEM;
699         return register_filesystem(&lustre_lite_fs_type);
700 }
701
702 static void __exit exit_lustre_lite(void)
703 {
704         unregister_filesystem(&lustre_lite_fs_type);
705         kmem_cache_destroy(ll_file_data_slab);
706 }
707
708 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
709 MODULE_DESCRIPTION("Lustre Lite Client File System v1.0");
710 MODULE_LICENSE("GPL");
711
712 module_init(init_lustre_lite);
713 module_exit(exit_lustre_lite);
714 #endif