#include <linux/lustre_ha.h>
#include <linux/lustre_dlm.h>
#include <linux/lprocfs_status.h>
+#include <linux/lustre_snap.h>
#include "llite_internal.h"
kmem_cache_t *ll_file_data_slab;
valsize = sizeof(desc);
rc = obd_get_info(sbi->ll_osc_exp, strlen("lovdesc") + 1, "lovdesc",
&valsize, &desc);
- if (rc == 0) {
- obd_init_ea_size(sbi->ll_mdc_exp,
- obd_size_diskmd(sbi->ll_osc_exp, NULL),
- desc.ld_tgt_count*sizeof(struct llog_cookie));
-
- /* declare ourself as real client. not connection
- * from another MDS
- * FIXME: remove fake valsize, mdsize --bzzz */
- rc = obd_set_info(sbi->ll_mdc_exp, strlen("client"),
- "client", valsize, &desc);
- }
+ if (rc)
+ RETURN(rc);
+ obd_init_ea_size(sbi->ll_mdc_exp, obd_size_diskmd(sbi->ll_osc_exp, NULL),
+ desc.ld_tgt_count*sizeof(struct llog_cookie));
+
RETURN(rc);
}
CERROR("could not register mount in /proc/lustre");
}
- err = obd_connect(&mdc_conn, obd, &sbi->ll_sb_uuid);
+ err = obd_connect(&mdc_conn, obd, &sbi->ll_sb_uuid, 0);
if (err == -EBUSY) {
CERROR("An MDS (mdc %s) is performing recovery, of which this"
" client is not a part. Please wait for recovery to "
GOTO(out_mdc, err);
}
- err = obd_connect(&osc_conn, obd, &sbi->ll_sb_uuid);
+ err = obd_connect(&osc_conn, obd, &sbi->ll_sb_uuid, 0);
if (err == -EBUSY) {
CERROR("An OST (osc %s) is performing recovery, of which this"
" client is not a part. Please wait for recovery to "
RETURN(fl);
}
-void ll_options(char *options, char **ost, char **mdc, int *flags)
+void ll_options(char *options, char **ost, char **mdc, int *flags,
+ char **clone_opts)
{
char *this_char;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
continue;
if (!*mdc && (*mdc = ll_read_opt("mdc", this_char)))
continue;
+ if (!*clone_opts && (*clone_opts = ll_read_opt("clone",
+ this_char)))
+ continue;
if (!(*flags & LL_SBI_NOLCK) &&
((*flags) = (*flags) |
ll_set_opt("nolock", this_char,
LL_SBI_NOLCK)))
continue;
}
+
EXIT;
}
lli->lli_maxbytes = PAGE_CACHE_MAXBYTES;
spin_lock_init(&lli->lli_lock);
INIT_LIST_HEAD(&lli->lli_pending_write_llaps);
+ lli->lli_inode_magic = LLI_INODE_MAGIC;
}
int ll_fill_super(struct super_block *sb, void *data, int silent)
struct ll_sb_info *sbi;
char *osc = NULL;
char *mdc = NULL;
+ char *clone_opts = NULL;
int err;
ENTRY;
RETURN(-ENOMEM);
sbi->ll_flags |= LL_SBI_READAHEAD;
- ll_options(data, &osc, &mdc, &sbi->ll_flags);
+ ll_options(data, &osc, &mdc, &sbi->ll_flags, &clone_opts);
if (!osc) {
CERROR("no osc\n");
OBD_FREE(mdc, strlen(mdc) + 1);
if (osc)
OBD_FREE(osc, strlen(osc) + 1);
+ if (clone_opts)
+ OBD_FREE(clone_opts, strlen(clone_opts) + 1);
RETURN(err);
} /* ll_read_super */
if (err)
GOTO(out_cleanup, err);
- err = obd_connect(&mdc_conn, obd, &mdc_uuid);
+ err = obd_connect(&mdc_conn, obd, &mdc_uuid, 0);
if (err) {
CERROR("cannot connect to %s: rc = %d\n", lmd->lmd_mds, err);
GOTO(out_cleanup, err);
if (err)
GOTO(out_free, err);
-
+
out_dev:
if (mdc)
OBD_FREE(mdc, strlen(mdc) + 1);
obd = NULL;
lustre_common_put_super(sb);
-
if (sbi->ll_lmd != NULL) {
char * cln_prof;
int len = strlen(sbi->ll_lmd->lmd_profile) + sizeof("-clean")+1;
struct inode *ll_inode_from_lock(struct ldlm_lock *lock)
{
- struct inode *inode;
+ struct inode *inode = NULL;
l_lock(&lock->l_resource->lr_namespace->ns_lock);
- if (lock->l_ast_data)
- inode = igrab(lock->l_ast_data);
- else
- inode = NULL;
+ if (lock->l_ast_data) {
+ struct ll_inode_info *lli = ll_i2info(lock->l_ast_data);
+ if (lli->lli_inode_magic == LLI_INODE_MAGIC) {
+ inode = igrab(lock->l_ast_data);
+ } else {
+ CERROR("DEBUG: l_ast_data %p is bogus: magic %x\n",
+ lock->l_ast_data, lli->lli_inode_magic);
+ }
+ }
l_unlock(&lock->l_resource->lr_namespace->ns_lock);
return inode;
}
int null_if_equal(struct ldlm_lock *lock, void *data)
{
- if (data == lock->l_ast_data)
+ if (data == lock->l_ast_data) {
lock->l_ast_data = NULL;
- if (lock->l_req_mode != lock->l_granted_mode)
- return LDLM_ITER_STOP;
+ if (lock->l_req_mode != lock->l_granted_mode)
+ LDLM_ERROR(lock,"clearing inode with ungranted lock\n");
+ }
return LDLM_ITER_CONTINUE;
}
CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", inode->i_ino,
inode->i_generation, inode);
+ lli->lli_inode_magic = LLI_INODE_DEAD;
ll_inode2fid(&fid, inode);
clear_bit(LLI_F_HAVE_MDS_SIZE_LOCK, &(ll_i2info(inode)->lli_flags));
md_change_cbdata(sbi->ll_mdc_exp, &fid, null_if_equal, inode);
return 0;
}
-void dump_lsm(int level, struct lov_stripe_md *lsm)
-{
- CDEBUG(level, "objid "LPX64", maxbytes "LPX64", magic 0x%08X, "
- "stripe_size %u, stripe_count %u\n",
- lsm->lsm_object_id, lsm->lsm_maxbytes, lsm->lsm_magic,
- lsm->lsm_stripe_size, lsm->lsm_stripe_count);
-}
-
void ll_update_inode(struct inode *inode, struct lustre_md *md)
{
struct ll_inode_info *lli = ll_i2info(inode);