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