1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Lustre Light Super operations
6 * Copyright (c) 2002, 2003 Cluster File Systems, Inc.
8 * This file is part of Lustre, http://www.lustre.org.
10 * Lustre is free software; you can redistribute it and/or
11 * modify it under the terms of version 2 of the GNU General Public
12 * License as published by the Free Software Foundation.
14 * Lustre is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with Lustre; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #define DEBUG_SUBSYSTEM S_LLITE
26 #include <linux/module.h>
27 #include <linux/types.h>
28 #include <linux/random.h>
29 #include <linux/version.h>
31 #include <linux/lustre_lite.h>
32 #include <linux/lustre_ha.h>
33 #include <linux/lustre_dlm.h>
34 #include <linux/lprocfs_status.h>
35 #include "llite_internal.h"
37 kmem_cache_t *ll_file_data_slab;
39 extern struct address_space_operations ll_aops;
40 extern struct address_space_operations ll_dir_aops;
43 #define log2(n) ffz(~(n))
46 struct ll_sb_info *lustre_init_sbi(struct super_block *sb)
48 struct ll_sb_info *sbi = NULL;
52 OBD_ALLOC(sbi, sizeof(*sbi));
56 spin_lock_init(&sbi->ll_lock);
57 INIT_LIST_HEAD(&sbi->ll_pglist);
58 sbi->ll_pglist_gen = 0;
59 sbi->ll_max_read_ahead_pages = SBI_DEFAULT_RA_MAX;
60 INIT_LIST_HEAD(&sbi->ll_conn_chain);
61 INIT_HLIST_HEAD(&sbi->ll_orphan_dentry_list);
62 INIT_LIST_HEAD(&sbi->ll_mnt_list);
63 sema_init(&sbi->ll_gns_sem, 1);
64 init_completion(&sbi->ll_gns_completion);
65 sbi->ll_gns_state = LL_GNS_STATE_IDLE;
66 sbi->ll_gns_timer.data = (unsigned long)sbi;
67 sbi->ll_gns_timer.function = ll_gns_timer_callback;
68 init_timer(&sbi->ll_gns_timer);
69 INIT_LIST_HEAD(&sbi->ll_gns_sbi_head);
73 generate_random_uuid(uuid);
74 class_uuid_unparse(uuid, &sbi->ll_sb_uuid);
78 void lustre_free_sbi(struct super_block *sb)
80 struct ll_sb_info *sbi = ll_s2sbi(sb);
84 list_del(&sbi->ll_gns_sbi_head);
85 del_timer(&sbi->ll_gns_timer);
86 OBD_FREE(sbi, sizeof(*sbi));
92 int lustre_init_ea_size(struct ll_sb_info *sbi)
97 /* OSC may have larger ea size */
98 valsize = sizeof(desc);
99 rc = obd_get_info(sbi->ll_osc_exp, strlen("lovdesc") + 1, "lovdesc",
102 obd_init_ea_size(sbi->ll_mdc_exp,
103 obd_size_diskmd(sbi->ll_osc_exp, NULL),
104 desc.ld_tgt_count*sizeof(struct llog_cookie));
106 /* declare ourself as real client. not connection
108 * FIXME: remove fake valsize, mdsize --bzzz */
109 rc = obd_set_info(sbi->ll_mdc_exp, strlen("client"),
110 "client", valsize, &desc);
115 int lustre_common_fill_super(struct super_block *sb, char *mdc, char *osc)
117 struct inode *root = 0;
118 struct ll_sb_info *sbi = ll_s2sbi(sb);
119 struct obd_device *obd;
120 struct ll_fid rootfid;
121 struct obd_statfs osfs;
122 struct ptlrpc_request *request = NULL;
123 struct lustre_handle osc_conn = {0, };
124 struct lustre_handle mdc_conn = {0, };
129 obd = class_name2obd(mdc);
131 CERROR("MDC %s: not setup or attached\n", mdc);
135 if (proc_lustre_fs_root) {
136 err = lprocfs_register_mountpoint(proc_lustre_fs_root, sb,
139 CERROR("could not register mount in /proc/lustre");
142 err = obd_connect(&mdc_conn, obd, &sbi->ll_sb_uuid);
144 CERROR("An MDS (mdc %s) is performing recovery, of which this"
145 " client is not a part. Please wait for recovery to "
146 "complete, abort, or time out.\n", mdc);
149 CERROR("cannot connect to %s: rc = %d\n", mdc, err);
152 sbi->ll_mdc_exp = class_conn2export(&mdc_conn);
154 err = obd_statfs(obd, &osfs, jiffies - HZ);
158 LASSERT(osfs.os_bsize);
159 sb->s_blocksize = osfs.os_bsize;
160 sb->s_blocksize_bits = log2(osfs.os_bsize);
161 sb->s_magic = LL_SUPER_MAGIC;
162 sb->s_maxbytes = PAGE_CACHE_MAXBYTES;
164 devno = get_uuid2int(sbi->ll_mdc_exp->exp_obd->obd_uuid.uuid,
165 strlen(sbi->ll_mdc_exp->exp_obd->obd_uuid.uuid));
169 obd = class_name2obd(osc);
171 CERROR("OSC %s: not setup or attached\n", osc);
175 err = obd_connect(&osc_conn, obd, &sbi->ll_sb_uuid);
177 CERROR("An OST (osc %s) is performing recovery, of which this"
178 " client is not a part. Please wait for recovery to "
179 "complete, abort, or time out.\n", osc);
182 CERROR("cannot connect to %s: rc = %d\n", osc, err);
185 sbi->ll_osc_exp = class_conn2export(&osc_conn);
187 lustre_init_ea_size(sbi);
189 err = md_getstatus(sbi->ll_mdc_exp, &rootfid);
191 CERROR("cannot mds_connect: rc = %d\n", err);
194 CDEBUG(D_SUPER, "rootfid "LPU64"\n", rootfid.id);
195 sbi->ll_rootino = rootfid.id;
197 sb->s_op = &lustre_super_operations;
200 * XXX: move this to after cbd setup? */
201 err = md_getattr(sbi->ll_mdc_exp, &rootfid,
202 OBD_MD_FLNOTOBD | OBD_MD_FLBLOCKS, 0, &request);
204 CERROR("md_getattr failed for root: rc = %d\n", err);
208 err = mdc_req2lustre_md(sbi->ll_mdc_exp, request, 0,
209 sbi->ll_osc_exp, &md);
211 CERROR("failed to understand root inode md: rc = %d\n",err);
212 ptlrpc_req_finished (request);
216 LASSERT(sbi->ll_rootino != 0);
217 root = ll_iget(sb, sbi->ll_rootino, &md);
219 ptlrpc_req_finished(request);
221 if (root == NULL || is_bad_inode(root)) {
222 /* XXX might need iput() for bad inode */
223 CERROR("lustre_lite: bad iget4 for root\n");
224 GOTO(out_root, err = -EBADF);
227 err = ll_close_thread_start(&sbi->ll_lcq);
229 CERROR("cannot start close thread: rc %d\n", err);
233 ll_gns_add_timer(sbi);
235 /* making vm readahead 0 for 2.4.x. In the case of 2.6.x,
236 backing dev info assigned to inode mapping is used for
237 determining maximal readahead. */
238 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
239 /* bug 2805 - set VM readahead to zero */
240 vm_max_readahead = vm_min_readahead = 0;
243 sb->s_root = d_alloc_root(root);
246 CWARN("Enabling PDIROPS\n");
247 sb->s_flags |= S_PDIROPS;
256 obd_disconnect(sbi->ll_osc_exp, 0);
258 obd_disconnect(sbi->ll_mdc_exp, 0);
260 lprocfs_unregister_mountpoint(sbi);
264 void lustre_common_put_super(struct super_block *sb)
266 struct ll_sb_info *sbi = ll_s2sbi(sb);
267 struct hlist_node *tmp, *next;
270 ll_gns_del_timer(sbi);
272 ll_close_thread_shutdown(sbi->ll_lcq);
274 list_del(&sbi->ll_conn_chain);
275 obd_disconnect(sbi->ll_osc_exp, 0);
277 lprocfs_unregister_mountpoint(sbi);
278 if (sbi->ll_proc_root) {
279 lprocfs_remove(sbi->ll_proc_root);
280 sbi->ll_proc_root = NULL;
283 obd_disconnect(sbi->ll_mdc_exp, 0);
285 // We do this to get rid of orphaned dentries. That is not really trw.
286 spin_lock(&dcache_lock);
287 hlist_for_each_safe(tmp, next, &sbi->ll_orphan_dentry_list) {
288 struct dentry *dentry = hlist_entry(tmp, struct dentry, d_hash);
289 CWARN("orphan dentry %*s (%p) at unmount\n",
290 dentry->d_name.len, dentry->d_name.name, dentry);
291 shrink_dcache_parent(dentry);
293 spin_unlock(&dcache_lock);
298 char *ll_read_opt(const char *opt, char *data)
304 CDEBUG(D_SUPER, "option: %s, data %s\n", opt, data);
305 if (strncmp(opt, data, strlen(opt)))
307 if ((value = strchr(data, '=')) == NULL)
311 OBD_ALLOC(retval, strlen(value) + 1);
313 CERROR("out of memory!\n");
317 memcpy(retval, value, strlen(value)+1);
318 CDEBUG(D_SUPER, "Assigned option: %s, value %s\n", opt, retval);
322 int ll_set_opt(const char *opt, char *data, int fl)
326 CDEBUG(D_SUPER, "option: %s, data %s\n", opt, data);
327 if (strncmp(opt, data, strlen(opt)))
333 void ll_options(char *options, char **ost, char **mdc, int *flags)
336 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
337 char *opt_ptr = options;
346 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
347 for (this_char = strtok (options, ",");
349 this_char = strtok (NULL, ",")) {
351 while ((this_char = strsep (&opt_ptr, ",")) != NULL) {
353 CDEBUG(D_SUPER, "this_char %s\n", this_char);
354 if (!*ost && (*ost = ll_read_opt("osc", this_char)))
356 if (!*mdc && (*mdc = ll_read_opt("mdc", this_char)))
358 if (!(*flags & LL_SBI_NOLCK) &&
359 ((*flags) = (*flags) |
360 ll_set_opt("nolock", this_char,
367 void ll_lli_init(struct ll_inode_info *lli)
369 sema_init(&lli->lli_open_sem, 1);
371 lli->lli_maxbytes = PAGE_CACHE_MAXBYTES;
372 spin_lock_init(&lli->lli_lock);
373 INIT_LIST_HEAD(&lli->lli_pending_write_llaps);
376 int ll_fill_super(struct super_block *sb, void *data, int silent)
378 struct ll_sb_info *sbi;
384 CDEBUG(D_VFSTRACE, "VFS Op: sb %p\n", sb);
386 sbi = lustre_init_sbi(sb);
390 sbi->ll_flags |= LL_SBI_READAHEAD;
391 ll_options(data, &osc, &mdc, &sbi->ll_flags);
395 GOTO(out, err = -EINVAL);
400 GOTO(out, err = -EINVAL);
403 err = lustre_common_fill_super(sb, mdc, osc);
409 OBD_FREE(mdc, strlen(mdc) + 1);
411 OBD_FREE(osc, strlen(osc) + 1);
414 } /* ll_read_super */
416 static int lustre_process_log(struct lustre_mount_data *lmd, char *profile,
417 struct config_llog_instance *cfg, int allow_recov)
419 struct lustre_cfg lcfg;
420 struct portals_cfg pcfg;
421 char * peer = "MDS_PEER_UUID";
422 struct obd_device *obd;
423 struct lustre_handle mdc_conn = {0, };
424 struct obd_export *exp;
425 char * name = "mdc_dev";
427 struct obd_uuid mdc_uuid;
428 struct llog_ctxt *ctxt;
433 if (lmd_bad_magic(lmd))
436 generate_random_uuid(uuid);
437 class_uuid_unparse(uuid, &mdc_uuid);
439 if (lmd->lmd_local_nid) {
440 PCFG_INIT(pcfg, NAL_CMD_REGISTER_MYNID);
441 pcfg.pcfg_nal = lmd->lmd_nal;
442 pcfg.pcfg_nid = lmd->lmd_local_nid;
443 err = libcfs_nal_cmd(&pcfg);
448 if (lmd->lmd_nal == SOCKNAL) {
449 PCFG_INIT(pcfg, NAL_CMD_ADD_AUTOCONN);
450 pcfg.pcfg_nal = lmd->lmd_nal;
451 pcfg.pcfg_nid = lmd->lmd_server_nid;
452 pcfg.pcfg_id = lmd->lmd_server_ipaddr;
453 pcfg.pcfg_misc = lmd->lmd_port;
454 pcfg.pcfg_size = 8388608;
455 pcfg.pcfg_flags = 0x4; /*share*/
456 err = libcfs_nal_cmd(&pcfg);
461 LCFG_INIT(lcfg, LCFG_ADD_UUID, name);
462 lcfg.lcfg_nid = lmd->lmd_server_nid;
463 lcfg.lcfg_inllen1 = strlen(peer) + 1;
464 lcfg.lcfg_inlbuf1 = peer;
465 lcfg.lcfg_nal = lmd->lmd_nal;
466 err = class_process_config(&lcfg);
468 GOTO(out_del_conn, err);
470 LCFG_INIT(lcfg, LCFG_ATTACH, name);
471 lcfg.lcfg_inlbuf1 = "mdc";
472 lcfg.lcfg_inllen1 = strlen(lcfg.lcfg_inlbuf1) + 1;
473 lcfg.lcfg_inlbuf2 = mdc_uuid.uuid;
474 lcfg.lcfg_inllen2 = strlen(lcfg.lcfg_inlbuf2) + 1;
475 err = class_process_config(&lcfg);
477 GOTO(out_del_uuid, err);
479 LCFG_INIT(lcfg, LCFG_SETUP, name);
480 lcfg.lcfg_inlbuf1 = lmd->lmd_mds;
481 lcfg.lcfg_inllen1 = strlen(lcfg.lcfg_inlbuf1) + 1;
482 lcfg.lcfg_inlbuf2 = peer;
483 lcfg.lcfg_inllen2 = strlen(lcfg.lcfg_inlbuf2) + 1;
484 err = class_process_config(&lcfg);
486 GOTO(out_detach, err);
488 obd = class_name2obd(name);
490 GOTO(out_cleanup, err = -EINVAL);
492 /* Disable initial recovery on this import */
493 err = obd_set_info(obd->obd_self_export,
494 strlen("initial_recov"), "initial_recov",
495 sizeof(allow_recov), &allow_recov);
497 GOTO(out_cleanup, err);
499 err = obd_connect(&mdc_conn, obd, &mdc_uuid);
501 CERROR("cannot connect to %s: rc = %d\n", lmd->lmd_mds, err);
502 GOTO(out_cleanup, err);
505 exp = class_conn2export(&mdc_conn);
507 ctxt = llog_get_context(&exp->exp_obd->obd_llogs,LLOG_CONFIG_REPL_CTXT);
508 rc = class_config_process_llog(ctxt, profile, cfg);
510 CERROR("class_config_process_llog failed: rc = %d\n", rc);
512 err = obd_disconnect(exp, 0);
515 LCFG_INIT(lcfg, LCFG_CLEANUP, name);
516 err = class_process_config(&lcfg);
521 LCFG_INIT(lcfg, LCFG_DETACH, name);
522 err = class_process_config(&lcfg);
527 LCFG_INIT(lcfg, LCFG_DEL_UUID, name);
528 lcfg.lcfg_inllen1 = strlen(peer) + 1;
529 lcfg.lcfg_inlbuf1 = peer;
530 err = class_process_config(&lcfg);
533 if (lmd->lmd_nal == SOCKNAL) {
534 PCFG_INIT(pcfg, NAL_CMD_DEL_AUTOCONN);
535 pcfg.pcfg_nal = lmd->lmd_nal;
536 pcfg.pcfg_nid = lmd->lmd_server_nid;
537 pcfg.pcfg_id = lmd->lmd_server_ipaddr;
538 pcfg.pcfg_flags = 1; /*share*/
539 err = libcfs_nal_cmd(&pcfg);
550 int lustre_fill_super(struct super_block *sb, void *data, int silent)
552 struct lustre_mount_data * lmd = data;
553 struct ll_sb_info *sbi;
559 CDEBUG(D_VFSTRACE, "VFS Op: sb %p\n", sb);
560 if (lmd_bad_magic(lmd))
563 sbi = lustre_init_sbi(sb);
567 sbi->ll_flags |= LL_SBI_READAHEAD;
569 if (lmd->lmd_profile) {
570 struct lustre_profile *lprof;
571 struct config_llog_instance cfg;
574 if (lmd->lmd_mds[0] == '\0') {
575 CERROR("no mds name\n");
576 GOTO(out_free, err = -EINVAL);
579 OBD_ALLOC(sbi->ll_lmd, sizeof(*sbi->ll_lmd));
580 if (sbi->ll_lmd == NULL)
581 GOTO(out_free, err = -ENOMEM);
582 memcpy(sbi->ll_lmd, lmd, sizeof(*lmd));
584 /* generate a string unique to this super, let's try
585 the address of the super itself.*/
586 len = (sizeof(sb) * 2) + 1;
587 OBD_ALLOC(sbi->ll_instance, len);
588 if (sbi->ll_instance == NULL)
589 GOTO(out_free, err = -ENOMEM);
590 sprintf(sbi->ll_instance, "%p", sb);
592 cfg.cfg_instance = sbi->ll_instance;
593 cfg.cfg_uuid = sbi->ll_sb_uuid;
594 cfg.cfg_local_nid = lmd->lmd_local_nid;
595 err = lustre_process_log(lmd, lmd->lmd_profile, &cfg, 0);
597 CERROR("Unable to process log: %s\n", lmd->lmd_profile);
601 lprof = class_get_profile(lmd->lmd_profile);
603 CERROR("No profile found: %s\n", lmd->lmd_profile);
604 GOTO(out_free, err = -EINVAL);
607 OBD_FREE(osc, strlen(osc) + 1);
608 OBD_ALLOC(osc, strlen(lprof->lp_osc) +
609 strlen(sbi->ll_instance) + 2);
610 sprintf(osc, "%s-%s", lprof->lp_osc, sbi->ll_instance);
613 OBD_FREE(mdc, strlen(mdc) + 1);
614 OBD_ALLOC(mdc, strlen(lprof->lp_mdc) +
615 strlen(sbi->ll_instance) + 2);
616 sprintf(mdc, "%s-%s", lprof->lp_mdc, sbi->ll_instance);
621 GOTO(out_free, err = -EINVAL);
626 GOTO(out_free, err = -EINVAL);
629 err = lustre_common_fill_super(sb, mdc, osc);
636 OBD_FREE(mdc, strlen(mdc) + 1);
638 OBD_FREE(osc, strlen(osc) + 1);
644 int len = strlen(sbi->ll_lmd->lmd_profile) + sizeof("-clean")+1;
647 if (sbi->ll_instance != NULL) {
648 struct lustre_mount_data *lmd = sbi->ll_lmd;
650 struct config_llog_instance cfg;
652 cfg.cfg_instance = sbi->ll_instance;
653 cfg.cfg_uuid = sbi->ll_sb_uuid;
655 OBD_ALLOC(cln_prof, len);
656 sprintf(cln_prof, "%s-clean", lmd->lmd_profile);
658 err = lustre_process_log(lmd, cln_prof, &cfg, 0);
660 CERROR("Unable to process log: %s\n", cln_prof);
661 OBD_FREE(cln_prof, len);
662 OBD_FREE(sbi->ll_instance, strlen(sbi->ll_instance)+ 1);
664 OBD_FREE(sbi->ll_lmd, sizeof(*sbi->ll_lmd));
669 } /* lustre_fill_super */
671 static void lustre_manual_cleanup(struct ll_sb_info *sbi)
673 struct lustre_cfg lcfg;
674 struct obd_device *obd;
677 while ((obd = class_devices_in_group(&sbi->ll_sb_uuid, &next)) != NULL)
681 LCFG_INIT(lcfg, LCFG_CLEANUP, obd->obd_name);
682 err = class_process_config(&lcfg);
684 CERROR("cleanup failed: %s\n", obd->obd_name);
688 LCFG_INIT(lcfg, LCFG_DETACH, obd->obd_name);
689 err = class_process_config(&lcfg);
691 CERROR("detach failed: %s\n", obd->obd_name);
696 if (sbi->ll_lmd != NULL)
697 class_del_profile(sbi->ll_lmd->lmd_profile);
700 void lustre_put_super(struct super_block *sb)
702 struct obd_device *obd;
703 struct ll_sb_info *sbi = ll_s2sbi(sb);
704 int force_umount = 0;
707 CDEBUG(D_VFSTRACE, "VFS Op: sb %p\n", sb);
708 obd = class_exp2obd(sbi->ll_mdc_exp);
710 force_umount = obd->obd_no_recov;
713 lustre_common_put_super(sb);
715 if (sbi->ll_lmd != NULL) {
717 int len = strlen(sbi->ll_lmd->lmd_profile) + sizeof("-clean")+1;
719 struct config_llog_instance cfg;
722 CERROR("force umount, doing manual cleanup\n");
723 lustre_manual_cleanup(sbi);
727 cfg.cfg_instance = sbi->ll_instance;
728 cfg.cfg_uuid = sbi->ll_sb_uuid;
730 OBD_ALLOC(cln_prof, len);
731 sprintf(cln_prof, "%s-clean", sbi->ll_lmd->lmd_profile);
733 err = lustre_process_log(sbi->ll_lmd, cln_prof, &cfg, 0);
735 CERROR("Unable to process log: %s, doing manual cleanup"
737 lustre_manual_cleanup(sbi);
740 OBD_FREE(cln_prof, len);
742 OBD_FREE(sbi->ll_lmd, sizeof(*sbi->ll_lmd));
743 OBD_FREE(sbi->ll_instance, strlen(sbi->ll_instance) + 1);
749 } /* lustre_put_super */
751 int ll_process_config_update(struct ll_sb_info *sbi, int clean)
753 struct obd_export *mdc_exp = sbi->ll_mdc_exp;
754 struct lustre_mount_data *lmd = sbi->ll_lmd;
755 struct llog_ctxt *ctxt;
756 struct config_llog_instance cfg;
757 char *profile = lmd->lmd_profile, *name = NULL;
758 int rc, namelen = 0, version;
764 CERROR("Client not mounted with zero-conf; cannot process "
769 rc = ldlm_cli_cancel_unused(mdc_exp->exp_obd->obd_namespace, NULL,
770 LDLM_FL_CONFIG_CHANGE, NULL);
772 CWARN("ldlm_cli_cancel_unused(mdc): %d\n", rc);
774 rc = obd_cancel_unused(sbi->ll_osc_exp, NULL, LDLM_FL_CONFIG_CHANGE,
777 CWARN("obd_cancel_unused(lov): %d\n", rc);
779 cfg.cfg_instance = sbi->ll_instance;
780 cfg.cfg_uuid = sbi->ll_sb_uuid;
781 cfg.cfg_local_nid = lmd->lmd_local_nid;
783 namelen = strlen(profile) + 20; /* -clean-######### */
784 OBD_ALLOC(name, namelen);
789 version = sbi->ll_config_version - 1;
790 sprintf(name, "%s-clean-%d", profile, version);
792 version = sbi->ll_config_version + 1;
793 sprintf(name, "%s-%d", profile, version);
796 CWARN("Applying configuration log %s\n", name);
798 ctxt = llog_get_context(&mdc_exp->exp_obd->obd_llogs,
799 LLOG_CONFIG_REPL_CTXT);
800 rc = class_config_process_llog(ctxt, name, &cfg);
802 sbi->ll_config_version = version;
803 CWARN("Finished applying configuration log %s: %d\n", name, rc);
805 if (rc == 0 && clean == 0) {
806 struct lov_desc desc;
808 valsize = sizeof(desc);
809 rc = obd_get_info(sbi->ll_osc_exp, strlen("lovdesc") + 1,
810 "lovdesc", &valsize, &desc);
812 rc = obd_init_ea_size(mdc_exp,
813 obd_size_diskmd(sbi->ll_osc_exp, NULL),
815 sizeof(struct llog_cookie)));
817 OBD_FREE(name, namelen);
821 struct inode *ll_inode_from_lock(struct ldlm_lock *lock)
824 l_lock(&lock->l_resource->lr_namespace->ns_lock);
825 if (lock->l_ast_data)
826 inode = igrab(lock->l_ast_data);
829 l_unlock(&lock->l_resource->lr_namespace->ns_lock);
833 int null_if_equal(struct ldlm_lock *lock, void *data)
835 if (data == lock->l_ast_data)
836 lock->l_ast_data = NULL;
838 if (lock->l_req_mode != lock->l_granted_mode)
839 return LDLM_ITER_STOP;
841 return LDLM_ITER_CONTINUE;
844 void ll_clear_inode(struct inode *inode)
847 struct ll_inode_info *lli = ll_i2info(inode);
848 struct ll_sb_info *sbi = ll_i2sbi(inode);
851 CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", inode->i_ino,
852 inode->i_generation, inode);
854 ll_inode2fid(&fid, inode);
855 clear_bit(LLI_F_HAVE_MDS_SIZE_LOCK, &(ll_i2info(inode)->lli_flags));
856 md_change_cbdata(sbi->ll_mdc_exp, &fid, null_if_equal, inode);
859 obd_change_cbdata(sbi->ll_osc_exp, lli->lli_smd,
860 null_if_equal, inode);
863 obd_free_memmd(sbi->ll_osc_exp, &lli->lli_smd);
868 /* FIXME: change cbdata for mea here */
869 obd_free_memmd(sbi->ll_mdc_exp,
870 (struct lov_stripe_md **) &lli->lli_mea);
874 if (lli->lli_symlink_name) {
875 OBD_FREE(lli->lli_symlink_name,
876 strlen(lli->lli_symlink_name) + 1);
877 lli->lli_symlink_name = NULL;
883 /* If this inode has objects allocated to it (lsm != NULL), then the OST
884 * object(s) determine the file size and mtime. Otherwise, the MDS will
885 * keep these values until such a time that objects are allocated for it.
886 * We do the MDS operations first, as it is checking permissions for us.
887 * We don't to the MDS RPC if there is nothing that we want to store there,
888 * otherwise there is no harm in updating mtime/atime on the MDS if we are
889 * going to do an RPC anyways.
891 * If we are doing a truncate, we will send the mtime and ctime updates
892 * to the OST with the punch RPC, otherwise we do an explicit setattr RPC.
893 * I don't believe it is possible to get e.g. ATTR_MTIME_SET and ATTR_SIZE
896 int ll_setattr_raw(struct inode *inode, struct iattr *attr)
898 struct lov_stripe_md *lsm = ll_i2info(inode)->lli_smd;
899 struct ll_sb_info *sbi = ll_i2sbi(inode);
900 struct ptlrpc_request *request = NULL;
901 struct mdc_op_data op_data;
902 int ia_valid = attr->ia_valid;
906 CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu\n", inode->i_ino);
907 lprocfs_counter_incr(ll_i2sbi(inode)->ll_stats, LPROC_LL_SETATTR);
909 if (ia_valid & ATTR_SIZE) {
910 if (attr->ia_size > ll_file_maxbytes(inode)) {
911 CDEBUG(D_INODE, "file too large %llu > "LPU64"\n",
912 attr->ia_size, ll_file_maxbytes(inode));
916 attr->ia_valid |= ATTR_MTIME | ATTR_CTIME;
919 /* POSIX: check before ATTR_*TIME_SET set (from inode_change_ok) */
920 if (ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET)) {
921 if (current->fsuid != inode->i_uid && !capable(CAP_FOWNER))
925 /* We mark all of the fields "set" so MDS/OST does not re-set them */
926 if (attr->ia_valid & ATTR_CTIME) {
927 attr->ia_ctime = CURRENT_TIME;
928 attr->ia_valid |= ATTR_CTIME_SET;
930 if (!(ia_valid & ATTR_ATIME_SET) && (attr->ia_valid & ATTR_ATIME)) {
931 attr->ia_atime = CURRENT_TIME;
932 attr->ia_valid |= ATTR_ATIME_SET;
934 if (!(ia_valid & ATTR_MTIME_SET) && (attr->ia_valid & ATTR_MTIME)) {
935 attr->ia_mtime = CURRENT_TIME;
936 attr->ia_valid |= ATTR_MTIME_SET;
939 if (attr->ia_valid & (ATTR_MTIME | ATTR_CTIME))
940 CDEBUG(D_INODE, "setting mtime %lu, ctime %lu, now = %lu\n",
941 LTIME_S(attr->ia_mtime), LTIME_S(attr->ia_ctime),
942 LTIME_S(CURRENT_TIME));
944 attr->ia_valid &= ~ATTR_SIZE;
946 /* If only OST attributes being set on objects, don't do MDS RPC.
947 * In that case, we need to check permissions and update the local
948 * inode ourselves so we can call obdo_from_inode() always. */
949 if (ia_valid & (lsm ? ~(ATTR_SIZE | ATTR_FROM_OPEN | ATTR_RAW) : ~0)) {
951 ll_prepare_mdc_op_data(&op_data, inode, NULL, NULL, 0, 0);
953 rc = md_setattr(sbi->ll_mdc_exp, &op_data,
954 attr, NULL, 0, NULL, 0, &request);
956 ptlrpc_req_finished(request);
957 if (rc != -EPERM && rc != -EACCES)
958 CERROR("md_setattr fails: rc = %d\n", rc);
962 rc = mdc_req2lustre_md(sbi->ll_mdc_exp, request, 0,
963 sbi->ll_osc_exp, &md);
965 ptlrpc_req_finished(request);
969 /* Won't invoke vmtruncate as we already cleared ATTR_SIZE,
970 * but needed to set timestamps backwards on utime. */
971 inode_setattr(inode, attr);
972 ll_update_inode(inode, &md);
973 ptlrpc_req_finished(request);
975 if (!lsm || !S_ISREG(inode->i_mode)) {
976 CDEBUG(D_INODE, "no lsm: not setting attrs on OST\n");
980 /* The OST doesn't check permissions, but the alternative is
981 * a gratuitous RPC to the MDS. We already rely on the client
982 * to do read/write/truncate permission checks, so is mtime OK?
984 if (ia_valid & (ATTR_MTIME | ATTR_ATIME)) {
985 /* from sys_utime() */
986 if (!(ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET))) {
987 if (current->fsuid != inode->i_uid &&
988 (rc=ll_permission(inode,MAY_WRITE,NULL))!=0)
991 /* from inode_change_ok() */
992 if (current->fsuid != inode->i_uid &&
993 !capable(CAP_FOWNER))
998 /* Won't invoke vmtruncate, as we already cleared ATTR_SIZE */
999 inode_setattr(inode, attr);
1002 /* We really need to get our PW lock before we change inode->i_size.
1003 * If we don't we can race with other i_size updaters on our node, like
1004 * ll_file_read. We can also race with i_size propogation to other
1005 * nodes through dirtying and writeback of final cached pages. This
1006 * last one is especially bad for racing o_append users on other
1008 if (ia_valid & ATTR_SIZE) {
1009 ldlm_policy_data_t policy = { .l_extent = {attr->ia_size,
1011 struct lustre_handle lockh = { 0 };
1012 int err, ast_flags = 0;
1013 /* XXX when we fix the AST intents to pass the discard-range
1014 * XXX extent, make ast_flags always LDLM_AST_DISCARD_DATA
1016 if (attr->ia_size == 0)
1017 ast_flags = LDLM_AST_DISCARD_DATA;
1019 /* bug 1639: avoid write/truncate i_sem/DLM deadlock */
1020 LASSERT(atomic_read(&inode->i_sem.count) <= 0);
1022 rc = ll_extent_lock(NULL, inode, lsm, LCK_PW, &policy, &lockh,
1024 down(&inode->i_sem);
1028 rc = vmtruncate(inode, attr->ia_size);
1030 /* We need to drop the semaphore here, because this unlock may
1031 * result in a cancellation, which will need the i_sem */
1033 /* unlock now as we don't mind others file lockers racing with
1034 * the mds updates below? */
1035 err = ll_extent_unlock(NULL, inode, lsm, LCK_PW, &lockh);
1036 down(&inode->i_sem);
1038 CERROR("ll_extent_unlock failed: %d\n", err);
1042 } else if (ia_valid & (ATTR_MTIME | ATTR_MTIME_SET)) {
1045 CDEBUG(D_INODE, "set mtime on OST inode %lu to %lu\n",
1046 inode->i_ino, LTIME_S(attr->ia_mtime));
1047 oa.o_id = lsm->lsm_object_id;
1048 oa.o_gr = lsm->lsm_object_gr;
1049 oa.o_valid = OBD_MD_FLID | OBD_MD_FLGROUP;
1050 obdo_from_inode(&oa, inode, OBD_MD_FLTYPE | OBD_MD_FLATIME |
1051 OBD_MD_FLMTIME | OBD_MD_FLCTIME);
1052 rc = obd_setattr(sbi->ll_osc_exp, &oa, lsm, NULL);
1054 CERROR("obd_setattr fails: rc=%d\n", rc);
1059 int ll_setattr(struct dentry *de, struct iattr *attr)
1061 LBUG(); /* code is unused, but leave this in case of VFS changes */
1065 int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs,
1066 unsigned long max_age)
1068 struct ll_sb_info *sbi = ll_s2sbi(sb);
1069 struct obd_statfs obd_osfs;
1073 rc = obd_statfs(class_exp2obd(sbi->ll_mdc_exp), osfs, max_age);
1075 CERROR("mdc_statfs fails: rc = %d\n", rc);
1079 osfs->os_type = sb->s_magic;
1081 CDEBUG(D_SUPER, "MDC blocks "LPU64"/"LPU64" objects "LPU64"/"LPU64"\n",
1082 osfs->os_bavail, osfs->os_blocks, osfs->os_ffree,osfs->os_files);
1084 rc = obd_statfs(class_exp2obd(sbi->ll_osc_exp), &obd_osfs, max_age);
1086 CERROR("obd_statfs fails: rc = %d\n", rc);
1090 CDEBUG(D_SUPER, "OSC blocks "LPU64"/"LPU64" objects "LPU64"/"LPU64"\n",
1091 obd_osfs.os_bavail, obd_osfs.os_blocks, obd_osfs.os_ffree,
1094 osfs->os_blocks = obd_osfs.os_blocks;
1095 osfs->os_bfree = obd_osfs.os_bfree;
1096 osfs->os_bavail = obd_osfs.os_bavail;
1098 /* If we don't have as many objects free on the OST as inodes
1099 * on the MDS, we reduce the total number of inodes to
1100 * compensate, so that the "inodes in use" number is correct.
1102 if (obd_osfs.os_ffree < osfs->os_ffree) {
1103 osfs->os_files = (osfs->os_files - osfs->os_ffree) +
1105 osfs->os_ffree = obd_osfs.os_ffree;
1111 int ll_statfs(struct super_block *sb, struct kstatfs *sfs)
1113 struct obd_statfs osfs;
1116 CDEBUG(D_VFSTRACE, "VFS Op:\n");
1117 lprocfs_counter_incr(ll_s2sbi(sb)->ll_stats, LPROC_LL_STAFS);
1119 /* For now we will always get up-to-date statfs values, but in the
1120 * future we may allow some amount of caching on the client (e.g.
1121 * from QOS or lprocfs updates). */
1122 rc = ll_statfs_internal(sb, &osfs, jiffies - 1);
1126 statfs_unpack(sfs, &osfs);
1128 if (sizeof(sfs->f_blocks) == 4) {
1129 while (osfs.os_blocks > ~0UL) {
1132 osfs.os_blocks >>= 1;
1133 osfs.os_bfree >>= 1;
1134 osfs.os_bavail >>= 1;
1138 sfs->f_blocks = osfs.os_blocks;
1139 sfs->f_bfree = osfs.os_bfree;
1140 sfs->f_bavail = osfs.os_bavail;
1145 void dump_lsm(int level, struct lov_stripe_md *lsm)
1147 CDEBUG(level, "objid "LPX64", maxbytes "LPX64", magic 0x%08X, "
1148 "stripe_size %u, stripe_count %u\n",
1149 lsm->lsm_object_id, lsm->lsm_maxbytes, lsm->lsm_magic,
1150 lsm->lsm_stripe_size, lsm->lsm_stripe_count);
1153 void ll_update_inode(struct inode *inode, struct lustre_md *md)
1155 struct ll_inode_info *lli = ll_i2info(inode);
1156 struct mds_body *body = md->body;
1157 struct lov_stripe_md *lsm = md->lsm;
1158 struct mea *mea = md->mea;
1161 LASSERT((lsm != NULL) == ((body->valid & OBD_MD_FLEASIZE) != 0));
1162 LASSERT((mea != NULL) == ((body->valid & OBD_MD_FLDIREA) != 0));
1164 LASSERT(lsm->lsm_object_gr > 0);
1165 if (lli->lli_smd == NULL) {
1167 lli->lli_maxbytes = lsm->lsm_maxbytes;
1168 if (lli->lli_maxbytes > PAGE_CACHE_MAXBYTES)
1169 lli->lli_maxbytes = PAGE_CACHE_MAXBYTES;
1172 if (memcmp(lli->lli_smd, lsm, sizeof(*lsm))) {
1173 CERROR("lsm mismatch for inode %ld\n",
1175 CERROR("lli_smd:\n");
1176 dump_lsm(D_ERROR, lli->lli_smd);
1178 dump_lsm(D_ERROR, lsm);
1181 /* XXX FIXME -- We should decide on a safer (atomic) and
1182 * more elegant way to update the lsm */
1183 for (i = 0; i < lsm->lsm_stripe_count; i++) {
1184 lli->lli_smd->lsm_oinfo[i].loi_id =
1185 lsm->lsm_oinfo[i].loi_id;
1186 lli->lli_smd->lsm_oinfo[i].loi_gr =
1187 lsm->lsm_oinfo[i].loi_gr;
1188 lli->lli_smd->lsm_oinfo[i].loi_ost_idx =
1189 lsm->lsm_oinfo[i].loi_ost_idx;
1190 lli->lli_smd->lsm_oinfo[i].loi_ost_gen =
1191 lsm->lsm_oinfo[i].loi_ost_gen;
1194 /* bug 2844 - limit i_blksize for broken user-space apps */
1195 LASSERTF(lsm->lsm_xfersize != 0, "%lu\n", lsm->lsm_xfersize);
1196 inode->i_blksize = min(lsm->lsm_xfersize, LL_MAX_BLKSIZE);
1197 if (lli->lli_smd != lsm)
1198 obd_free_memmd(ll_i2obdexp(inode), &lsm);
1202 if (lli->lli_mea == NULL) {
1205 if (memcmp(lli->lli_mea, mea, body->eadatasize)) {
1206 CERROR("mea mismatch for inode %lu\n",
1211 if (lli->lli_mea != mea)
1212 obd_free_memmd(ll_i2mdcexp(inode),
1213 (struct lov_stripe_md **) &mea);
1217 if (body->valid & OBD_MD_FLID)
1218 inode->i_ino = body->ino;
1219 if (body->valid & OBD_MD_FLATIME)
1220 LTIME_S(inode->i_atime) = body->atime;
1221 if (body->valid & OBD_MD_FLMTIME &&
1222 body->mtime > LTIME_S(inode->i_mtime)) {
1223 CDEBUG(D_INODE, "setting ino %lu mtime from %lu to %u\n",
1224 inode->i_ino, LTIME_S(inode->i_mtime), body->mtime);
1225 LTIME_S(inode->i_mtime) = body->mtime;
1227 if (body->valid & OBD_MD_FLCTIME &&
1228 body->ctime > LTIME_S(inode->i_ctime))
1229 LTIME_S(inode->i_ctime) = body->ctime;
1230 if (body->valid & OBD_MD_FLMODE)
1231 inode->i_mode = (inode->i_mode & S_IFMT)|(body->mode & ~S_IFMT);
1232 if (body->valid & OBD_MD_FLTYPE)
1233 inode->i_mode = (inode->i_mode & ~S_IFMT)|(body->mode & S_IFMT);
1234 if (body->valid & OBD_MD_FLUID)
1235 inode->i_uid = body->uid;
1236 if (body->valid & OBD_MD_FLGID)
1237 inode->i_gid = body->gid;
1238 if (body->valid & OBD_MD_FLFLAGS)
1239 inode->i_flags = body->flags;
1240 if (body->valid & OBD_MD_FLNLINK)
1241 inode->i_nlink = body->nlink;
1242 if (body->valid & OBD_MD_FLGENER)
1243 inode->i_generation = body->generation;
1244 if (body->valid & OBD_MD_FLRDEV)
1245 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
1246 inode->i_rdev = body->rdev;
1248 inode->i_rdev = old_decode_dev(body->rdev);
1250 if (body->valid & OBD_MD_FLSIZE)
1251 inode->i_size = body->size;
1252 if (body->valid & OBD_MD_FLBLOCKS)
1253 inode->i_blocks = body->blocks;
1255 if (body->valid & OBD_MD_FLSIZE)
1256 set_bit(LLI_F_HAVE_MDS_SIZE_LOCK, &lli->lli_flags);
1258 lli->lli_mds = body->mds;
1259 inode->i_dev = (kdev_t) body->mds;
1260 LASSERT(body->mds < 1000);
1263 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
1264 static struct backing_dev_info ll_backing_dev_info = {
1265 .ra_pages = 0, /* No readahead */
1266 .memory_backed = 0, /* Does contribute to dirty memory */
1270 void ll_read_inode2(struct inode *inode, void *opaque)
1272 struct lustre_md *md = opaque;
1273 struct ll_inode_info *lli = ll_i2info(inode);
1276 CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", inode->i_ino,
1277 inode->i_generation, inode);
1281 LASSERT(!lli->lli_smd);
1283 /* Core attributes from the MDS first. This is a new inode, and
1284 * the VFS doesn't zero times in the core inode so we have to do
1285 * it ourselves. They will be overwritten by either MDS or OST
1286 * attributes - we just need to make sure they aren't newer. */
1287 LTIME_S(inode->i_mtime) = 0;
1288 LTIME_S(inode->i_atime) = 0;
1289 LTIME_S(inode->i_ctime) = 0;
1292 ll_update_inode(inode, md);
1294 /* OIDEBUG(inode); */
1296 if (S_ISREG(inode->i_mode)) {
1297 inode->i_op = &ll_file_inode_operations;
1298 inode->i_fop = &ll_file_operations;
1299 inode->i_mapping->a_ops = &ll_aops;
1301 } else if (S_ISDIR(inode->i_mode)) {
1302 inode->i_op = &ll_dir_inode_operations;
1303 inode->i_fop = &ll_dir_operations;
1304 inode->i_mapping->a_ops = &ll_dir_aops;
1306 } else if (S_ISLNK(inode->i_mode)) {
1307 inode->i_op = &ll_fast_symlink_inode_operations;
1310 inode->i_op = &ll_special_inode_operations;
1312 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
1313 init_special_inode(inode, inode->i_mode,
1314 kdev_t_to_nr(inode->i_rdev));
1316 /* initializing backing dev info. */
1317 inode->i_mapping->backing_dev_info = &ll_backing_dev_info;
1319 init_special_inode(inode, inode->i_mode, inode->i_rdev);
1321 lli->ll_save_ifop = inode->i_fop;
1323 if (S_ISCHR(inode->i_mode))
1324 inode->i_fop = &ll_special_chr_inode_fops;
1325 else if (S_ISBLK(inode->i_mode))
1326 inode->i_fop = &ll_special_blk_inode_fops;
1327 else if (S_ISFIFO(inode->i_mode))
1328 inode->i_fop = &ll_special_fifo_inode_fops;
1329 else if (S_ISSOCK(inode->i_mode))
1330 inode->i_fop = &ll_special_sock_inode_fops;
1332 CWARN("saved %p, replaced with %p\n", lli->ll_save_ifop,
1335 if (lli->ll_save_ifop->owner) {
1336 CWARN("%p has owner %p\n", lli->ll_save_ifop,
1337 lli->ll_save_ifop->owner);
1343 void ll_delete_inode(struct inode *inode)
1347 struct ll_sb_info *sbi = ll_i2sbi(inode);
1350 ll_inode2fid(&fid, inode);
1352 rc = md_delete_object(sbi->ll_mdc_exp, &fid);
1354 CERROR("md_delete_object() failed, error %d.\n",
1362 int ll_iocontrol(struct inode *inode, struct file *file,
1363 unsigned int cmd, unsigned long arg)
1365 struct ll_sb_info *sbi = ll_i2sbi(inode);
1366 struct ptlrpc_request *req = NULL;
1371 case EXT3_IOC_GETFLAGS: {
1373 unsigned long valid = OBD_MD_FLFLAGS;
1374 struct mds_body *body;
1376 ll_inode2fid(&fid, inode);
1377 rc = md_getattr(sbi->ll_mdc_exp, &fid, valid, 0, &req);
1379 CERROR("failure %d inode %lu\n", rc, inode->i_ino);
1383 body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*body));
1385 if (body->flags & S_APPEND)
1386 flags |= EXT3_APPEND_FL;
1387 if (body->flags & S_IMMUTABLE)
1388 flags |= EXT3_IMMUTABLE_FL;
1389 if (body->flags & S_NOATIME)
1390 flags |= EXT3_NOATIME_FL;
1392 ptlrpc_req_finished (req);
1394 RETURN(put_user(flags, (int *)arg));
1396 case EXT3_IOC_SETFLAGS: {
1397 struct mdc_op_data op_data;
1400 struct lov_stripe_md *lsm = ll_i2info(inode)->lli_smd;
1402 if (get_user(flags, (int *)arg))
1409 ll_prepare_mdc_op_data(&op_data, inode, NULL, NULL, 0, 0);
1411 memset(&attr, 0x0, sizeof(attr));
1412 attr.ia_attr_flags = flags;
1413 attr.ia_valid |= ATTR_ATTR_FLAG;
1415 rc = md_setattr(sbi->ll_mdc_exp, &op_data,
1416 &attr, NULL, 0, NULL, 0, &req);
1418 ptlrpc_req_finished(req);
1419 if (rc != -EPERM && rc != -EACCES)
1420 CERROR("md_setattr fails: rc = %d\n", rc);
1424 ptlrpc_req_finished(req);
1426 oa->o_id = lsm->lsm_object_id;
1427 oa->o_gr = lsm->lsm_object_gr;
1428 oa->o_flags = flags;
1429 oa->o_valid = OBD_MD_FLID | OBD_MD_FLFLAGS | OBD_MD_FLGROUP;
1431 rc = obd_setattr(sbi->ll_osc_exp, oa, lsm, NULL);
1434 if (rc != -EPERM && rc != -EACCES)
1435 CERROR("md_setattr fails: rc = %d\n", rc);
1439 if (flags & EXT3_APPEND_FL)
1440 inode->i_flags |= S_APPEND;
1442 inode->i_flags &= ~S_APPEND;
1443 if (flags & EXT3_IMMUTABLE_FL)
1444 inode->i_flags |= S_IMMUTABLE;
1446 inode->i_flags &= ~S_IMMUTABLE;
1447 if (flags & EXT3_NOATIME_FL)
1448 inode->i_flags |= S_NOATIME;
1450 inode->i_flags &= ~S_NOATIME;
1461 void ll_umount_begin(struct super_block *sb)
1463 struct ll_sb_info *sbi = ll_s2sbi(sb);
1464 struct obd_device *obd;
1465 struct obd_ioctl_data ioc_data = { 0 };
1467 CDEBUG(D_VFSTRACE, "VFS Op:\n");
1469 obd = class_exp2obd(sbi->ll_mdc_exp);
1471 CERROR("Invalid MDC connection handle "LPX64"\n",
1472 sbi->ll_mdc_exp->exp_handle.h_cookie);
1476 obd->obd_no_recov = 1;
1477 obd_iocontrol(IOC_OSC_SET_ACTIVE, sbi->ll_mdc_exp, sizeof ioc_data,
1480 obd = class_exp2obd(sbi->ll_osc_exp);
1482 CERROR("Invalid LOV connection handle "LPX64"\n",
1483 sbi->ll_osc_exp->exp_handle.h_cookie);
1488 obd->obd_no_recov = 1;
1489 obd_iocontrol(IOC_OSC_SET_ACTIVE, sbi->ll_osc_exp, sizeof ioc_data,
1492 /* Really, we'd like to wait until there are no requests outstanding,
1493 * and then continue. For now, we just invalidate the requests,
1494 * schedule, and hope.
1501 int ll_prep_inode(struct obd_export *osc_exp, struct obd_export *mdc_exp,
1502 struct inode **inode, struct ptlrpc_request *req,
1503 int offset, struct super_block *sb)
1505 struct lustre_md md;
1508 rc = mdc_req2lustre_md(mdc_exp, req, offset, osc_exp, &md);
1513 ll_update_inode(*inode, &md);
1516 *inode = ll_iget(sb, md.body->ino, &md);
1517 if (*inode == NULL || is_bad_inode(*inode)) {
1518 /* free the lsm if we allocated one above */
1520 obd_free_memmd(osc_exp, &md.lsm);
1522 obd_free_memmd(mdc_exp,
1523 (struct lov_stripe_md**)&md.mea);
1525 CERROR("new_inode -fatal: rc %d\n", rc);